Have a look at what debug shows in the parsed query. I think every
bracket is quite significant actually and you are generating a
different type of clause.

Also, have you thought about putting those individual clauses into
'fq' instead of jointly into 'q'? This may give you faster search too,
as Solr will not have to worry about ranking.

Regards,
   Alex.

On 18 September 2018 at 14:38, Antelmo Aguilar <aagui...@nd.edu> wrote:
> Hi,
>
> I am doing some date queries and I was wondering if there is some way of
> getting this query to work.
>
> ( ( !{!field f=collection_date_range op=Within v='[2000-01-01 TO
> 2018-09-18]'} AND !{!field f=collection_date_range op=Within v='[1960-01-01
> TO 1998-09-18]'} ) AND collection_season:([1999-05 TO 1999-05]) )
>
> I understand that I could just not do NOT queries and instead search for
> 1998-09-18 TO 2000-01-01, but doing NOT queries gives me more results (e.g
> records that do not have collection_date_range defined).
>
> If I remove the parenthesis enclosing the NOT queries, it works.  Without
> the parenthesis the query does not return results though.  So the query
> below, does work.
>
> ( !{!field f=collection_date_range op=Within v='[2000-01-01 TO
> 2018-09-18]'} AND !{!field f=collection_date_range op=Within v='[1960-01-01
> TO 1998-09-18]'} AND collection_season:([1999-05 TO 1999-05]) )
>
> Any insight would be appreciated.  I really do not see the reason why the
> parenthesis enclosing the NOT queries would cause it to not return results.
>
> Best,
> Antelmo

Reply via email to