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 Shamik Bandopadhyay <sh...@gmail.com> on 2014/02/12 23:32:16 UTC

Weird issue with q.op=AND

Hi,

  I'm facing a weird problem while using q.op=AND condition. Looks like it
gets into some conflict if I use multiple "appends" condition in
conjunction. It works as long as I've one filtering condition in appends.

<lst name="appends">
       <str name="fq">Source:"TestHelp"</str>
</lst>

Now, the moment I add an additional parameter, search stops returning any
result.

<lst name="appends">
       <str name="fq">Source:"TestHelp" | Source:"TestHelp2"</str>
</lst>

If I remove "q.op=AND" from request handler, I get results back. Data is
present for both the Source I'm using, so it's not a filtering issue. Even
a blank query fails to return data.

Here's my request handler.

<requestHandler name="/testhandler" class="solr.SearchHandler">
<lst name="defaults">
<str name="echoParams">explicit</str>
<float name="tie">0.01</float>
<str name="wt">velocity</str>
<str name="v.template">browse</str>
<str name="v.contentType">text/html;charset=UTF-8</str>
<str name="v.layout">layout</str>
<str name="v.channel">testhandler</str>
<str name="defType">edismax</str>
<str name="q.op">AND</str>
<str name="q.alt">*:*</str>
<str name="rows">15</str>
<str name="fl">id,url,Source2,text</str>
<str name="qf">text^1.5 title^2</str>
<str name="bq">Source:TestHelp^3 Source:TestHelp2^0.85</str>
<str name="bf">recip(ms(NOW/DAY,PublishDate),3.16e-11,1,1)^2.0</str>
<str name="df">text</str>

<!-- facets -->
<str name="facet">on</str>
<str name="facet.mincount">1</str>
<str name="facet.limit">100</str>
<str name="facet.field">language</str>
<str name="facet.field">Source</str>
 <!-- Highlighting defaults -->
<str name="hl">true</str>
<str name="hl.fl">text title</str>
<str name="f.text.hl.fragsize">250</str>
<str name="f.text.hl.alternateField">ShortDesc</str>

<!-- Spell check settings -->
<str name="spellcheck">true</str>
<str name="spellcheck.dictionary">default</str>
<str name="spellcheck.collate">true</str>
<str name="spellcheck.onlyMorePopular">false</str>
<str name="spellcheck.extendedResults">false</str>
<str name="spellcheck.count">1</str>

                       <!-- Shard Tolerant -->
                        <str name="shards.tolerant">true</str>
</lst>
<lst name="appends">
<str name="fq">Source:"TestHelp" | Source2:"TestHelp2"</str>
</lst>
<arr name="last-components">
<str>spellcheck</str>
</arr>
</requestHandler>

Not sure what's going wrong. I'm using a SolrCloud environment with 2
shards having a replica each.

Any pointers will be appreciated.

Thanks,
Shamik

Re: Weird issue with q.op=AND

Posted by Jack Krupansky <ja...@basetechnology.com>.
Did you mean to use "||" for the OR operator? A single "|" is not treated as 
an operator - it will be treated as a term and sent through normal term 
analysis.

-- Jack Krupansky

-----Original Message----- 
From: Shamik Bandopadhyay
Sent: Wednesday, February 12, 2014 5:32 PM
To: solr-user@lucene.apache.org
Subject: Weird issue with q.op=AND

Hi,

  I'm facing a weird problem while using q.op=AND condition. Looks like it
gets into some conflict if I use multiple "appends" condition in
conjunction. It works as long as I've one filtering condition in appends.

<lst name="appends">
       <str name="fq">Source:"TestHelp"</str>
</lst>

Now, the moment I add an additional parameter, search stops returning any
result.

<lst name="appends">
       <str name="fq">Source:"TestHelp" | Source:"TestHelp2"</str>
</lst>

If I remove "q.op=AND" from request handler, I get results back. Data is
present for both the Source I'm using, so it's not a filtering issue. Even
a blank query fails to return data.

Here's my request handler.

<requestHandler name="/testhandler" class="solr.SearchHandler">
<lst name="defaults">
<str name="echoParams">explicit</str>
<float name="tie">0.01</float>
<str name="wt">velocity</str>
<str name="v.template">browse</str>
<str name="v.contentType">text/html;charset=UTF-8</str>
<str name="v.layout">layout</str>
<str name="v.channel">testhandler</str>
<str name="defType">edismax</str>
<str name="q.op">AND</str>
<str name="q.alt">*:*</str>
<str name="rows">15</str>
<str name="fl">id,url,Source2,text</str>
<str name="qf">text^1.5 title^2</str>
<str name="bq">Source:TestHelp^3 Source:TestHelp2^0.85</str>
<str name="bf">recip(ms(NOW/DAY,PublishDate),3.16e-11,1,1)^2.0</str>
<str name="df">text</str>

<!-- facets -->
<str name="facet">on</str>
<str name="facet.mincount">1</str>
<str name="facet.limit">100</str>
<str name="facet.field">language</str>
<str name="facet.field">Source</str>
<!-- Highlighting defaults -->
<str name="hl">true</str>
<str name="hl.fl">text title</str>
<str name="f.text.hl.fragsize">250</str>
<str name="f.text.hl.alternateField">ShortDesc</str>

<!-- Spell check settings -->
<str name="spellcheck">true</str>
<str name="spellcheck.dictionary">default</str>
<str name="spellcheck.collate">true</str>
<str name="spellcheck.onlyMorePopular">false</str>
<str name="spellcheck.extendedResults">false</str>
<str name="spellcheck.count">1</str>

                       <!-- Shard Tolerant -->
                        <str name="shards.tolerant">true</str>
</lst>
<lst name="appends">
<str name="fq">Source:"TestHelp" | Source2:"TestHelp2"</str>
</lst>
<arr name="last-components">
<str>spellcheck</str>
</arr>
</requestHandler>

Not sure what's going wrong. I'm using a SolrCloud environment with 2
shards having a replica each.

Any pointers will be appreciated.

Thanks,
Shamik 


Re: Weird issue with q.op=AND

Posted by shamik <sh...@gmail.com>.
Thanks, I'll take a look at the debug data.



--
View this message in context: http://lucene.472066.n3.nabble.com/Weird-issue-with-q-op-AND-tp4117013p4117047.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Weird issue with q.op=AND

Posted by Shawn Heisey <so...@elyograg.org>.
On 2/12/2014 4:58 PM, shamik wrote:
> Thanks a lot Shawn. Changing the appends filtering based on your suggestion
> worked. The part which confused me bigtime is the syntax I've been using so
> far without an issue (barring the q.op part).
>
>
> <lst name="appends">
>       <str name="fq">Source:"TestHelp" | Source:"downloads" |
> -AccessMode:"internal" | -workflowparentid:[* TO *]</str>
> </lst>
>
> This has been working as expected and applies the filter correctly. Just
> curious, if its an invalid syntax, how's Solr handling this ?

Honestly, I can't really say what's going on here.  After I got this, I 
tried some example queries like that and they do seem to be parsed 
right.  You could try adding turning on debugQuery for the query that 
doesn't work and see if you can see what the problem is.  I had never 
seen a query syntax with "|" in it before.  The other syntax is a little 
more explicit, though.

Thanks,
Shawn


Re: Weird issue with q.op=AND

Posted by shamik <sh...@gmail.com>.
Thanks a lot Shawn. Changing the appends filtering based on your suggestion
worked. The part which confused me bigtime is the syntax I've been using so
far without an issue (barring the q.op part).


<lst name="appends"> 
     <str name="fq">Source:"TestHelp" | Source:"downloads" |
-AccessMode:"internal" | -workflowparentid:[* TO *]</str> 
</lst>

This has been working as expected and applies the filter correctly. Just
curious, if its an invalid syntax, how's Solr handling this ?



--
View this message in context: http://lucene.472066.n3.nabble.com/Weird-issue-with-q-op-AND-tp4117013p4117022.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Weird issue with q.op=AND

Posted by Shawn Heisey <so...@elyograg.org>.
On 2/12/2014 3:32 PM, Shamik Bandopadhyay wrote:
> Hi,
>
>    I'm facing a weird problem while using q.op=AND condition. Looks like it
> gets into some conflict if I use multiple "appends" condition in
> conjunction. It works as long as I've one filtering condition in appends.
>
> <lst name="appends">
>         <str name="fq">Source:"TestHelp"</str>
> </lst>
>
> Now, the moment I add an additional parameter, search stops returning any
> result.
>
> <lst name="appends">
>         <str name="fq">Source:"TestHelp" | Source:"TestHelp2"</str>
> </lst>
>
> If I remove "q.op=AND" from request handler, I get results back. Data is
> present for both the Source I'm using, so it's not a filtering issue. Even
> a blank query fails to return data.

I'm pretty sure that's not valid Solr query syntax for what you're 
trying to do.  Try this instead, although with these specific examples I 
would leave the quotes out of the fq value:

<lst name="appends">
        <str name="fq">Source:("TestHelp" OR "TestHelp2")</str>
</lst>

It's pretty much accidental (a result of the query analysis chain) that 
it was working when you didn't have q.op=AND.  You can verify what I'm 
saying by looking at the parsed query when adding debugQuery=true as a 
query option.

Thanks,
Shawn