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 hknetomica <hk...@hotmail.com> on 2006/12/21 03:44:55 UTC

Using function query...

Hi,
   I wanted to know what param should be used to provide a function query
boost. Given two records
that have the same relevance, I want to boost one record over the other
based on a numeric field
called profile_score. 

Thanks,
Harish.
-- 
View this message in context: http://www.nabble.com/Using-function-query...-tf2863431.html#a8001963
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Using function query...

Posted by Chris Hostetter <ho...@fucit.org>.
:    I wanted to know what param should be used to provide a function query
: boost. Given two records
: that have the same relevance, I want to boost one record over the other
: based on a numeric field
: called profile_score.

from the standard request handler you can add something like...
	_val_:profile_score
...to your query to add a function query using the raw value from your
field, you could also do a more complicated combintion of linear and
reciprical functions on that value...
	_val_:recip(linear(profile_score,1,2),3,4,5)

If you are using the dismax handler, there is a quecial query param "bf"
for specifying boost functions that does not require the "_val_:" syntax
to trick the QueryParser...

http://localhost:8983/solr/select?q=video&bf=linear(popularity,1,2)&qt=dismax

More info on this syntax for writing function queries as strings can be
found in the javadocs for the "parseFunction" method...

http://incubator.apache.org/solr/docs/api/org/apache/solr/search/QueryParsing.html#parseFunction(java.lang.String,%20org.apache.solr.schema.IndexSchema)



-Hoss