Hello all: We'd like to score the matching documents using a combination of SOLR's IR score with another application-specific score that we store within the documents themselves (i.e. a float field containing the app-specific score). In particular, we'd like to calculate the final score doing some operations with both numbers (i.e product, sqrt, ...)
According to what we know, there are two ways to do this in SOLR: A) Sort by function [1]: We've tested an expression like "sort=product(score, query_score)" in the SOLR query, where score is the common SOLR IR score and query_score is our own precalculated score, but it seems that SOLR can only do this with stored/indexed fields (and obviously "score" is not stored/indexed). B) Function queries: We've used _val_ and function queries like max, sqrt and query, and we've obtained the desired results from a functional point of view. However, our index is quite large (400M documents) and the performance degrades heavily, given that function queries are AFAIK matching all the documents. I have two questions: 1) Apart from the two options I mentioned, is there any other (simple) way to achieve this that we're not aware of? 2) If we have to choose the function queries path, would it be very difficult to modify the actual implementation so that it doesn't match all the documents, that is, to pass a query so that it only operates over the documents matching the query?. Looking at the FunctionQuery.java source code, there's a comment that says "// instead of matching all docs, we could also embed a query. the score could either ignore the subscore, or boost it", which is giving us some hope that maybe it's possible and even desirable to go in this direction. If you can give us some directions about how to go about this, we may be able to do the actual implementation. BTW, we're using Lucene/SOLR trunk. Thanks a lot for your help. Carlos [1]: http://wiki.apache.org/solr/FunctionQuery#Sort_By_Function