views:

222

answers:

1

Can anyone show me an example of how PhraseQuery works in Lucene.Net.

I am building an utility that will scan through the Lucene index created from thousands of word, rtf documents and will search for EXACT match of lines.

For example, if i search for "the quick brown fox jumps over a lazy dog", the search should return the number of document which has the above line as part their content.

To summerize what i have done till now, I am building an Lucene Index using SimpleAnalyzer and using the same analyzer type for searching. For searching i am using IndexSearcher and using MultiFieldQueryParser to parse the lines to be searched.

The code is working fine, but not getting the desired results.

Please can anyone help me to find if i am doing anything wrong.

Thanks in advance

A: 

Use StandardAnalyzer (Tokenizes text based on a sophisticated grammar that recognizes: e-mail addresses; acronyms; Chinese, Japanese, and Korean characters; alphanumerics; and more Puts text in lowercase Removes stop words) instead of SimpleAnalyzer (Divides text at non-letter characters and puts text in lowercase) for Indexing.

If you want to find the document entitled "The Right Way", you can enter title:"The Right Way"

Shashi Bhushan