views:

1141

answers:

1

I've implemented full text search for a web site using Lucene.NET (Version 2.0). Indexing and searching works well, but I have one problem. If I look for numbers (phone numbers, product numbers etc.) as search terms, I don't get any resulting documents.

I'm using the Lucene.Net.Analysis.SimpleAnalyzer Class. I guess I have to change Analyzer and/or Tokenizer.

Any advice?

Thank you!

+6  A: 

When you build up a Lucene Document, you get to select different indexing options for each field. For fields you don't want tokenized, you need to select the Field.Index.UN_TOKENIZED option. This will keep your phone numbers and product numbers in tact.

I would also advise using the StandardAnalyzer, as its doesn't strip numbers out like SimpleAnalyzer.

It is also important you use the same analyzer for both indexing and searching, to get consistent results.

Andrew Rimmer