1
votes

I am using WhitespaceAnalyzer to index some values.

document.AddField("transcript", <transcript value>, Lucene.Net.Documents.Field.Store.YES, Lucene.Net.Documents.Field.Index.ANALYZED);

and do a search like follows

booleanMiniQuery.Add(new TermQuery(new Term("transcript", <search value>)), rule);

when contains some names like baileys OR bailey doing search for that doesn't return any result.

Can any one tell what I am doing wrong

1

1 Answers

0
votes

Before you search for a term in Lucene, you need to analyze the string with the same analyzer that you indexed that text with (in this case WhiteSpaceAnalyzer).

I would recommend using the QueryParser to make this process a lot easier, for eample:

var qParser = New QueryParsers.Classic.QueryParser(Version, "transcript", WhiteSpaceAnalyzer) var termQuery = qParser.parse(<search value>) booleanMiniQuery.Add(termQuery, rule);