Regarding Boolean logic in Solr
I have a Solr index with a year field, I can query all results within a range of y开发者_如何学Goears using the following query which works fine
*:* AND year:[1934 TO 1950]
How would I incorporate the AND operator so I can search for results in a number of selected years, eg. results for year 1930 AND year 1950 only. I tried something like:
*:* AND year:1934 AND year:1950
the above query displays no results.
*:* AND (year:1934 OR year:1950)
Your's does not display a result because there can be no match in both years (but that's what what the expression says).
- You don't need to get
*:* AND year:[1934 TO 1950]
, justyear:[1934 TO 1950]
is enough. - Unless
year
is a multivalued field you probably wantyear:1934 OR year:1950
精彩评论