You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "Charra, Johannes" <Jo...@haufe-lexware.com> on 2012/11/28 11:54:23 UTC
Preferred query notation for alternative field values
Hi all,
Is there any reason to prefer a query
field:value1 OR field:value2 OR field:value3 OR field:value4
over
field:(value1 OR value2 OR value3 OR value4)
in terms of performance? From what I perceive, there is no difference,
so I'd prefer the second query for readability reasons.
Regards,
Johannes
AW: Preferred query notation for alternative field values
Posted by "Charra, Johannes" <Jo...@haufe-lexware.com>.
Thanks for the hint. You are right: Both queries are identical after parsing.
>>> -----Ursprüngliche Nachricht-----
>>> Von: Upayavira [mailto:uv@odoko.co.uk]
>>> Gesendet: Mittwoch, 28. November 2012 12:04
>>> An: solr-user@lucene.apache.org
>>> Betreff: Re: Preferred query notation for alternative field values
>>>
>>> Use debugQuery=true to see the format of the parsed query.
>>>
>>> Solr will parse the query that you provide into Lucene Query objects, which are
>>> then used to execute the query. The parsed query info provided by
>>> debugQuery=true is basically these Query objects converted back into a string
>>> representation, showing exactly what the query was parsed into.
>>>
>>> I bet you they are both parsed to more or less the same thing, and thus no real
>>> impact on query time.
>>>
>>> Upayavira
>>>
>>> On Wed, Nov 28, 2012, at 10:54 AM, Charra, Johannes wrote:
>>> >
>>> > Hi all,
>>> >
>>> > Is there any reason to prefer a query
>>> >
>>> > field:value1 OR field:value2 OR field:value3 OR field:value4
>>> >
>>> > over
>>> >
>>> > field:(value1 OR value2 OR value3 OR value4)
>>> >
>>> > in terms of performance? From what I perceive, there is no difference,
>>> > so I'd prefer the second query for readability reasons.
>>> >
>>> > Regards,
>>> > Johannes
Re: Preferred query notation for alternative field values
Posted by Upayavira <uv...@odoko.co.uk>.
Use debugQuery=true to see the format of the parsed query.
Solr will parse the query that you provide into Lucene Query objects,
which are then used to execute the query. The parsed query info provided
by debugQuery=true is basically these Query objects converted back into
a string representation, showing exactly what the query was parsed into.
I bet you they are both parsed to more or less the same thing, and thus
no real impact on query time.
Upayavira
On Wed, Nov 28, 2012, at 10:54 AM, Charra, Johannes wrote:
>
> Hi all,
>
> Is there any reason to prefer a query
>
> field:value1 OR field:value2 OR field:value3 OR field:value4
>
> over
>
> field:(value1 OR value2 OR value3 OR value4)
>
> in terms of performance? From what I perceive, there is no difference,
> so I'd prefer the second query for readability reasons.
>
> Regards,
> Johannes