views:

110

answers:

2

Hi all

I have a Solr index with a year field, I can query all results within a range of years 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

Thanks in Advance Ruth

+1  A: 
*:* 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).

Tomalak
+2  A: 
  1. You don't need to get *:* AND year:[1934 TO 1950], just year:[1934 TO 1950] is enough.
  2. Unless year is a multivalued field you probably want year:1934 OR year:1950
Mauricio Scheffer