Need to create a Google like suggestions using Lucene.net. I am currently using ShingleAnalyzerWrapper for phrase suggestions and successfully. But I need to search for a word suggestions if there is no any phrase found.
I am completely new into Lucene world. I need to implement this in a short time. I would appreciate any advice.
Thanks.
Edit
I want simple answers to my questions.
- Should I use SpellChecker?
- How should I index phrases?
- How to search for phrases(What if there are misspelled words?)?
If you are new to Lucene, this might not be that easy. However, what you need to do at a higher level is check your results from the phrase and if it comes back with zero results…simply create a new Query without the phrase.
I am not sure how your phrase is set up, but you could do:
– keyword search on the phrase and eliminate stopwords. “the big bus” phrase could become “big bus” or just “bus”
– add slop setting to your phrase search
– use Fuzzy search
– More like this search
I would recommend the book “Lucene In Action”, as it covers Lucene 3.0.3. It is for Java, however the current Lucene.net version is 3.0.3 so there is symmetry between the two APIs and examples in the book. The book dedicates a chapter to what you are looking for and the strategies involved in doing: suggested search on a non-exact match (spell checking, suggesting close documents etc.)