You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2010/09/23 17:16:24 UTC
[Solr Wiki] Update of "FunctionQuery" by YonikSeeley
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.
The "FunctionQuery" page has been changed by YonikSeeley.
The comment on this change is: doc param substitution.
http://wiki.apache.org/solr/FunctionQuery?action=diff&rev1=67&rev2=68
--------------------------------------------------
1. A Constant (numeric or string literal) - See "constant" and "literal" below.
1. A Field - See "fieldvalue" below. Also see notes later on multivalued/vector fields.
1. Another Function
+ 1. <!> [[Solr4.0]] A parameter substitution: $arg, where arg is another function in the request.
+ * Example request: {{{q={!func}add($v1,$v2)&v1=sqrt(popularity)&v2=100.0}}}
= Using FunctionQuery =
There are a few ways to use FunctionQuery from Solr's HTTP interface:
1. Embed a FunctionQuery in a regular query expressed in SolrQuerySyntax via the _val_ hook
- 1. Use the FunctionQParserPlugin, ie: {{{q={!func}log(foo)}}}
+ 1. Invoke the FunctionQParserPlugin via LocalParams syntax, e.g. {{{q={!func}log(foo)}}}
+ 1. Set '''func''' as the default query type, e.g. {{{defType=func&q=log(foo)}}}
- 1. Use a parameter that has an explicit type of FunctionQuery, such as [[DisMaxQParserPlugin]]'s '''bf''' (boost function) parameter.
+ 1. Use a parameter that has an explicit type of FunctionQuery, such as [[DisMaxQParserPlugin]]'s '''bf''' (boost function) parameter, or extended dismax '''boost''' parameter (multiplicative boost).
* NOTE: the '''bf''' parameter actually takes a list of function queries separated by whitespace and each with an optional boost. Make sure to eliminate any internal whitespace in single function queries when using '''bf'''.
- * Example: {{{q=foo&bf="ord(popularity)^0.5 recip(rord(price),1,1000,1000)^0.3"}}}
+ * Example: {{{q=foo&bf="ord(popularity)^0.5 recip(rord(price),1,1000,1000)^0.3"}}}
See SolrPlugins#ValueSourceParser for information on how to hook in your own FunctionQuery.
- Note that a FunctionQuery matches all non-deleted documents.
+ Note that a FunctionQuery currently matches all non-deleted documents.
= Function Query Syntax =
There is currently no infix parser - functions must be expressed as function calls (e.g. sum(a,b) instead of a+b)