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 Swapnonil Mukherjee <Sw...@gettyimages.com> on 2010/10/25 15:41:50 UTC
How to use AND as opposed to OR as the default query operator.
Hi Everybody,
I simply want to use AND as the default operator in queries. When a user searches for Jennifer Lopez solr converts this to a Jennifer OR Lopez query. On the other hand I want solr to treat this query as Jennifer AND Lopez and not as Jennifer OR Lopez.
In other words I want a default AND behavior in phrase queries instead of OR.
I have seen in this presentation http://www.slideshare.net/pittaya/using-apache-solr on Slide number 52 that this OR behavior is configurable.
Could you please tell me where this configuration is located? I could not locate it in schema.xml.
Swapnonil Mukherjee
+91-40092712
+91-9007131999
Re: How to use AND as opposed to OR as the default query operator.
Posted by Jonathan Rochkind <ro...@jhu.edu>.
However, for user entered queries, I suggest you take a look at dismax,
a lot more suitable for user-entered queries than the standard
solr-lucene query parsers.
Markus Jelsma wrote:
> http://wiki.apache.org/solr/SchemaXml#Default_query_parser_operator
>
> On Monday 25 October 2010 15:41:50 Swapnonil Mukherjee wrote:
>
>> Hi Everybody,
>>
>> I simply want to use AND as the default operator in queries. When a user
>> searches for Jennifer Lopez solr converts this to a Jennifer OR Lopez
>> query. On the other hand I want solr to treat this query as Jennifer AND
>> Lopez and not as Jennifer OR Lopez.
>>
>> In other words I want a default AND behavior in phrase queries instead of
>> OR.
>>
>> I have seen in this presentation
>> http://www.slideshare.net/pittaya/using-apache-solr on Slide number 52
>> that this OR behavior is configurable.
>>
>> Could you please tell me where this configuration is located? I could not
>> locate it in schema.xml.
>>
>> Swapnonil Mukherjee
>> +91-40092712
>> +91-9007131999
>>
>
>
Re: How to use AND as opposed to OR as the default query operator.
Posted by Markus Jelsma <ma...@openindex.io>.
http://wiki.apache.org/solr/SchemaXml#Default_query_parser_operator
On Monday 25 October 2010 15:41:50 Swapnonil Mukherjee wrote:
> Hi Everybody,
>
> I simply want to use AND as the default operator in queries. When a user
> searches for Jennifer Lopez solr converts this to a Jennifer OR Lopez
> query. On the other hand I want solr to treat this query as Jennifer AND
> Lopez and not as Jennifer OR Lopez.
>
> In other words I want a default AND behavior in phrase queries instead of
> OR.
>
> I have seen in this presentation
> http://www.slideshare.net/pittaya/using-apache-solr on Slide number 52
> that this OR behavior is configurable.
>
> Could you please tell me where this configuration is located? I could not
> locate it in schema.xml.
>
> Swapnonil Mukherjee
> +91-40092712
> +91-9007131999
--
Markus Jelsma - CTO - Openindex
http://www.linkedin.com/in/markus17
050-8536600 / 06-50258350
Re: How to use AND as opposed to OR as the default query operator.
Posted by Swapnonil Mukherjee <Sw...@gettyimages.com>.
Hi Pradeep,
I am using the standard query parser. I made the changes in schema.xml and it works.
It is also good to know that this can done on a per query basis as well.
Swapnonil Mukherjee
On 25-Oct-2010, at 7:48 PM, Pradeep Singh wrote:
> Which query handler are you using? For a standard query handler you can set
> q.op per request or set defaultOperator in schema.xml.
>
> For a dismax handler you will have to work with min should match.
>
> On Mon, Oct 25, 2010 at 6:41 AM, Swapnonil Mukherjee <
> Swapnonil.Mukherjee@gettyimages.com> wrote:
>
>> Hi Everybody,
>>
>> I simply want to use AND as the default operator in queries. When a user
>> searches for Jennifer Lopez solr converts this to a Jennifer OR Lopez query.
>> On the other hand I want solr to treat this query as Jennifer AND Lopez and
>> not as Jennifer OR Lopez.
>>
>> In other words I want a default AND behavior in phrase queries instead of
>> OR.
>>
>> I have seen in this presentation
>> http://www.slideshare.net/pittaya/using-apache-solr on Slide number 52
>> that this OR behavior is configurable.
>>
>> Could you please tell me where this configuration is located? I could not
>> locate it in schema.xml.
>>
>> Swapnonil Mukherjee
>> +91-40092712
>> +91-9007131999
>>
>>
>>
>>
Re: How to use AND as opposed to OR as the default query operator.
Posted by Pradeep Singh <pk...@gmail.com>.
Which query handler are you using? For a standard query handler you can set
q.op per request or set defaultOperator in schema.xml.
For a dismax handler you will have to work with min should match.
On Mon, Oct 25, 2010 at 6:41 AM, Swapnonil Mukherjee <
Swapnonil.Mukherjee@gettyimages.com> wrote:
> Hi Everybody,
>
> I simply want to use AND as the default operator in queries. When a user
> searches for Jennifer Lopez solr converts this to a Jennifer OR Lopez query.
> On the other hand I want solr to treat this query as Jennifer AND Lopez and
> not as Jennifer OR Lopez.
>
> In other words I want a default AND behavior in phrase queries instead of
> OR.
>
> I have seen in this presentation
> http://www.slideshare.net/pittaya/using-apache-solr on Slide number 52
> that this OR behavior is configurable.
>
> Could you please tell me where this configuration is located? I could not
> locate it in schema.xml.
>
> Swapnonil Mukherjee
> +91-40092712
> +91-9007131999
>
>
>
>