: 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, ...)

let's back up a minute.

if your ultimate goal is to have the final score of all documents be a 
simple multiplication of an indexed field ("query_score") against the 
score of your "base" query, that's fairely trivial use of the 
BoostQParser...

        q={!boost f=query_score}your base query

...or to split it out using pram derefrencing...

        q={!boost f=query_score v=$qq}
        qq=your base query

: 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).

you could do this by replacing "score" with the query whose score you 
want, which could be a ref back to "$q" -- but that's really only needed 
if you want the "scores" returned for each document to be differnt then the 
value used for sorting (ie: score comes from solr, sort value includes you 
query_score and the score from the main query -- or some completley diff 
query)

based on what you've said, you don't need that and it would be 
unneccessary overhead.

: 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.

based on the examples you've given in your subsequent queries, it's not 
hard to see why...

> "q":"_val_:\"product(query_score,max(query($q8),max(query($q7),....

wrapping queries in functions in queries can have that effect, because 
functions ultimatley match all documents -- even when that function wraps 
a query -- so your outermost query is still scoring every document in the 
index.

you want to do as much "pruning" with the query as possible, and only 
multiply by your boost function on matching docs, hence the 
purpose of the BoostQParser.

-Hoss

Reply via email to