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}XXXXX where XXXXX 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>