You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by abhayd <aj...@hotmail.com> on 2010/12/03 17:58:12 UTC

boosting certain docs based on a filed value

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?
-- 
View this message in context: http://lucene.472066.n3.nabble.com/boosting-certain-docs-based-on-a-filed-value-tp2012962p2012962.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: boosting certain docs based on a filed value

Posted by Ahmet Arslan <io...@yahoo.com>.
> 
> 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>


      

Re: boosting certain docs based on a filed value

Posted by abhayd <aj...@hotmail.com>.
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> 
-- 
View this message in context: http://lucene.472066.n3.nabble.com/boosting-certain-docs-based-on-a-filed-value-tp2012962p2024324.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: boosting certain docs based on a filed value

Posted by Ahmet Arslan <io...@yahoo.com>.
> 
> 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


      

Re: boosting certain docs based on a filed value

Posted by abhayd <aj...@hotmail.com>.
thanks!! that worked..

Can i enter the sequence too like "postpaid,free,costly"?


-- 
View this message in context: http://lucene.472066.n3.nabble.com/boosting-certain-docs-based-on-a-filed-value-tp2012962p2013895.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: boosting certain docs based on a filed value

Posted by Ahmet Arslan <io...@yahoo.com>.
> 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