lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Upayavira ...@odoko.co.uk>
Subject Re: Can anyone explain this Solr query behavior?
Date Fri, 24 May 2013 00:31:12 GMT
(+(doc-id:3000 DisjunctionMaxQuery((Publisher:and^2.0 | text:and |
Classification:and^2.0 | Contributors:and^2.0 |
Title:and^3.0))))/no_coord

You're using edismax, not lucene. So AND is being considered as a search
term, not an operator, and the word 'and' probably exists in 631580
documents.

Why is it triggering dismax? Probably because field:() is not valid
syntax, so edismax is dropping to dismax because it isn't a valid lucene
query.

What do you expect text:() to do?

If you want to match any docs that have a value in the text field, use
q=text:[* TO *]

To match docs that *don't* have a value in the text field: q=-text[* TO
*]

Upayavira

On Fri, May 24, 2013, at 12:23 AM, Shankar Sundararaju wrote:
> Hi Erick,
> 
> Here's the output after turning on the debug flag:
> 
> *q=text:()&debug=query*
> 
>     yields
> 
> <response>
> <lst name="responseHeader">
> <int name="status">0</int>
> <int name="QTime">17</int>
> <lst name="params">
> <str name="indent">true</str>
> <str name="q">text:()</str>
> <str name="debug">query</str>
> </lst>
> </lst>
> <result name="response" numFound="0" start="0" maxScore="0.0"></result>
> <lst name="debug">
> <str name="rawquerystring">text:()</str>
> <str name="querystring">text:()</str>
> <str name="parsedquery">(+())/no_coord</str>
> <str name="parsedquery_toString">+()</str>
> <str name="QParser">ExtendedDismaxQParser</str>
> <null name="altquerystring"/>
> <null name="boost_queries"/>
> <arr name="parsed_boost_queries"/>
> <null name="boostfuncs"/>
> </lst>
> </response>
> 
> *q=doc-id:3000&debug=query*
> 
>     yields
> 
> <response>
> <lst name="responseHeader">
> <int name="status">0</int>
> <int name="QTime">17</int>
> <lst name="params">
> <str name="q">doc-id:3000</str>
> <str name="debug">query</str>
> </lst>
> </lst>
> <result name="response" numFound="1" start="0" maxScore="11.682044">
> <doc>
>   :
>   :
> </doc>
> </result>
> <lst name="debug">
> <str name="rawquerystring">doc-id:3000</str>
> <str name="querystring">doc-id:3000</str>
> <str name="parsedquery">(+doc-id:3000)/no_coord</str>
> <str name="parsedquery_toString">+doc-id:`#8;#0;#0;#23;8</str>
> <str name="QParser">ExtendedDismaxQParser</str>
> <null name="altquerystring"/>
> <null name="boost_queries"/>
> <arr name="parsed_boost_queries"/>
> <null name="boostfuncs"/>
> </lst>
> </response>
> 
> *q=doc-id:3000 AND text:()&debug=query*
> 
>   yields
> 
> <response>
> <lst name="responseHeader">
> <int name="status">0</int>
> <int name="QTime">23</int>
> <lst name="params">
> <str name="q">doc-id:3000 AND text:()</str>
> <str name="debug">query</str>
> </lst>
> </lst>
> <result name="response" numFound="631647" start="0" maxScore="8.056607">
> <doc>
>  :
> </doc>
>  :
> </doc>
> <doc>
>  :
> </doc>
> <doc>
>  :
> </doc>
> <doc>
>  :
> </doc>
> <doc>
>  :
> </doc>
> </result>
> <lst name="debug">
> <str name="rawquerystring">doc-id:3000 AND text:()</str>
> <str name="querystring">doc-id:3000 AND text:()</str>
> <str name="parsedquery">
> (+(doc-id:3000 DisjunctionMaxQuery((Publisher:and^2.0 | text:and |
> Classification:and^2.0 | Contributors:and^2.0 |
> Title:and^3.0))))/no_coord
> </str>
> <str name="parsedquery_toString">
> +(doc-id:`#8;#0;#0;#23;8 (Publisher:and^2.0 | text:and |
> Classification:and^2.0 | Contributors:and^2.0 | Title:and^3.0))
> </str>
> <str name="QParser">ExtendedDismaxQParser</str>
> <null name="altquerystring"/>
> <null name="boost_queries"/>
> <arr name="parsed_boost_queries"/>
> <null name="boostfuncs"/>
> </lst>
> </response>
> 
> *solrconfig.xml:*
> <requestHandler name="/select" class="solr.SearchHandler">
>      <lst name="defaults">
>        <str name="echoParams">explicit</str>
>        <int name="rows">10</int>
>        <str name="df">text</str>
>        <str name="defType">edismax</str>
>        <str name="qf">text^1.0 Title^3.0 Classification^2.0
> Contributors^2.0 Publisher^2.0</str>
>      </lst>
> 
> *schema.xml:*
> <field name="text" type="my_text" indexed="true" stored="false" required=
> "false"/>*
> *
> <dynamicField name="*" type="my_text" indexed="true" stored="true"
> multiValued="false"/>
> <fieldType name="my_text" class="solr.TextField"> <analyzer type="index"
> class="MyAnalyzer"/> <analyzer type="query" class="MyAnalyzer"/>
> <analyzer
> type="multiterm" class="MyAnalyzer"/> </fieldType>
> *
> *
> *Note:* MyAnalyzer among few other customizations, uses
> WhitespaceTokenizer
> and LoweCaseFilter
> 
> Thanks a lot.
> 
> -Shankar
> 
> 
> On Thu, May 23, 2013 at 4:34 AM, Erick Erickson
> <erickerickson@gmail.com>wrote:
> 
> > Please post the results of adding &debug=query to the URL.
> > That'll tell us what the query parser spits out which is much
> > easier to analyze.
> >
> > Best
> > Erick
> >
> > On Wed, May 22, 2013 at 12:16 PM, Shankar Sundararaju
> > <shankar@ebrary.com> wrote:
> > > This query returns 0 documents: *q=(+Title:() +Classification:()
> > > +Contributors:() +text:())*
> > >
> > > This returns 1 document: *q=doc-id:3000*
> > >
> > > And this returns 631580 documents when I was expecting 0: *q=doc-id:3000
> > > AND (+Title:() +Classification:() +Contributors:() +text:())*
> > >
> > > Am I missing something here? Can someone please explain? I am using Solr
> > > 4.2.1
> > >
> > > Thanks
> > > -Shankar
> >
> 
> 
> 
> -- 
> Regards,
> *Shankar Sundararaju
> *Sr. Software Architect
> ebrary, a ProQuest company
> 410 Cambridge Avenue, Palo Alto, CA 94306 USA
> Shankar@ebrary.com | www.ebrary.com | 650-475-8776 (w) | 408-426-3057 (c)

Mime
View raw message