lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aman Deep Singh <>
Subject Give boost only if entire value is present in Query
Date Mon, 19 Jun 2017 12:27:24 GMT
I have a problem ,I need to give the boost to a particular field if and
only if the query contains entire field value (String contains like
e.g. if Field value is ABC DEF
It should match if user query is like ABC DEF XYZ  or XYZ ABC DEF, But it
should not match when user query is like ABC or ABC XYZ
I'm using Solr-6.6.0
also using edismax parser

I tried creating the custom field like

<fieldType name="cust_shingle" class="solr.TextField"
    <analyzer type="index">
      <tokenizer class="solr.KeywordTokenizerFactory"/>
      <filter class="solr.PatternReplaceFilterFactory" pattern=" "
replace="all" replacement=""/>
      <filter class="solr.LowerCaseFilterFactory"/>
    <analyzer type="query">
      <tokenizer class="solr.WhiteSpaceTokenizerFactory"/>
      <filter class="solr.ShingleFilterFactory" minShingleSize="2"
outputUnigrams="true" maxShingleSize="5" tokenSeparator=" "/>
      <filter class="solr.PatternReplaceFilterFactory" pattern=" "
replace="all" replacement=""/>
      <filter class="solr.LowerCaseFilterFactory"/>

But it creating the synonyms query like (user query= 7 armour)

+(((nameSearchNoSyn:7 nameSearchNoSyn:armour)~2)^9.0 | ((brandSearch:7
brandSearch:armour)~2) |

 ((nameSearch:7 nameSearch:armour)~2)^4.0 | (keywords:7 armour)^11.0 |

((descSearchNoSyn:7 descSearchNoSyn:armour)~2)^2.0 |

*((Synonym(brandSearchQueryShingle:7 brandSearchQueryShingle:7armour)
brandSearchQueryShingle:armour)~2)^10.0* |

((descriptionSearch:7 descriptionSearch:armour)~2) |
(categoryKeywords:7 armour)^11.0) ((nameSearch:"7 armour"~5)^9.0 |

 (brandSearch:"7 armour"~5)^8.0 | (descriptionSearch:"7
armour"~5)^2.0) ((nameSearch:"7 armour")^9.0 |

(descriptionSearch:"7 armour")^2.0)

which again is not matching docs  ,

Any idea how to boost the document if the user query contains exact
value of that field

my request handler is as

<lst name="/browse">
<str name="name">/browse</str>
<str name="class">solr.SearchHandler</str>
<lst name="defaults">
<str name="echoParams">explicit</str>
<str name="wt">velocity</str>
<str name="indent">true</str>
<str name="v.template">browse</str>
<str name="v.layout">layout</str>
<str name="title">Solritas</str>
<str name="defType">edismax</str>
<str name="qf">
nameSearch^4 brandSearch *brandSearchQueryShingle*^10
descriptionSearch categoryKeywords^11 keywords^11 nameSearchNoSyn^9
<str name="ps">5</str>
<str name="pf">
nameSearch^9 brandSearch^8 descriptionSearch^2 categoryKeywords^10 keywords^10
<str name="pf2">nameSearch^9 descriptionSearch^2</str>
<str name="ps2">0</str>
<str name="df">searchFields</str>
<str name="mm">100%</str>
<str name="q.alt">*:*</str>
<str name="rows">10</str>
<str name="fl">*,score</str>
<str name="facet.mincount">1</str>
<str name="facet.range.other">after</str>
<str name="spellcheck">true</str>
<str name="spellcheck.extendedResults">false</str>
<str name="spellcheck.count">5</str>
<str name="spellcheck.alternativeTermCount">2</str>
<str name="spellcheck.maxResultsForSuggest">5</str>
<str name="spellcheck.collate">true</str>
<str name="spellcheck.collateExtendedResults">true</str>
<str name="spellcheck.maxCollationTries">5</str>
<str name="spellcheck.maxCollations">10</str>
<str name="sow">*false*</str>
<arr name="last-components">


Aman Deep Singh

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message