boosting certain docs based on a filed value

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

boosting certain docs based on a filed value

abhayd
hi

I was looking to boost certain docs based on some values in a indexed field.

e.g.
pType
---------
post paid
go phone

Would like to have post paid docs first and then go phone.
I checked the functional query but could not figure out.

Any help?
Reply | Threaded
Open this post in threaded view
|

Re: boosting certain docs based on a filed value

iorixxx
> I was looking to boost certain docs based on some values in
> a indexed field.
>
> e.g.
> pType
> ---------
> post paid
> go phone
>
> Would like to have post paid docs first and then go phone.
> I checked the functional query but could not figure out.

You can use http://wiki.apache.org/solr/DisMaxQParserPlugin#bq_.28Boost_Query.29 if you are using dismax.

bq=pType:"post paid"^100

If you are using default query parser then you can append this optional clause to your query q = some other query pType:"post paid"^100


     
Reply | Threaded
Open this post in threaded view
|

Re: boosting certain docs based on a filed value

abhayd
thanks!! that worked..

but for some reason i lost relevancy.

so what i want is relevant docs first and if same relevancy then trigger boosting
Reply | Threaded
Open this post in threaded view
|

Re: boosting certain docs based on a filed value

iorixxx
>
> thanks!! that worked..
>
> Can i enter the sequence too like "postpaid,free,costly"?
>

Does that mean you want to display first postpaid, after that free, and lastly costly?

If thats you want, i think it is better to create a tint field using these types and then sort by this field.

pstpaid=300
free=200
costy=100   sort=newTintField desc, score desc

http://wiki.apache.org/solr/CommonQueryParameters#sort


     
Reply | Threaded
Open this post in threaded view
|

Re: boosting certain docs based on a filed value

abhayd
great..

one last question
I am using dismax.

when i add this to bf in solrconfig.xml it give me errors when executing

<requestHandler name="dismax" class="solr.SearchHandler" >
    <lst name="defaults">
     <str name="defType">dismax</str>
     <str name="echoParams">explicit</str>

     <str name="qf">
        text^2.5 features^10 displayName^5.0 mfg^3.0 description^3.0
     </str>
     <str name="pf">
        text^0.2 features^1.1 displayName^5.0 mfg^3.0 mfg_exact^1.9
     </str>
     <str name="bf">
        recip(rord(mfg),1,1000,1000)^0.3 paymentType:postpaid^8.5
     </str>
..
  </requestHandler> 
Reply | Threaded
Open this post in threaded view
|

Re: boosting certain docs based on a filed value

iorixxx
>
> great..
>
> one last question
> I am using dismax.
>
> when i add this to bf in solrconfig.xml it give me errors
> when executing
>
> <requestHandler name="dismax" class="solr.SearchHandler"
> >
>     <lst name="defaults">
>      <str
> name="defType">dismax</str>
>      <str
> name="echoParams">explicit</str>
> <!--     <float
> name="tie">0.1</float> -->
>      <str name="qf">
>         text^2.5 features^10
> displayName^5.0 mfg^3.0 description^3.0
>      </str>
>      <str name="pf">
>         text^0.2 features^1.1
> displayName^5.0 mfg^3.0 mfg_exact^1.9
>      </str>
>      <str name="bf">
>        
> recip(rord(mfg),1,1000,1000)^0.3 paymentType:postpaid^8.5
>      </str>
> ..
>   </requestHandler>


You need to  use bq parameter.

http://wiki.apache.org/solr/DisMaxQParserPlugin#bq_.28Boost_Query.29

 <str name="bq">paymentType:postpaid^8.5</str>