Lucene.Net PrefixQuery

Posted by Sole on Stack Overflow See other posts from Stack Overflow or by Sole
Published on 2010-04-23T18:47:29Z Indexed on 2010/04/23 19:13 UTC
Read the original article Hit count: 407

Filed under:
|

Hi, i´m development a suggest box for my site search service. I has to search fields like these:

Visual Basic Enterprise Edition
Visual C++
Visual J++

My code is:

Directory dir = Lucene.Net.Store.FSDirectory.GetDirectory("Index", false);

IndexSearcher searcher = new Lucene.Net.Search.IndexSearcher( dir,true);

Term term = new Term("nombreAnalizado", _que);

PrefixQuery query = new PrefixQuery(term);

TopDocs topDocs = searcher.Search(query, 10000);

This code works well in this case: "Enterprise" will match "Visual Basic Enterprise Edition"
But "Enterprise E" doesn´t match anything.

I removed white spaces at indexing time and when the user is searching.

Thanks.

© Stack Overflow or respective owner

Related posts about lucene

Related posts about lucene.net