Hi Yang, Boosting works at query time as well as index time. If you are using the QueryParser, specify boosts like so: title:foo^2 abstract:foo^1.5 date:mydate^3
If you are building queries pragmatically, then use the Query.setBoost() method. That will boost relative to how a non-boosted query would score, but keep in mind that you still have tf/idf factors in the score. If you need to get rid of the tf/idf factors, either write your own ScoreDocComparator, or use a FunctionQuery. -Yonik http://incubator.apache.org/solr Solr, The Open Source Lucene Search Server On 3/8/06, Yang Sun <[EMAIL PROTECTED]> wrote: > Hi, > Just wondering how I can rank search result by a combination of fields. I > know there is a multi-field sort, but it is just a sorting method. It is > sorted by the first field and then the second field ... > What I need is a weighted combination. For example, I want to assign a > weight of 2 to title match, 1.5 to abstract match, and 3 to date match (i.e. > How close the last modified date). The final score will be > 2*inTitle+1.5*inAbstract+3*date instead of sorting by date and then sorting > by title within the same date. > I checked lucene Score, Similarity, and SortDocComparator and can't find an > answer. Implements the SortDocComparator seems the closest, but it can only > sort the result by one field. The Field boost does not work because the > boosting factor has to be set during index time. What I need is setting the > weight at query time. > Please help. Thanks. > > Yang --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]