You can use FunctionQuery that allows one to use the actual value of a field
and functions of those fields in a relevancy score.

Two function will help you, which are :

*exists*

exists(field|function) returns true if a value exists for a given document.

Example use: exists(myField) will return true if myField has a value, while
exists(query({!v='year:2012'})) will return true for docs with year=2012.

*if*

if(expression,trueValue,falseValue) emits trueValue if the expression is
true, else falseValue. An expression can be any function which outputs
boolean values, or even functions returning numeric values, in which case
value 0 will be interpreted as false, or strings, in which case empty string
is interpreted as false.

Example use: if(exists(myField),100,0) returns 100 if myField exists

*Solution: *

Use in a parameter that is explicitly for specifying functions, such as the
EDisMax query parser's boost param, or DisMax query parser's bf (boost
function) parameter. (Note that the bf parameter actually takes a list of
function queries separated by white space and each with an optional boost.
Make sure you eliminate any internal white space in single function queries
when using bf). For example:

<http://lucene.472066.n3.nabble.com/file/n4166709/Screen_Shot_2014-10-30_at_9.png>
 




--
View this message in context: 
http://lucene.472066.n3.nabble.com/Boosting-on-field-not-empty-tp4166692p4166709.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to