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 ch...@thomsonreuters.com on 2015/01/05 12:11:37 UTC
questions about default operator within solr query string
Hi,
Nice to have a chance to discuss with solr experts!
We are using solr as our search solution. But now we have a requirement that we don't know how to handle, even after we have looked through the Solr documentation.
The solr version we used is 4.10.1.
For the question, please refer to the following example url:
http://10.90.44.33/solr/searcher/select?start=0&rows=24&fl=id,headline,slug&q=slug:variety-entertainment%20headline:entertainment&sort=score%20asc&debug=true
With our default operator(q.op) is configured as "OR", the parsed query is:
slug:variety slug:entertainment headline:entertainment
But what we really want is as follows:
+slug:variety+slug:entertainment headline:entertainment
So, the question is:
When searching , is there any way to configure the applied operator between the terms from the field "slug" to be "AND" and the operator between the fields "slug" and "headline" is "OR"?
If no, could you please advise on how to handle this requirement in other ways?
Thanks in advance
Chun
Re: questions about default operator within solr query string
Posted by Walter Underwood <wu...@wunderwood.org>.
You may want to put the slug portion of the query in filter queries (fq).
Do you rank on slug or only use them for filtering? Asked another way, are some slugs more important than others or do you want them all to score the same?
It would look like this:
&fl=id,headline,slug&fq=slug:variety&fq=slug:entertainment&q=headline:entertainment
Do you really want "&sort=score%20asc”? That shows the least relevant items (lowest score) first.
wunder
Walter Underwood
wunder@wunderwood.org
http://observer.wunderwood.org/
On Jan 5, 2015, at 3:30 AM, Otis Gospodnetic <ot...@gmail.com> wrote:
> Hi Chun,
>
> Something like:
> +slug:variety +slug:entertainment headline:entertainment should work.
>
> But you may also want to use function queries for slug filtering:
> http://search-lucene.com/?q=fq&fc_project=Solr
> https://cwiki.apache.org/confluence/display/solr/Common+Query+Parameters#CommonQueryParameters-Thefq(FilterQuery)Parameter
>
> Otis
> --
> Monitoring * Alerting * Anomaly Detection * Centralized Log Management
> Solr & Elasticsearch Support * http://sematext.com/
>
>
> On Mon, Jan 5, 2015 at 6:11 AM, <ch...@thomsonreuters.com> wrote:
>
>> Hi,
>>
>> Nice to have a chance to discuss with solr experts!
>>
>> We are using solr as our search solution. But now we have a
>> requirement that we don't know how to handle, even after we have looked
>> through the Solr documentation.
>>
>> The solr version we used is 4.10.1.
>>
>> For the question, please refer to the following example url:
>>
>>
>> http://10.90.44.33/solr/searcher/select?start=0&rows=24&fl=id,headline,slug&q=slug:variety-entertainment%20headline:entertainment&sort=score%20asc&debug=true
>>
>>
>> With our default operator(q.op) is configured as "OR", the parsed
>> query is:
>>
>> slug:variety slug:entertainment headline:entertainment
>>
>>
>> But what we really want is as follows:
>>
>> +slug:variety+slug:entertainment headline:entertainment
>>
>>
>> So, the question is:
>>
>> When searching , is there any way to configure the applied
>> operator between the terms from the field "slug" to be "AND" and the
>> operator between the fields "slug" and "headline" is "OR"?
>>
>> If no, could you please advise on how to handle this
>> requirement in other ways?
>>
>>
>> Thanks in advance
>>
>>
>> Chun
>>
Re: questions about default operator within solr query string
Posted by Otis Gospodnetic <ot...@gmail.com>.
Hi Chun,
Something like:
+slug:variety +slug:entertainment headline:entertainment should work.
But you may also want to use function queries for slug filtering:
http://search-lucene.com/?q=fq&fc_project=Solr
https://cwiki.apache.org/confluence/display/solr/Common+Query+Parameters#CommonQueryParameters-Thefq(FilterQuery)Parameter
Otis
--
Monitoring * Alerting * Anomaly Detection * Centralized Log Management
Solr & Elasticsearch Support * http://sematext.com/
On Mon, Jan 5, 2015 at 6:11 AM, <ch...@thomsonreuters.com> wrote:
> Hi,
>
> Nice to have a chance to discuss with solr experts!
>
> We are using solr as our search solution. But now we have a
> requirement that we don't know how to handle, even after we have looked
> through the Solr documentation.
>
> The solr version we used is 4.10.1.
>
> For the question, please refer to the following example url:
>
>
> http://10.90.44.33/solr/searcher/select?start=0&rows=24&fl=id,headline,slug&q=slug:variety-entertainment%20headline:entertainment&sort=score%20asc&debug=true
>
>
> With our default operator(q.op) is configured as "OR", the parsed
> query is:
>
> slug:variety slug:entertainment headline:entertainment
>
>
> But what we really want is as follows:
>
> +slug:variety+slug:entertainment headline:entertainment
>
>
> So, the question is:
>
> When searching , is there any way to configure the applied
> operator between the terms from the field "slug" to be "AND" and the
> operator between the fields "slug" and "headline" is "OR"?
>
> If no, could you please advise on how to handle this
> requirement in other ways?
>
>
> Thanks in advance
>
>
> Chun
>