I'm working on a company search API using Lucene.
My Lucene company index has got 2 companies:
1.Abigail Adams National Bancorp, Inc.
2.National Bancorp
If the user types in National Bancorp, then only company # 2(ie. National Bancorp) should be returned and not #1…..ie. only exact matches should be returned.
How do I achieve this functionality?
Thanks for reading.
Best Answer
You can use KeywordAnalyzer to index and search on this field. Keyword Analyzer will generate only one token for the entire string.