tags:

views:

237

answers:

2

Hi,

How do i get PhraseQuery working in Lucene? Am using standard analyzer.

Thanks!

A: 

PhraseQuery should automatically be used if your query contains quoted words like "stackoverflow question".

zehrer
A: 

Hi,

Thanks for your inputs.... I tried the following code in Lucene.Net,but Lucene still says no results found.

FYI, am using Field.Index.TOKENIZED for "description" field while creating index in Lucene.

Here is my code:

string fieldName = "description"; const string token=@""; inpDesc = token + inpDesc + token;

if (keywordsSearchFilter == KeywordsSearchFilter.ExactPhrase) { PhraseQuery phraseDescQuery = new PhraseQuery();

                phraseDescQuery.Add(new Term(fieldName, inpDesc));

}