Re: set fq operator independently
Hi Andreas, You should be able to say: (-organisations:[ TO *] -roles:[ TO *]) OR (+organisations:(150 42) +roles:(174 72)) Study your queries with debuqQuery=true http parameter, at times this is invaluable. Dmitry On Wed, Mar 5, 2014 at 2:54 AM, Andreas Owen a...@conx.ch wrote: i want to use the following in fq and i need to set the operator to OR. My q.op is AND but I need OR in fq. I have read about ofq but that is for putting OR between multiple fq. Can I set the operator for fq? (-organisations:[ TO *] -roles:[ TO *]) (+organisations:(150 42) +roles:(174 72)) The statement should find all docs without organisations and roles or those that have at least one roles and organisations entry. these fields are multivalued. -- Dmitry Blog: http://dmitrykan.blogspot.com Twitter: twitter.com/dmitrykan
Re: set fq operator independently
On 3/4/2014 5:54 PM, Andreas Owen wrote: i want to use the following in fq and i need to set the operator to OR. My q.op is AND but I need OR in fq. I have read about ofq but that is for putting OR between multiple fq. Can I set the operator for fq? (-organisations:[ TO *] -roles:[ TO *]) (+organisations:(150 42) +roles:(174 72)) For your fq parameter, use {!q.op=OR}X where X is your query. The {!XXX} syntax is called a localparam. You may find that the query won't work right even if you add that, because you are using purely negative queries in your first two clauses. The problem with purely negative queries is that you cannot subtract from nothing -- you need to tell Solr what you are subtracting from, which is usually all documents. Sometimes Solr can figure out that it needs to automatically add the *:*, but I am not sure which circumstances will let it work and which won't. If you find that it doesn't work, use something like the following: (*:* -organisations:[* TO *] -roles:[* TO *]) (+organisations:(150 42) +roles:(174 72)) Thanks, Shawn
Re: set fq operator independently
And if you need to cache OR legs separately, here is the workaround http://blog.griddynamics.com/2014/01/segmented-filter-cache-in-solr.html On Wed, Mar 5, 2014 at 12:31 PM, Shawn Heisey s...@elyograg.org wrote: On 3/4/2014 5:54 PM, Andreas Owen wrote: i want to use the following in fq and i need to set the operator to OR. My q.op is AND but I need OR in fq. I have read about ofq but that is for putting OR between multiple fq. Can I set the operator for fq? (-organisations:[ TO *] -roles:[ TO *]) (+organisations:(150 42) +roles:(174 72)) For your fq parameter, use {!q.op=OR}X where X is your query. The {!XXX} syntax is called a localparam. You may find that the query won't work right even if you add that, because you are using purely negative queries in your first two clauses. The problem with purely negative queries is that you cannot subtract from nothing -- you need to tell Solr what you are subtracting from, which is usually all documents. Sometimes Solr can figure out that it needs to automatically add the *:*, but I am not sure which circumstances will let it work and which won't. If you find that it doesn't work, use something like the following: (*:* -organisations:[* TO *] -roles:[* TO *]) (+organisations:(150 42) +roles:(174 72)) Thanks, Shawn -- Sincerely yours Mikhail Khludnev Principal Engineer, Grid Dynamics http://www.griddynamics.com mkhlud...@griddynamics.com
set fq operator independently
i want to use the following in fq and i need to set the operator to OR. My q.op is AND but I need OR in fq. I have read about ofq but that is for putting OR between multiple fq. Can I set the operator for fq? (-organisations:[ TO *] -roles:[ TO *]) (+organisations:(150 42) +roles:(174 72)) The statement should find all docs without organisations and roles or those that have at least one roles and organisations entry. these fields are multivalued.