lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Høydahl / Cominvent <>
Subject Re: Is this sort order possible in a single query?
Date Sun, 28 Nov 2010 23:17:24 GMT
> I can't see a way to do it without functionqueries at the moment, which
> doesn't mean there isn't any.

If you want to use the suggested sort method, you could probably sort first by score:
sort=score desc, num_copies desc, num_comments desc
To let the score be influenced by exact author match only, you can set all other components
to 0 (disMax):
qf=author^0.0 title^0.0 author_exact

Personally I doubt that the requirements will give an excellent usability experience. If you
do NOT get an exact author match, you will get a "bestseller" list, not taking into account
your terms in the ranking at all.

Unless there are specific reasons for these requirements I'd recommend using rank boosts instead
of simple sorting.

Boost author_exact very high using DisMax combined with a version of the author field with
KeywordTokenizerFactory and LowerCaseFilterFactory, perhaps combined with PatternReplaceFilterFactory
to normalize punctuation etc.

 <fieldType name="author_exact" class="solr.TextField">
        <tokenizer class="solr.KeywordTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory" />
        <filter class="solr.PatternReplaceFilterFactory" pattern="([^a-z0-9])" replacement="
" replace="all" />

Then boost num_copies and num_comments using FunctionQueries in such a way that sold copies
count more than comments.

http://localhost:8093/solr/select?defType=dismax&author:(j.k. rowling)&qf=author^5.0
author_exact^1000.0 title^10.0 descr^0.2&fq=log(sum(num_copies,1))^1000.0 log(sum(num_comments,1))^100.0

Also a hint for this kind of fields is to disable field normalization (omitNorms="true")

Jan Høydahl, search solution architect
Cominvent AS -

View raw message