开发者

How can I search on a list of values using Solr/Lucene?

开发者 https://www.devze.com 2022-12-26 02:52 出处:网络
Given the following query: (field:value1 OR field:value2 OR field:value3 OR ... OR field:value50) Can this be broken down into something less verbose?Basically I have hundreds of category IDs, and

Given the following query:

(field:value1 OR field:value2 OR field:value3 OR ... OR field:value50)

Can this be broken down into something less verbose? Basically I have hundreds of category IDs, and I need to search for items under large groups of category IDs (20-50 at a time). In MySQL, I'd just 开发者_StackOverflow中文版use field IN(value1, value2, value3) rather than (field = value1 OR field = value2 etc...).

Is there a simpler way for Solr/Lucene?


Use

field:(value1 value2 value3)

or if your default operator is AND then use

field:(value1 OR value2 OR value3)


The accepted answer didn't work for me, but the following format did: +(field:value1 OR field:value2 OR field:value3)

0

精彩评论

暂无评论...
验证码 换一张
取 消