Exact word match Solr

2019-09-01 09:05发布

I want to the exact results for my query.

For e.g. when I search "New york" , then it doesn't give me exact results about New York But it also gives me results like:

"New York"

"New Delhi"

And other cities starting from "New"

So how can I get only results for "New York"?

3条回答
狗以群分
2楼-- · 2019-09-01 09:12

From your question What i Understand is you want "New York" to be consider as single token ,you can do that by modifying tokenizer for field Change Tokenizer from StandardTokenizerFactory to KeywordTokenizerFactory reindex data and query again

查看更多
男人必须洒脱
3楼-- · 2019-09-01 09:15

Depending on exactly what you expect to get as search results, Stupid Lucene Tricks: Exact Match, Starts With, Ends With might also be worth a look.

查看更多
Evening l夕情丶
4楼-- · 2019-09-01 09:29

Phrase query should do the job. Just put quotes around your query terms.

查看更多
登录 后发表回答