I am trying to use solr 'def' function with bf , but it is not working as given in documentation
The documentation says : def is short for default. Returns the value of field "field", or if the field does not exist, returns the default value specified. Yields the first value where exists()==true.
Syntax Examples
def(rating,5): This def() function returns the rating, or if no rating specified in the doc, returns 5 def(myfield, 1.0): equivalent to if(exists(myfield),myfield,1.0)
http://localhost:8983/solr/mycollection/select?q=name:milk&bf=if(exists(myfield),myfield,1.0)
or
http://localhost:8983/solr/mycollection/select?q=name:milk&bf=def(myfield,1.0)
Exected result is 1 if myfield does not exists