Finding exact match using Lucene search API

后端 未结 5 1551
失恋的感觉
失恋的感觉 2021-02-09 07:06

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 typ

5条回答
  •  后悔当初
    2021-02-09 07:38

    I googled a lot with no help for the same problem. After scratching my head for a while I found the solution. Search the string within double quotes, that will solve your problem.

    National Bancorp will return both #1 and #2 but "National Bancorp" will return only #2.

提交回复
热议问题