Functions, known internally as
ValueSources, are typically mathematical in nature; they take constants and references to single-valued fields and other functions as input to compute an output number. Functions complement typical queries by enabling you to boost by a function, to sort by a function, to return a value from a function in search results, to filter by a range of values from a function, and they can be used in clever ways wherever Solr accepts a query, such as facet.query
. They are very versatile, though they are usually only used for custom relevancy boosting.
Note
A function is often referred to as a function query although that is a little confusing, as it makes no distinction with actual function queries that func
and frange
produce.
There are quite a few ways in which you can incorporate a function into your searches in Solr: