Multi term search in SOLR (WebSphere Commerce7)

313 views Asked by At

My search results for Electric blanket brings up all products specific to electric/blanket/electric blanket". However, I need results only specific to electric blanket.

The query my application sends to SOLR has :

q="electric" "blanket"

What change is required at SOLR config end to make this search only for electric blanket?

3

There are 3 answers

3
alexf On

In your schema.xml, add to the end of the file, before </schema>:

<solrQueryParser defaultOperator="AND"/>

Solr Documentation: https://wiki.apache.org/solr/SchemaXml#Default_query_parser_operator

0
Abed Yaseen On

in SearchSetup.jspf make the default value of searchType = 1001 instead of 1000

<c:set var="searchType" value="1001" scope="request"/>

below is the explanation - also you can find complete list in same file :

    13.  ANY                    |       1000        |  INCLUDE products, kits, bundles, category level SKUs
                                |     (Default)     |  EXCLUDE product level SKUs
                                |                   |
    14.  EXACT                  |       1001        |  INCLUDE products, kits, bundles, category level SKUs
                                |                   |  EXCLUDE product level SKUs
                                |                   |
    15.  ALL                    |       1002        |  INCLUDE products, kits, bundles, category level SKUs
                                |                   |  EXCLUDE product level SKUs

EXACT will force solr to match the whole sentence , same as when you type your search term in inte qoute "search term" , that will search in products that have EXACT sentence in product name , short description , category name , SEO Keywords , name override and description override

Hope this answer you question.

Thanks Abed

0
everreadyeddy On

You can not have results only specific to just electric blanket. You can however ensure the results specific to electric blanket are more relevant and returned at the top of your results.

The configuration of Solr that Websphere Commerce offers out-of-the-box is very basic. In order to receive desired results takes a lot of tuning and configuration changes in both Solr and Webshere Commerce (We resorted to writing a custom class). sarona.co.uk has some nice information about this in their latest blogs.