Results 1 to 5 of 5
Thread: problem with index file search
- 08-13-2009, 11:44 AM #1
Member
- Join Date
- Aug 2009
- Posts
- 3
- Rep Power
- 0
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.
- 08-13-2009, 11:59 AM #2
Have u checked the file exist in the above path?
Ramya:cool:
- 08-13-2009, 01:20 PM #3
Member
- Join Date
- Aug 2009
- Posts
- 3
- Rep Power
- 0
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.
- 08-13-2009, 02:22 PM #4
change to this below format and try.
D:/LuceneSearchApp/Lucene/public_html/Profiles
ur file reresentation with "\\" is wrong.Java will not acceptRamya:cool:
- 08-17-2009, 10:27 AM #5
Member
- Join Date
- Aug 2009
- Posts
- 3
- Rep Power
- 0
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
-
[SOLVED] Search a .txt file
By dbashby in forum New To JavaReplies: 9Last Post: 03-25-2009, 11:27 AM -
search file inside Zip, Rar file
By hungerToJava in forum New To JavaReplies: 0Last Post: 03-21-2009, 08:36 AM -
Search a word(taken from one file) in another file and give the line as the output
By SwapnaNaidu in forum New To JavaReplies: 7Last Post: 11-19-2008, 02:09 PM -
File Search
By Juggler in forum New To JavaReplies: 2Last Post: 07-19-2008, 04:09 PM -
z-Index problem
By mjdousti in forum AWT / SwingReplies: 1Last Post: 12-29-2007, 01:34 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks