solrj - How can I sort solr result bases on dynamic fields -
thanks giving time.
i need sort result on basis of dynamic field. how can ? when sorting on minimum value of of dynamic attribute. it's not giving correct result because query &sort=min(a_160018,a_chandigarh1) of document having both field a_160018 , a_chandigarh1 while document having no field , having 1 either a_160018 or a_chandigarh1 result doc .
could me , how can sort type of dynamic field.
if not know if field exist, can set default value in case not exists.
try use def function, returns default vlaue if field not exist.
//in part of query, have put default value high in order put result on bottom of list &sort=min(def(a_160018,9000000),def(a_chandigarh1,9000000))
extract of solr def doc
def(field|function,defaultvalue) returns value of field "field", or if field not exist, returns defaultvalue specified.
example use: def(rating,5) def() function here return rating, or if no rating specified in doc, returns 5
Comments
Post a Comment