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 Andreas Owen <ao...@conx.ch> on 2014/02/17 05:07:59 UTC

query parameters

in solrconfig of my solr 4.3 i have a userdefined requestHandler. i would like to use fq to force the following conditions:
   1: organisations is empty and roles is empty
   2: organisations contains one of the commadelimited list in variable $org
   3: roles contains one of the commadelimited list in variable $r
   4: rule 2 and 3

snipet of what i got (havent checked out if the is a "in" operator like in sql for the list value)

<lst name="defaults">
       <str name="echoParams">explicit</str>
       <int name="rows">10</int>
       <str name="defType">edismax</str>
	   <str name="synonyms">true</str>
	   <str name="qf">plain_text^10 editorschoice^200
		title^20 h_*^14 
		tags^10 thema^15 inhaltstyp^6 breadcrumb^6 doctype^10
		contentmanager^5 links^5
		last_modified^5	url^5
	   </str>
	   <str name="fq">(organisations='' roles='') or (organisations=$org roles=$r) or (organisations='' roles=$r) or (organisations=$org roles='')</str>
	   <str name="bq">(expiration:[NOW TO *] OR (*:* -expiration:*))^6</str>  <!-- tested: now or newer or empty gets small boost -->
	   <str name="bf">div(clicks,max(displays,1))^8</str> <!-- tested -->
	   





Re: Re[2]: query parameters

Posted by Erick Erickson <er...@gmail.com>.
Bah. meant FQ clauses can be most any legal query.

Erick

On Wed, Mar 5, 2014 at 3:49 PM, Erick Erickson <er...@gmail.com> wrote:
> You can just use OR
> GQ clauses can be most any legal query.
>
> On Mar 3, 2014 4:31 PM, "Andreas Owen" <ao...@conx.ch> wrote:
>>
>> ok i like the logic, you can do much more. i think this should do it for
>> me:
>>
>>          (-organisations:["" TO *] -roles:["" TO *]) (+organisations:(150
>> 42) +roles:(174 72))
>>
>>
>> i want to use this 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?
>>
>> 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.
>>
>> -----Original-Nachricht-----
>> > Von: "Erick Erickson" <er...@gmail.com>
>> > An: solr-user@lucene.apache.org
>> > Datum: 19/02/2014 04:09
>> > Betreff: Re: query parameters
>> >
>> > Solr/Lucene query language is NOT strictly boolean, see
>> > Chris's excellent blog here:
>> > http://searchhub.org/dev/2011/12/28/why-not-and-or-and-not/
>> >
>> > Best,
>> > Erick
>> >
>> >
>> > On Tue, Feb 18, 2014 at 11:54 AM, Andreas Owen <ao...@conx.ch> wrote:
>> >
>> > > I tried it in solr admin query and it showed me all the docs without a
>> > > value
>> > > in ogranisations and roles. It didn't matter if i used a base term,
>> > > isn't
>> > > that give through the q-parameter?
>> > >
>> > > -----Original Message-----
>> > > From: Raymond Wiker [mailto:rwiker@gmail.com]
>> > > Sent: Dienstag, 18. Februar 2014 13:19
>> > > To: solr-user@lucene.apache.org
>> > > Subject: Re: query parameters
>> > >
>> > > That could be because the second condition does not do what you think
>> > > it
>> > > does... have you tried running the second condition separately?
>> > >
>> > > You may have to add a "base term" to the second condition, like what
>> > > you
>> > > have for the "bq" parameter in your config file; i.e, something like
>> > >
>> > > (*:* -organisations:["" TO *] -roles:["" TO *])
>> > >
>> > >
>> > >
>> > >
>> > > On Tue, Feb 18, 2014 at 12:16 PM, Andreas Owen <ao...@conx.ch> wrote:
>> > >
>> > > > It seams that fq doesn't except OR because: (organisations:(150 OR
>> > > > 41)
>> > > > AND
>> > > > roles:(174)) OR  (-organisations:["" TO *] AND -roles:["" TO *])
>> > > > only
>> > > > returns docs that match the first conditions. it doesn't return any
>> > > > docs with the empty fields organisations and roles.
>> > > >
>> > > > -----Original Message-----
>> > > > From: Andreas Owen [mailto:ao@conx.ch]
>> > > > Sent: Montag, 17. Februar 2014 05:08
>> > > > To: solr-user@lucene.apache.org
>> > > > Subject: query parameters
>> > > >
>> > > >
>> > > > in solrconfig of my solr 4.3 i have a userdefined requestHandler. i
>> > > > would like to use fq to force the following conditions:
>> > > >    1: organisations is empty and roles is empty
>> > > >    2: organisations contains one of the commadelimited list in
>> > > > variable $org
>> > > >    3: roles contains one of the commadelimited list in variable $r
>> > > >    4: rule 2 and 3
>> > > >
>> > > > snipet of what i got (havent checked out if the is a "in" operator
>> > > > like in sql for the list value)
>> > > >
>> > > > <lst name="defaults">
>> > > >        <str name="echoParams">explicit</str>
>> > > >        <int name="rows">10</int>
>> > > >        <str name="defType">edismax</str>
>> > > >            <str name="synonyms">true</str>
>> > > >            <str name="qf">plain_text^10 editorschoice^200
>> > > >                 title^20 h_*^14
>> > > >                 tags^10 thema^15 inhaltstyp^6 breadcrumb^6
>> > > > doctype^10
>> > > >                 contentmanager^5 links^5
>> > > >                 last_modified^5 url^5
>> > > >            </str>
>> > > >            <str name="fq">(organisations='' roles='') or
>> > > > (organisations=$org roles=$r) or (organisations='' roles=$r) or
>> > > > (organisations=$org roles='')</str>
>> > > >            <str name="bq">(expiration:[NOW TO *] OR (*:*
>> > > > -expiration:*))^6</str>  <!-- tested: now or newer or empty gets
>> > > > small
>> > > > boost -->
>> > > >            <str name="bf">div(clicks,max(displays,1))^8</str> <!--
>> > > > tested
>> > > > -->
>> > > >
>> > > >
>> > > >
>> > > >
>> > > >
>> > > >
>> > >
>> > >
>>
>>
>>
>

Re: Re[2]: query parameters

Posted by Erick Erickson <er...@gmail.com>.
You can just use OR
GQ clauses can be most any legal query.
On Mar 3, 2014 4:31 PM, "Andreas Owen" <ao...@conx.ch> wrote:

> ok i like the logic, you can do much more. i think this should do it for
> me:
>
>          (-organisations:["" TO *] -roles:["" TO *]) (+organisations:(150
> 42) +roles:(174 72))
>
>
> i want to use this 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?
>
> 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.
>
> -----Original-Nachricht-----
> > Von: "Erick Erickson" <er...@gmail.com>
> > An: solr-user@lucene.apache.org
> > Datum: 19/02/2014 04:09
> > Betreff: Re: query parameters
> >
> > Solr/Lucene query language is NOT strictly boolean, see
> > Chris's excellent blog here:
> > http://searchhub.org/dev/2011/12/28/why-not-and-or-and-not/
> >
> > Best,
> > Erick
> >
> >
> > On Tue, Feb 18, 2014 at 11:54 AM, Andreas Owen <ao...@conx.ch> wrote:
> >
> > > I tried it in solr admin query and it showed me all the docs without a
> > > value
> > > in ogranisations and roles. It didn't matter if i used a base term,
> isn't
> > > that give through the q-parameter?
> > >
> > > -----Original Message-----
> > > From: Raymond Wiker [mailto:rwiker@gmail.com]
> > > Sent: Dienstag, 18. Februar 2014 13:19
> > > To: solr-user@lucene.apache.org
> > > Subject: Re: query parameters
> > >
> > > That could be because the second condition does not do what you think
> it
> > > does... have you tried running the second condition separately?
> > >
> > > You may have to add a "base term" to the second condition, like what
> you
> > > have for the "bq" parameter in your config file; i.e, something like
> > >
> > > (*:* -organisations:["" TO *] -roles:["" TO *])
> > >
> > >
> > >
> > >
> > > On Tue, Feb 18, 2014 at 12:16 PM, Andreas Owen <ao...@conx.ch> wrote:
> > >
> > > > It seams that fq doesn't except OR because: (organisations:(150 OR
> 41)
> > > > AND
> > > > roles:(174)) OR  (-organisations:["" TO *] AND -roles:["" TO *]) only
> > > > returns docs that match the first conditions. it doesn't return any
> > > > docs with the empty fields organisations and roles.
> > > >
> > > > -----Original Message-----
> > > > From: Andreas Owen [mailto:ao@conx.ch]
> > > > Sent: Montag, 17. Februar 2014 05:08
> > > > To: solr-user@lucene.apache.org
> > > > Subject: query parameters
> > > >
> > > >
> > > > in solrconfig of my solr 4.3 i have a userdefined requestHandler. i
> > > > would like to use fq to force the following conditions:
> > > >    1: organisations is empty and roles is empty
> > > >    2: organisations contains one of the commadelimited list in
> > > > variable $org
> > > >    3: roles contains one of the commadelimited list in variable $r
> > > >    4: rule 2 and 3
> > > >
> > > > snipet of what i got (havent checked out if the is a "in" operator
> > > > like in sql for the list value)
> > > >
> > > > <lst name="defaults">
> > > >        <str name="echoParams">explicit</str>
> > > >        <int name="rows">10</int>
> > > >        <str name="defType">edismax</str>
> > > >            <str name="synonyms">true</str>
> > > >            <str name="qf">plain_text^10 editorschoice^200
> > > >                 title^20 h_*^14
> > > >                 tags^10 thema^15 inhaltstyp^6 breadcrumb^6 doctype^10
> > > >                 contentmanager^5 links^5
> > > >                 last_modified^5 url^5
> > > >            </str>
> > > >            <str name="fq">(organisations='' roles='') or
> > > > (organisations=$org roles=$r) or (organisations='' roles=$r) or
> > > > (organisations=$org roles='')</str>
> > > >            <str name="bq">(expiration:[NOW TO *] OR (*:*
> > > > -expiration:*))^6</str>  <!-- tested: now or newer or empty gets
> small
> > > > boost -->
> > > >            <str name="bf">div(clicks,max(displays,1))^8</str> <!--
> > > > tested
> > > > -->
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
>
>
>
>

Re[2]: query parameters

Posted by Andreas Owen <ao...@conx.ch>.
ok i like the logic, you can do much more. i think this should do it for me:

         (-organisations:["" TO *] -roles:["" TO *]) (+organisations:(150 42) +roles:(174 72))


i want to use this 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?

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.

-----Original-Nachricht----- 
> Von: "Erick Erickson" <er...@gmail.com> 
> An: solr-user@lucene.apache.org 
> Datum: 19/02/2014 04:09 
> Betreff: Re: query parameters 
> 
> Solr/Lucene query language is NOT strictly boolean, see
> Chris's excellent blog here:
> http://searchhub.org/dev/2011/12/28/why-not-and-or-and-not/
> 
> Best,
> Erick
> 
> 
> On Tue, Feb 18, 2014 at 11:54 AM, Andreas Owen <ao...@conx.ch> wrote:
> 
> > I tried it in solr admin query and it showed me all the docs without a
> > value
> > in ogranisations and roles. It didn't matter if i used a base term, isn't
> > that give through the q-parameter?
> >
> > -----Original Message-----
> > From: Raymond Wiker [mailto:rwiker@gmail.com]
> > Sent: Dienstag, 18. Februar 2014 13:19
> > To: solr-user@lucene.apache.org
> > Subject: Re: query parameters
> >
> > That could be because the second condition does not do what you think it
> > does... have you tried running the second condition separately?
> >
> > You may have to add a "base term" to the second condition, like what you
> > have for the "bq" parameter in your config file; i.e, something like
> >
> > (*:* -organisations:["" TO *] -roles:["" TO *])
> >
> >
> >
> >
> > On Tue, Feb 18, 2014 at 12:16 PM, Andreas Owen <ao...@conx.ch> wrote:
> >
> > > It seams that fq doesn't except OR because: (organisations:(150 OR 41)
> > > AND
> > > roles:(174)) OR  (-organisations:["" TO *] AND -roles:["" TO *]) only
> > > returns docs that match the first conditions. it doesn't return any
> > > docs with the empty fields organisations and roles.
> > >
> > > -----Original Message-----
> > > From: Andreas Owen [mailto:ao@conx.ch]
> > > Sent: Montag, 17. Februar 2014 05:08
> > > To: solr-user@lucene.apache.org
> > > Subject: query parameters
> > >
> > >
> > > in solrconfig of my solr 4.3 i have a userdefined requestHandler. i
> > > would like to use fq to force the following conditions:
> > >    1: organisations is empty and roles is empty
> > >    2: organisations contains one of the commadelimited list in
> > > variable $org
> > >    3: roles contains one of the commadelimited list in variable $r
> > >    4: rule 2 and 3
> > >
> > > snipet of what i got (havent checked out if the is a "in" operator
> > > like in sql for the list value)
> > >
> > > <lst name="defaults">
> > >        <str name="echoParams">explicit</str>
> > >        <int name="rows">10</int>
> > >        <str name="defType">edismax</str>
> > >            <str name="synonyms">true</str>
> > >            <str name="qf">plain_text^10 editorschoice^200
> > >                 title^20 h_*^14
> > >                 tags^10 thema^15 inhaltstyp^6 breadcrumb^6 doctype^10
> > >                 contentmanager^5 links^5
> > >                 last_modified^5 url^5
> > >            </str>
> > >            <str name="fq">(organisations='' roles='') or
> > > (organisations=$org roles=$r) or (organisations='' roles=$r) or
> > > (organisations=$org roles='')</str>
> > >            <str name="bq">(expiration:[NOW TO *] OR (*:*
> > > -expiration:*))^6</str>  <!-- tested: now or newer or empty gets small
> > > boost -->
> > >            <str name="bf">div(clicks,max(displays,1))^8</str> <!--
> > > tested
> > > -->
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >




Re: query parameters

Posted by Erick Erickson <er...@gmail.com>.
Solr/Lucene query language is NOT strictly boolean, see
Chris's excellent blog here:
http://searchhub.org/dev/2011/12/28/why-not-and-or-and-not/

Best,
Erick


On Tue, Feb 18, 2014 at 11:54 AM, Andreas Owen <ao...@conx.ch> wrote:

> I tried it in solr admin query and it showed me all the docs without a
> value
> in ogranisations and roles. It didn't matter if i used a base term, isn't
> that give through the q-parameter?
>
> -----Original Message-----
> From: Raymond Wiker [mailto:rwiker@gmail.com]
> Sent: Dienstag, 18. Februar 2014 13:19
> To: solr-user@lucene.apache.org
> Subject: Re: query parameters
>
> That could be because the second condition does not do what you think it
> does... have you tried running the second condition separately?
>
> You may have to add a "base term" to the second condition, like what you
> have for the "bq" parameter in your config file; i.e, something like
>
> (*:* -organisations:["" TO *] -roles:["" TO *])
>
>
>
>
> On Tue, Feb 18, 2014 at 12:16 PM, Andreas Owen <ao...@conx.ch> wrote:
>
> > It seams that fq doesn't except OR because: (organisations:(150 OR 41)
> > AND
> > roles:(174)) OR  (-organisations:["" TO *] AND -roles:["" TO *]) only
> > returns docs that match the first conditions. it doesn't return any
> > docs with the empty fields organisations and roles.
> >
> > -----Original Message-----
> > From: Andreas Owen [mailto:ao@conx.ch]
> > Sent: Montag, 17. Februar 2014 05:08
> > To: solr-user@lucene.apache.org
> > Subject: query parameters
> >
> >
> > in solrconfig of my solr 4.3 i have a userdefined requestHandler. i
> > would like to use fq to force the following conditions:
> >    1: organisations is empty and roles is empty
> >    2: organisations contains one of the commadelimited list in
> > variable $org
> >    3: roles contains one of the commadelimited list in variable $r
> >    4: rule 2 and 3
> >
> > snipet of what i got (havent checked out if the is a "in" operator
> > like in sql for the list value)
> >
> > <lst name="defaults">
> >        <str name="echoParams">explicit</str>
> >        <int name="rows">10</int>
> >        <str name="defType">edismax</str>
> >            <str name="synonyms">true</str>
> >            <str name="qf">plain_text^10 editorschoice^200
> >                 title^20 h_*^14
> >                 tags^10 thema^15 inhaltstyp^6 breadcrumb^6 doctype^10
> >                 contentmanager^5 links^5
> >                 last_modified^5 url^5
> >            </str>
> >            <str name="fq">(organisations='' roles='') or
> > (organisations=$org roles=$r) or (organisations='' roles=$r) or
> > (organisations=$org roles='')</str>
> >            <str name="bq">(expiration:[NOW TO *] OR (*:*
> > -expiration:*))^6</str>  <!-- tested: now or newer or empty gets small
> > boost -->
> >            <str name="bf">div(clicks,max(displays,1))^8</str> <!--
> > tested
> > -->
> >
> >
> >
> >
> >
> >
>
>

RE: query parameters

Posted by Andreas Owen <ao...@conx.ch>.
I tried it in solr admin query and it showed me all the docs without a value
in ogranisations and roles. It didn't matter if i used a base term, isn't
that give through the q-parameter?

-----Original Message-----
From: Raymond Wiker [mailto:rwiker@gmail.com] 
Sent: Dienstag, 18. Februar 2014 13:19
To: solr-user@lucene.apache.org
Subject: Re: query parameters

That could be because the second condition does not do what you think it
does... have you tried running the second condition separately?

You may have to add a "base term" to the second condition, like what you
have for the "bq" parameter in your config file; i.e, something like

(*:* -organisations:["" TO *] -roles:["" TO *])




On Tue, Feb 18, 2014 at 12:16 PM, Andreas Owen <ao...@conx.ch> wrote:

> It seams that fq doesn't except OR because: (organisations:(150 OR 41) 
> AND
> roles:(174)) OR  (-organisations:["" TO *] AND -roles:["" TO *]) only 
> returns docs that match the first conditions. it doesn't return any 
> docs with the empty fields organisations and roles.
>
> -----Original Message-----
> From: Andreas Owen [mailto:ao@conx.ch]
> Sent: Montag, 17. Februar 2014 05:08
> To: solr-user@lucene.apache.org
> Subject: query parameters
>
>
> in solrconfig of my solr 4.3 i have a userdefined requestHandler. i 
> would like to use fq to force the following conditions:
>    1: organisations is empty and roles is empty
>    2: organisations contains one of the commadelimited list in 
> variable $org
>    3: roles contains one of the commadelimited list in variable $r
>    4: rule 2 and 3
>
> snipet of what i got (havent checked out if the is a "in" operator 
> like in sql for the list value)
>
> <lst name="defaults">
>        <str name="echoParams">explicit</str>
>        <int name="rows">10</int>
>        <str name="defType">edismax</str>
>            <str name="synonyms">true</str>
>            <str name="qf">plain_text^10 editorschoice^200
>                 title^20 h_*^14
>                 tags^10 thema^15 inhaltstyp^6 breadcrumb^6 doctype^10
>                 contentmanager^5 links^5
>                 last_modified^5 url^5
>            </str>
>            <str name="fq">(organisations='' roles='') or 
> (organisations=$org roles=$r) or (organisations='' roles=$r) or 
> (organisations=$org roles='')</str>
>            <str name="bq">(expiration:[NOW TO *] OR (*:* 
> -expiration:*))^6</str>  <!-- tested: now or newer or empty gets small 
> boost -->
>            <str name="bf">div(clicks,max(displays,1))^8</str> <!-- 
> tested
> -->
>
>
>
>
>
>


Re: query parameters

Posted by Raymond Wiker <rw...@gmail.com>.
That could be because the second condition does not do what you think it
does... have you tried running the second condition separately?

You may have to add a "base term" to the second condition, like what you
have for the "bq" parameter in your config file; i.e, something like

(*:* -organisations:["" TO *] -roles:["" TO *])




On Tue, Feb 18, 2014 at 12:16 PM, Andreas Owen <ao...@conx.ch> wrote:

> It seams that fq doesn't except OR because: (organisations:(150 OR 41) AND
> roles:(174)) OR  (-organisations:["" TO *] AND -roles:["" TO *]) only
> returns docs that match the first conditions. it doesn't return any docs
> with the empty fields organisations and roles.
>
> -----Original Message-----
> From: Andreas Owen [mailto:ao@conx.ch]
> Sent: Montag, 17. Februar 2014 05:08
> To: solr-user@lucene.apache.org
> Subject: query parameters
>
>
> in solrconfig of my solr 4.3 i have a userdefined requestHandler. i would
> like to use fq to force the following conditions:
>    1: organisations is empty and roles is empty
>    2: organisations contains one of the commadelimited list in variable
> $org
>    3: roles contains one of the commadelimited list in variable $r
>    4: rule 2 and 3
>
> snipet of what i got (havent checked out if the is a "in" operator like in
> sql for the list value)
>
> <lst name="defaults">
>        <str name="echoParams">explicit</str>
>        <int name="rows">10</int>
>        <str name="defType">edismax</str>
>            <str name="synonyms">true</str>
>            <str name="qf">plain_text^10 editorschoice^200
>                 title^20 h_*^14
>                 tags^10 thema^15 inhaltstyp^6 breadcrumb^6 doctype^10
>                 contentmanager^5 links^5
>                 last_modified^5 url^5
>            </str>
>            <str name="fq">(organisations='' roles='') or
> (organisations=$org roles=$r) or (organisations='' roles=$r) or
> (organisations=$org roles='')</str>
>            <str name="bq">(expiration:[NOW TO *] OR (*:*
> -expiration:*))^6</str>  <!-- tested: now or newer or empty gets small
> boost -->
>            <str name="bf">div(clicks,max(displays,1))^8</str> <!-- tested
> -->
>
>
>
>
>
>

RE: query parameters

Posted by Andreas Owen <ao...@conx.ch>.
It seams that fq doesn't except OR because: (organisations:(150 OR 41) AND roles:(174)) OR  (-organisations:["" TO *] AND -roles:["" TO *]) only returns docs that match the first conditions. it doesn't return any docs with the empty fields organisations and roles.

-----Original Message-----
From: Andreas Owen [mailto:ao@conx.ch] 
Sent: Montag, 17. Februar 2014 05:08
To: solr-user@lucene.apache.org
Subject: query parameters


in solrconfig of my solr 4.3 i have a userdefined requestHandler. i would like to use fq to force the following conditions:
   1: organisations is empty and roles is empty
   2: organisations contains one of the commadelimited list in variable $org
   3: roles contains one of the commadelimited list in variable $r
   4: rule 2 and 3

snipet of what i got (havent checked out if the is a "in" operator like in sql for the list value)

<lst name="defaults">
       <str name="echoParams">explicit</str>
       <int name="rows">10</int>
       <str name="defType">edismax</str>
	   <str name="synonyms">true</str>
	   <str name="qf">plain_text^10 editorschoice^200
		title^20 h_*^14 
		tags^10 thema^15 inhaltstyp^6 breadcrumb^6 doctype^10
		contentmanager^5 links^5
		last_modified^5	url^5
	   </str>
	   <str name="fq">(organisations='' roles='') or (organisations=$org roles=$r) or (organisations='' roles=$r) or (organisations=$org roles='')</str>
	   <str name="bq">(expiration:[NOW TO *] OR (*:* -expiration:*))^6</str>  <!-- tested: now or newer or empty gets small boost -->
	   <str name="bf">div(clicks,max(displays,1))^8</str> <!-- tested -->