I need to be able to boost a relevancy query by the value of another field (boost as in multiply, not add in a function query to a boolean query as dismax currently does). And instead of a single field, it will actually be a function of many different fields (so most likely a function query).
Instead of just hacking up a custom request handler, it seems like this functionality would be of general use in Solr, so I've started thinking about it in more general terms. Issues: - Solr still uses it's own FunctionQuery instead of what was added back to Lucene. May want to migrate first, or may want to hold off if changes are needed that would be easier to make here. - I thought about being able to include queries as a ValueSource (so one could do functions on relevancy scores). One issue with this is that some queries need rewriting to work... so rewrite functionality would need to be added to ValueSource. - some field values may be sparse... so if you multiplied the relevancy query by field "myscore" which only existed on a few documents, you would not want to multiply the scores for other documents by 0. So either A) treat 0 as special in the multiply function... it means "not indexed" and so the multiplier would be 1 B) remember which values were filled in for a field and provide a way to get that info (a DocSet?) - weighting... if a FunctionQuery is at the top level, we need a way to get back un-weighted scores (actually, looking at the code again, it looks like as long as the boost is 1, we will get back exact scores from the FunctionQuery already). - Interface: seems like SOLR-334 (pluggable query parsers) could help out here to enable existing handlers to specify a boosted query without introducing yet more different (hard-coded) HTTP query params. Thoughts? -Yonik