Difference in boolean query parsing. Solr-5.4.0 VS Solr.6.1.0

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Difference in boolean query parsing. Solr-5.4.0 VS Solr.6.1.0

Modassar Ather-2
Hi,

During migration from Solr-5.4.1 to Solr-6.1.0 I saw a difference in the
behavior of few of my boolean queries.
As per my current understanding the default operator comes in when there is
no operator present in between two terms.
Also both the ANDed terms are marked mandatory if not, any of them is
introduced as NOT. Same is the case with OR.
Please correct me if my understanding is wrong.

The below queries are parsed differently and causes a lot of difference in
search result.
The default operator used is AND and no mm is set.


*Query      : *fl:(network hardware AND device OR system)
*Solr.6.1.0 :* "+(+fl:network +fl:hardware fl:device fl:system)"
*Solr-5.4.0 : *"+(fl:network +fl:hardware +fl:device fl:system)"

*Query      : *fl:(network OR hardware device system)
*Solr.6.1.0 : *"+(fl:network fl:hardware +fl:device +fl:system)"
*Solr-5.4.0 : *"+(fl:network fl:hardware fl:device fl:system)"

*Query      : *fl:(network OR hardware AND device OR system)
*Solr.6.1.0 : *"+(fl:network +fl:hardware fl:device fl:system)"
*Solr-5.4.0 : *"+(fl:network +fl:hardware +fl:device fl:system)"

*Query      : *fl:(network AND hardware AND device OR system)"
*Solr.6.1.0 : *"+(+fl:network +fl:hardware fl:device fl:system)"
*Solr-5.4.0 : *"+(+fl:network +fl:hardware +fl:device fl:system)"

Please help me understand the difference in parsing and its effect on
search.

Thanks,
Modassar
Reply | Threaded
Open this post in threaded view
|

Re: Difference in boolean query parsing. Solr-5.4.0 VS Solr.6.1.0

sarowe
It’s fairly likely these differences are as a result of SOLR-2649[1] (released with 5.5) and SOLR-8812[2] (released with 6.1).

If you haven’t seen it, I recommend you read Hoss'ss blog “Why Not AND, OR, And NOT?” <https://lucidworks.com/blog/2011/12/28/why-not-and-or-and-not/>.

If you can, add parentheses to explicitly specify precedence.

[1] https://issues.apache.org/jira/browse/SOLR-2649
[2] https://issues.apache.org/jira/browse/SOLR-8812

--
Steve
www.lucidworks.com

> On Aug 4, 2016, at 2:23 AM, Modassar Ather <[hidden email]> wrote:
>
> Hi,
>
> During migration from Solr-5.4.1 to Solr-6.1.0 I saw a difference in the
> behavior of few of my boolean queries.
> As per my current understanding the default operator comes in when there is
> no operator present in between two terms.
> Also both the ANDed terms are marked mandatory if not, any of them is
> introduced as NOT. Same is the case with OR.
> Please correct me if my understanding is wrong.
>
> The below queries are parsed differently and causes a lot of difference in
> search result.
> The default operator used is AND and no mm is set.
>
>
> *Query      : *fl:(network hardware AND device OR system)
> *Solr.6.1.0 :* "+(+fl:network +fl:hardware fl:device fl:system)"
> *Solr-5.4.0 : *"+(fl:network +fl:hardware +fl:device fl:system)"
>
> *Query      : *fl:(network OR hardware device system)
> *Solr.6.1.0 : *"+(fl:network fl:hardware +fl:device +fl:system)"
> *Solr-5.4.0 : *"+(fl:network fl:hardware fl:device fl:system)"
>
> *Query      : *fl:(network OR hardware AND device OR system)
> *Solr.6.1.0 : *"+(fl:network +fl:hardware fl:device fl:system)"
> *Solr-5.4.0 : *"+(fl:network +fl:hardware +fl:device fl:system)"
>
> *Query      : *fl:(network AND hardware AND device OR system)"
> *Solr.6.1.0 : *"+(+fl:network +fl:hardware fl:device fl:system)"
> *Solr-5.4.0 : *"+(+fl:network +fl:hardware +fl:device fl:system)"
>
> Please help me understand the difference in parsing and its effect on
> search.
>
> Thanks,
> Modassar