Using function query...

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

Using function query...

hknetomica
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.
Reply | Threaded
Open this post in threaded view
|

Re: Using function query...

Chris Hostetter-3

:    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