: if(document.hasDateField == 1){ : boost = somefunction(document.dateField); : } else{ : boost = 1; : }
bq = ( ( +hasDateField:true _val_:somefunc(dateField) ) ( -hasDateField:true *:*^1 ) ) That covers the possiblility that hasDateField is not set for some docs. The query get's simpler if you can concretely know that hasDateField will always have a value of true or false... bq = ( hasDateField:false^1 ( +hasDateField:true _val_:somefunc(dateField) ) -Hoss