lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aman Deep Singh <amandeep.coo...@gmail.com>
Subject Re: Give boost only if entire value is present in Query
Date Mon, 19 Jun 2017 14:59:22 GMT
Yes Susheel ,
I know that more token matched gives more weight but in my case if entire
match I want around x times boost but in case of partial match I want to
give nominal boost or normal boost,
Now in case of keyword token ziet or phrase query they work if and only if
the user query is exactly matched to the index value but in my case
Suppose index term is ABC DEF
I Want to give more boost even if user query is ABC DEF XYZ and so on , so
normal keyword tokenized field not work


On 19-Jun-2017 7:46 PM, "Susheel Kumar" <susheel2777@gmail.com> wrote:

In general, the documents which has more or all terms matched against query
terms will be boosted higher per lucene tf/idf scoring.

So for document having ABC DEF queries like ABC DEF XYZ  or XYZ ABC DEF
will find a match(assuming q.op=AND)  and will be boosted higher compare to
documents with ABC or only DEF.

If you do not want match when user query is like ABC or ABC XYZ then you
have to use phrase queries or fields with keyword tokenizer etc.  and in
which case above queries will not work.

Thnx


On Mon, Jun 19, 2017 at 8:27 AM, Aman Deep Singh <amandeep.cool99@gmail.com>
wrote:

> Hi,
> 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
> feature).
> 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"
> enableGraphQueries="false">
>     <analyzer type="index">
>       <tokenizer class="solr.KeywordTokenizerFactory"/>
>       <filter class="solr.PatternReplaceFilterFactory" pattern=" "
> replace="all" replacement=""/>
>       <filter class="solr.LowerCaseFilterFactory"/>
>     </analyzer>
>     <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"/>
>     </analyzer>
>
>
> 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
> descSearchNoSyn^2
> </str>
> <str name="ps">5</str>
> <str name="pf">
> nameSearch^9 brandSearch^8 descriptionSearch^2 categoryKeywords^10
> keywords^10
> </str>
> <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>
> </lst>
> <arr name="last-components">
> <str>spellcheck</str>
> </arr>
> </lst>
>
>
> Thanks,
>
> Aman Deep Singh
>

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