On 4/10/2009 12:56 PM, Steven Bethard wrote: > I need to have a scoring model of the form: > > s1(d, q)^a1 * s2(d, q)^a2 * ... * sN(d, q)^aN > > where "d" is a document, "q" is a query, "sK" is a scoring function, and > "aK" is the exponential boost factor for that scoring function. As a > simple example, I might have: > > s1 = TF-IDF score matching "text" field (e.g. a TermQuery) > a1 = 1.0 > > s2 = TF-IDF score matching "author" field (e.g. a TermQuery) > a2 = 0.1 > > s3 = PageRank score (e.g. a FieldScoreQuery) > a3 = 0.5 > > It's important that the "aK" parameters are exponents in the scoring > function and not just multipliers because it allows me to do a > particular kind of optimized search for the best parameter values. > > How can I achieve this? My first thought was just that I should set the > boost factor for each query, but the boost factor is just a multiplier, > right? > > My second thought was to subclass CustomScoreQuery and override > customScore, but as far as I can tell, CustomScoreQuery can only combine > a Query with a ValueSourceQuery, while I need to combine a Query with > another Query (e.g. the example above with two TermQuery scores).
My third thought was to create a wrapper class that takes a Query and an exponential boost factor. The wrapper class would delegate to the Query for all methods except .weight(). For .weight(), it would return a Weight wrapper that delegated to the Weight for all methods except .getValue(). For .getValue(), it would return the original value, raised to the appropriate exponent. But will that really work, or am I going to mess up the normalization or something else? Steve --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org