Results 1 to 5 of 5
  1. #1
    rencin is offline Member
    Join Date
    Aug 2009
    Posts
    3
    Rep Power
    0

    Default problem with index file search

    Hi,

    I have an luncene indexed directory conatining two .cfs files, one segments GEN file and segments_3 ,segments_7 files.

    I have written a java code to search the index files. But when i run the code ,i got the following error :

    Exception in thread "main" java.io.FileNotFoundException: D:\LuceneSearchApp\Lucene\public_html\Profiles\seg ments (The system cannot find the file specified)
    at java.io.RandomAccessFile.open(Native Method)
    at java.io.RandomAccessFile.<init>(RandomAccessFile.j ava:212)
    at org.apache.lucene.store.FSIndexInput$Descriptor.<i nit>(FSDirectory.java:425)
    at org.apache.lucene.store.FSIndexInput.<init>(FSDire ctory.java:434)
    at org.apache.lucene.store.FSDirectory.openInput(FSDi rectory.java:324)
    at org.apache.lucene.index.SegmentInfos.read(SegmentI nfos.java:45)
    at org.apache.lucene.index.IndexReader$1.doBody(Index Reader.java:148)
    at org.apache.lucene.store.Lock$With.run(Lock.java:10 9)
    at org.apache.lucene.index.IndexReader.open(IndexRead er.java:143)
    at org.apache.lucene.index.IndexReader.open(IndexRead er.java:138)
    at lucene.M4MarrySearch.main(M4MarrySearch.java:25)


    can anyone plz help me to solve this error.

    regards,
    rencin.

  2. #2
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    842
    Rep Power
    6

    Default

    Have u checked the file exist in the above path?
    Ramya:cool:

  3. #3
    rencin is offline Member
    Join Date
    Aug 2009
    Posts
    3
    Rep Power
    0

    Default

    hi,

    yes, index directory contains segments files(segments.gen, segments_3,segments_7) . This index files are not generated by me. What i have to do is to search the indexed file.

    The code i used for searching index file is:

    String indexDir ="D:\\LuceneSearchApp\\Lucene\\public_html\\Profil es";
    String q ="property_type:SS";


    IndexSearcher is = new IndexSearcher(indexDir);
    Analyzer analyzer = new SimpleAnalyzer();
    Query query = QueryParser.parse(q,"", analyzer);

    Hits hits = is.search(query);

    when i run the code, it shows fileNoFoundException.

    I have earlier done an application to search index file. In that app ,indexed files contain only one segments file. It didn't contain segments.gen and segments_N files.

    what is the difference in it? Is index file created with any other format..

    plz reply..

    Thanks in advance


    regards
    rencin.
    Last edited by rencin; 08-13-2009 at 01:35 PM.

  4. #4
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    842
    Rep Power
    6

    Default

    change to this below format and try.
    D:/LuceneSearchApp/Lucene/public_html/Profiles
    ur file reresentation with "\\" is wrong.Java will not accept
    Ramya:cool:

  5. #5
    rencin is offline Member
    Join Date
    Aug 2009
    Posts
    3
    Rep Power
    0

    Default

    hi ,
    the problem was solved..

    i changed my code as:

    String indexDir ="D:\\LuceneSearchApp\\Lucene\\public_html\\Profil es";

    IndexSearcher searcher = new IndexSearcher(indexDir);
    Analyzer analyzer = new SimpleAnalyzer();
    QueryParser parser = new QueryParser("", analyzer);
    String queryString="LOOKING_FOR:1";
    Query query=null;
    try {
    query = parser.parse(queryString);
    } catch (ParseException e) {
    }
    Hits hits = searcher.search(query);
    for (int i = 0; i < hits.length(); i++)
    {


    System.out.println(hits.doc(1));

    System.out.println"PHOTO_COUNT :"+hits.doci).get"PHOTO_COUNT"));
    }

    now its working...

    thanks you .

    bye
    rencin.

Similar Threads

  1. [SOLVED] Search a .txt file
    By dbashby in forum New To Java
    Replies: 9
    Last Post: 03-25-2009, 11:27 AM
  2. search file inside Zip, Rar file
    By hungerToJava in forum New To Java
    Replies: 0
    Last Post: 03-21-2009, 08:36 AM
  3. Replies: 7
    Last Post: 11-19-2008, 02:09 PM
  4. File Search
    By Juggler in forum New To Java
    Replies: 2
    Last Post: 07-19-2008, 04:09 PM
  5. z-Index problem
    By mjdousti in forum AWT / Swing
    Replies: 1
    Last Post: 12-29-2007, 01:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •