Lucene serch (no of occurrences)
I am building index & search service in lucene. I'm newbi to lucene and have some query.
I have no problem in indexing and use SimpleAnalyzer to index text files. Now, in searching, I need to write searched data in text file in following format:
<Path of File containing text> <Rank of the file> <No. of occurrences of text in file>
To generate above format, I'm facing difficulty in calculating number of occurrences in particular file. As long as, I search for single text (without space or any special character), the search works fine, but if I use multiple words in query or special character even dot(.), then no. of occurrences fail me.
I'm using SimpleAnalyzer in both index and search. Is there any particular analyzer to get it done?
I am adding file reader in document as follows:
doc.add(new Field("path", f.getPath(), Field.Store.YES, Field.Index.UN_TOKENIZED));
doc.add(new Field("contents", new FileReader(f),Field.TermVector.WITH_POSITIONS_OFFS ETS));
Kindly suggest me in this regard.
Thanks in advance.
Vaibhav Kr Arya