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 jesseqper <je...@live.nl> on 2017/08/18 09:12:31 UTC

Match with AND across multiple fields

In my index I have products that have multiple dimensions. I want the user to
be able to search with /name/ + and up to 3 /dimensions/. So a query can
occur like: /ProductX 10x20/, or: /ProductX 10x20x30/. Now I get to many
results back, because matches are like:  /name/ AND /dimension/ OR
/dimension/ OR /dimension/. All should be AND. 

I'm quite new to Solr. Is this something I should configure in "dismax"? 

The fields I'm using: 

<field indexed="true" multiValued="true" name="Height_mm" stored="true"
type="double"/>
<field indexed="true" multiValued="true" name="Outside_diameter_mm"
stored="true" type="double"/>
<field indexed="true" multiValued="true" name="Inside_diameter_mm"
stored="true" type="double"/>
 <field indexed="true" name="name" stored="true" type="title"/>

SearchHandler:

<requestHandler name="dismax" class="solr.SearchHandler" >
    <lst name="defaults">
     <str name="defType">dismax</str>
     <str name="echoParams">explicit</str>
     <float name="tie">0.3</float>
    
<str name="qf">
        supplierArticleId_Prefix
     </str>     
<str name="fl">
        UUID,score
     </str>
     <str name="mm">
        2&lt;-1 5&lt;-2 6&lt;90%
     </str>
     <int name="ps">100</int>
     <str name="q.alt">*:*</str>
    </lst>
    <arr name="last-components">
       <str>spellcheck</str>
    </arr>
  </requestHandler>



--
View this message in context: http://lucene.472066.n3.nabble.com/Match-with-AND-across-multiple-fields-tp4351043.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Match with AND across multiple fields

Posted by Erick Erickson <er...@gmail.com>.
Solr does not implement pure boolean logic, see:
https://lucidworks.com/2011/12/28/why-not-and-or-and-not/

As for your particular query, parenthesize, something like:
name AND (dimension1 or dimension1x2 or dimenstion 1x2x3)

Best,
Erick

On Fri, Aug 18, 2017 at 2:12 AM, jesseqper <je...@live.nl> wrote:
> In my index I have products that have multiple dimensions. I want the user to
> be able to search with /name/ + and up to 3 /dimensions/. So a query can
> occur like: /ProductX 10x20/, or: /ProductX 10x20x30/. Now I get to many
> results back, because matches are like:  /name/ AND /dimension/ OR
> /dimension/ OR /dimension/. All should be AND.
>
> I'm quite new to Solr. Is this something I should configure in "dismax"?
>
> The fields I'm using:
>
> <field indexed="true" multiValued="true" name="Height_mm" stored="true"
> type="double"/>
> <field indexed="true" multiValued="true" name="Outside_diameter_mm"
> stored="true" type="double"/>
> <field indexed="true" multiValued="true" name="Inside_diameter_mm"
> stored="true" type="double"/>
>  <field indexed="true" name="name" stored="true" type="title"/>
>
> SearchHandler:
>
> <requestHandler name="dismax" class="solr.SearchHandler" >
>     <lst name="defaults">
>      <str name="defType">dismax</str>
>      <str name="echoParams">explicit</str>
>      <float name="tie">0.3</float>
>
> <str name="qf">
>         supplierArticleId_Prefix
>      </str>
> <str name="fl">
>         UUID,score
>      </str>
>      <str name="mm">
>         2&lt;-1 5&lt;-2 6&lt;90%
>      </str>
>      <int name="ps">100</int>
>      <str name="q.alt">*:*</str>
>     </lst>
>     <arr name="last-components">
>        <str>spellcheck</str>
>     </arr>
>   </requestHandler>
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Match-with-AND-across-multiple-fields-tp4351043.html
> Sent from the Solr - User mailing list archive at Nabble.com.