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 geeky2 <ge...@hotmail.com> on 2012/04/12 22:06:20 UTC

searching across multiple fields using edismax - am i setting this up right?

hello all,

i just want to check to make sure i have this right.

i was reading on this page: http://wiki.apache.org/solr/ExtendedDisMax,
thanks to shawn for educating me.

*i want the user to be able to fire a requestHandler but search across
multiple fields (itemNo, productType and brand) WITHOUT them having to
specify in the query url what fields they want / need to search on*

this is what i have in my request handler


  <requestHandler name="partItemNoSearch" class="solr.SearchHandler"
default="false">
    <lst name="defaults">
      <str name="defType">edismax</str>
      <str name="echoParams">all</str>
      <int name="rows">5</int>
      *<str name="qf">itemNo^1.0 productType^.8 brand^.5</str>*
      <str name="q.alt">*:*</str>
    </lst>
    <lst name="appends">
      <str name="sort">rankNo asc, score desc</str>
    </lst>
    <lst name="invariants">
      <str name="facet">false</str>
    </lst>
  </requestHandler>

this would be an example of a single term search going against all three of
the fields

http://bogus:bogus/somecore/select?qt=partItemNoSearch&q=*dishwasher*&debugQuery=on&rows=100

this would be an example of a multiple term search across all three of the
fields

http://bogus:bogus/somecore/select?qt=partItemNoSearch&q=*dishwasher
123-xyz*&debugQuery=on&rows=100


do i understand this correctly?

thank you,
mark




--
View this message in context: http://lucene.472066.n3.nabble.com/searching-across-multiple-fields-using-edismax-am-i-setting-this-up-right-tp3906334p3906334.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: searching across multiple fields using edismax - am i setting this up right?

Posted by Erick Erickson <er...@gmail.com>.
as to 1) you have to define your request handler with
a leading /, as in name= "/partItemNoSearch". Don't
forget to restart your server.

3) Of course. The input terms MUST be run through
the associated analysis chain to have any hope of
matching correctly.

Best
Erick

On Fri, Apr 13, 2012 at 8:36 AM, geeky2 <ge...@hotmail.com> wrote:
> thank you for the response.
>
> it seems to be working well ;)
>
> 1) i tried your suggestion about removing the qt parameter -
>
> *somecore/partItemNoSearch*&q=dishwasher&debugQuery=on&rows=10
>
> but this results in a 404 error message - is there some configuration i am
> missing to support this short-hand syntax for specifying the requestHandler
> in the url ?
>
>
>
> 2) ok - good suggestion.
>
>
>
> 3) yes it looks like it IS searching across all three (3) fields.
>
> i noticed that for the itemNo field, it reduced the search string from
> dishwasher to dishwash - it this because of stemming on the field type, used
> for the itemNo field?
>
> <lst name="debug"><str name="rawquerystring">dishwasher</str><str
> name="querystring">dishwasher</str><str
> name="parsedquery">+DisjunctionMaxQuery((brand:dishwasher^0.5 |
> *itemNo:dishwash* | productType:dishwasher^0.8))</str><str
> name="parsedquery_toString">+(brand:dishwasher^0.5 | itemNo:dishwash |
> productType:dishwasher^0.8)</str>
>
>
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/searching-across-multiple-fields-using-edismax-am-i-setting-this-up-right-tp3906334p3907875.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Re: searching across multiple fields using edismax - am i setting this up right?

Posted by geeky2 <ge...@hotmail.com>.
thank you for the response.

it seems to be working well ;)

1) i tried your suggestion about removing the qt parameter - 

*somecore/partItemNoSearch*&q=dishwasher&debugQuery=on&rows=10

but this results in a 404 error message - is there some configuration i am
missing to support this short-hand syntax for specifying the requestHandler
in the url ?



2) ok - good suggestion.



3) yes it looks like it IS searching across all three (3) fields.

i noticed that for the itemNo field, it reduced the search string from
dishwasher to dishwash - it this because of stemming on the field type, used
for the itemNo field?

<lst name="debug"><str name="rawquerystring">dishwasher</str><str
name="querystring">dishwasher</str><str
name="parsedquery">+DisjunctionMaxQuery((brand:dishwasher^0.5 |
*itemNo:dishwash* | productType:dishwasher^0.8))</str><str
name="parsedquery_toString">+(brand:dishwasher^0.5 | itemNo:dishwash |
productType:dishwasher^0.8)</str>





--
View this message in context: http://lucene.472066.n3.nabble.com/searching-across-multiple-fields-using-edismax-am-i-setting-this-up-right-tp3906334p3907875.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: searching across multiple fields using edismax - am i setting this up right?

Posted by Erick Erickson <er...@gmail.com>.
Looks good on a quick glance. There are a couple of things...

1> there's no need for the "qt" param _if_ you specify the name
as "/partItemNoSearch", just use
blahblah/solr/partItemNoSearch
There's a JIRA about when/if you need at. Either will do, it's
up to you which you prefer.

2> I'd consider moving the sort from the "appends" section to the
"defaults" section on the theory that you may want to override sorting
sometime.

3> Simple way to see the effects of this is to simply append
&debugQuery=on to your URL. You'll see the results of
the query, including the parsed results. It's a little hard to read,
but you should be seeing your search terms spread across
all three fields.

Best
Erick

On Thu, Apr 12, 2012 at 2:06 PM, geeky2 <ge...@hotmail.com> wrote:
> hello all,
>
> i just want to check to make sure i have this right.
>
> i was reading on this page: http://wiki.apache.org/solr/ExtendedDisMax,
> thanks to shawn for educating me.
>
> *i want the user to be able to fire a requestHandler but search across
> multiple fields (itemNo, productType and brand) WITHOUT them having to
> specify in the query url what fields they want / need to search on*
>
> this is what i have in my request handler
>
>
>  <requestHandler name="partItemNoSearch" class="solr.SearchHandler"
> default="false">
>    <lst name="defaults">
>      <str name="defType">edismax</str>
>      <str name="echoParams">all</str>
>      <int name="rows">5</int>
>      *<str name="qf">itemNo^1.0 productType^.8 brand^.5</str>*
>      <str name="q.alt">*:*</str>
>    </lst>
>    <lst name="appends">
>      <str name="sort">rankNo asc, score desc</str>
>    </lst>
>    <lst name="invariants">
>      <str name="facet">false</str>
>    </lst>
>  </requestHandler>
>
> this would be an example of a single term search going against all three of
> the fields
>
> http://bogus:bogus/somecore/select?qt=partItemNoSearch&q=*dishwasher*&debugQuery=on&rows=100
>
> this would be an example of a multiple term search across all three of the
> fields
>
> http://bogus:bogus/somecore/select?qt=partItemNoSearch&q=*dishwasher
> 123-xyz*&debugQuery=on&rows=100
>
>
> do i understand this correctly?
>
> thank you,
> mark
>
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/searching-across-multiple-fields-using-edismax-am-i-setting-this-up-right-tp3906334p3906334.html
> Sent from the Solr - User mailing list archive at Nabble.com.