Hi Derek,

It might be worth looking into Querqy, an open source query processor for Solr that lets you trigger actions such as down boosts on certain query words.
www.querqy.org & https://github.com/querqy

Best

Charlie

On 13/04/2021 03:14, Derek Poh wrote:
Hi

I am trying to "de-boost" documents that have certain word(s) so that they are pushed back to the end of the result set. Or at least not in the first 60 records of the result set.

The query is doing a q=*:* with a few filter query (fq) parameters.

This is an example of the query which uses bq to check for the word "mask" and give it a negative boost factor,

http://localhost:8983/solr/product/select?start=0&rows=140&fq=P_DO_Flag:(%22Y%22)&fq=P_CategoryGroupId:(11044)&fq=-(P_SPC_Flag:(%22Y%22))&q=*:*&sort=score%20desc,P_DO_SPPRank%20asc,P_DO_Coupon_Flag%20desc,P_SupplierRanking%20desc,random_515%20asc&defType=edismax&bq=P_NewShortDescription:mask^-1&wt=xml&fl=P_ProductId,P_VeryShortDescription,score,P_DO_Flag,P_NewShortDescription

I have tried with
bq=P_NewShortDescription:mask^-1

bq=(*:* -P_NewShortDescription:"mask")^0.5

But the documents that have the word "mask" are not de-boost or pushed back to the back of the result set.

In the result of the query example above, there are 3 documents that have the word "Mask" in the field P_NewShortDescription. 2 of them are not de-boost as they have the same score of 1.5 as those documents that do not have "mask" in them. The remaining  1 document does have a lower score of 1 and it is at the end of the result set.

Could you advice how to correctly de-boost documents that have certain word(s) in them?

This is the definiton of the field that is checked on.
<field name="P_NewShortDescription" type="text_general" omitNorms="true" multiValued="false" indexed="true" stored="true"/>

<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
    <analyzer type="index">
      <tokenizer class="solr.StandardTokenizerFactory"/>
      <filter class="solr.LowerCaseFilterFactory"/>
      <filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>       <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>       <filter class="solr.SynonymGraphFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms.txt"/>
      <filter class="solr.KStemFilterFactory"/>
    </analyzer>
    <analyzer type="query">
      <tokenizer class="solr.StandardTokenizerFactory"/>
      <filter class="solr.LowerCaseFilterFactory"/>
      <filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>       <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>       <filter class="solr.SynonymGraphFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms.txt"/>
      <filter class="solr.KStemFilterFactory"/>
    </analyzer>
  </fieldType>

  Solr version = 7.7.2

  Regards,
  Derek

----------------------
CONFIDENTIALITY NOTICE
This e-mail (including any attachments) may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please inform the sender immediately and delete this e-mail (including any attachments) from your computer, and you must not use, disclose to anyone else or copy this e-mail (including any attachments), whether in whole or in part. This e-mail and any reply to it may be monitored for security, legal, regulatory compliance and/or other appropriate reasons.


--
Charlie Hull - Managing Consultant at OpenSource Connections Limited <www.o19s.com> Founding member of The Search Network <https://thesearchnetwork.com/> and co-author of Searching the Enterprise <https://opensourceconnections.com/about-us/books-resources/>
tel/fax: +44 (0)8700 118334
mobile: +44 (0)7767 825828

Reply via email to