I am trying to come up with a performant query that will allow me to use a custom score where the custom score is a sum-product over a set of query time weights where each weight gets applied only if the query time term exists in the document . So for example if I have a doc with three fields: company=Microsoft, city=Redmond, and size=large, I may want to score that document according to the following function: city==Microsoft ? .3 : 0 * size ==large ? 0.5 : 0 to get a score of 0.8. Attached is a subclass I have tested that implements this with one extra component which is that it allow the relevance score to be combined in.
The problem is this custom score is not performant at all. For example, on a small index of 5 million documents with 10 weights passed in it does 0.01 req/sec. Are there ways to make to compute the same custom score but in a much more performant way? thanks, Scott