How to do partial phrase matching with boosting in Solr

315 Views Asked by At

We applied boosting and phrase boosting as below:

    https://localhost:8983/solr/app_index/select?bq=(Title:"userinput")^20+
    +(Desc:"userinput")^10&pf=(Title:"userinput")^20+(Desc:"userinput")^10
   &q=(bodycontent_t:(userinput))&defType=edismax&tie=0.01

Above query is working fine in below cases:

User Input: Solr Query

User Input: Query Analysis

However, if we type 3 or more terms as below, its not bringing the expected results as mentioned below:

Expected result is that exact match at first following by partial phrases

User input: Solr Query Analysis

Expected Results in below order:

Solr query analysis is the best practice

solr query is good for analysis

query analysis in solr is good

solr is key player in search world

query your requirements

analysis always gives better results

Got some useful links about Shingle filter which may suits this requirement.

http://archive.apache.org/dist/lucene/solr/ref-guide/apache-solr-ref-guide-5.3.pdf#page=112&zoom=auto,-187,475

Is Shingles suits the above requirement? If Yes, please guide how to apply boosting for the shingles or any better way to achieve exact phrase at first then by partial phrases with boosting?

Please guide here. Appreciate your help.

1

There are 1 best solutions below

3
Abhijit Bashetti On

You can try below field type for your field.

<fieldType name="string_test" class="solr.TextField" sortMissingLast="true" omitNorms="true"> 
    <analyzer type="index">         
        <tokenizer class="solr.StandardTokenizerFactory"/>
         <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.ShingleFilterFactory" minShingleSize="2" maxShingleSize="4"
         outputUnigrams="true" outputUnigramsIfNoShingles="true">
    </analyzer>  
    <analyzer type="query">
        <tokenizer class="solr.KeywordTokenizerFactory"/>
         <filter class="solr.LowerCaseFilterFactory"/>
    </analyzer>
</fieldType> 

Please see the analysis page for the text "Solr Analysis Page".

analysis page