: > I'm trying to boost results slightly on a price (not currency) field that : > are closer to a certain value. I want results that are not too expensive : > or too inexpensive to be favored. Here is what we currently are trying: : > : > bf=sub(1,abs(sub(15,price)))^0.2
Hmm... using sub() for your outher most function doesn't make sense to me ... i think (based on the description of your goal) that you really want to be using div() there. I would also suggest that in general, using "bf" (which gives an additive boost) probably isn't a good idea in 90% of the cases where you want to boost something ... a multiplicitive boost using the "boost" param of edismax, or wrapping your whole query in a {!boost} parser, is going to make a lot more sense. : What I would say though, is that if you have a lot of documents in your : index, consider pre-computing that field at index time, and boost on the : pre-computed value, as that will give you better performance. This, in general, is great advice: anything you can pre-compute at index time will save you processing/time at request time. But the caveat i would like to point out is that with the query time function approach, the "constant" (in this case 15) can actually be varried on a per user basis -- ie: you can boost things differnetly for differnet people based on what you know about them, either by explicitly asking them, or by analytics of their past behavior. I tried to cover all of these ideas here... https://people.apache.org/~hossman/ac2012eu/ http://vimeopro.com/user11514798/apache-lucene-eurocon-2012/video/55822630 -Hoss