Changing the default operator from OR to AND in Solr (Magento Enterprise)

前端 未结 6 1325
一向
一向 2021-02-01 23:28

I\'m using Solr with Magento Enterprise. I\'m trying to change the default search operator from OR to AND to make searches more specific by default.

6条回答
  •  情深已故
    2021-02-02 00:13

    Try the following (untested):

    q={!q.op=AND df=articles_title}red jacket&fq=articles_summary:(red AND jacket)&fq=articles_text:(red AND jacket)
    

    and the rest of the fields are used in a similar fashion with fq parameter.

    The above will return all those records where all the mentioned fields contain term red and jacket. However, if you are required to return a record where atleast one field contains red AND jacket, then I suggest that you use a copyfield to map all those fields to a single field and then search against the copyfield type.

提交回复
热议问题