You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Chris Hostetter <ho...@fucit.org> on 2009/07/07 20:49:42 UTC
Re: how to shuffle the result while follow some priority rules at
the same time
: I want to implement that effect that the results had better differ from each
: other in one page, but I want to show some results first like those contains
: more attributes.
there is a RandomSortField that you can use as a "tie breaker" when all
other fields are equal. info baout using that can be found in the example
schema.xml
you could also test drive the FieldCollapsing patch (in Jira, not yet
committed) which would let you "collapse" the results based on a common
field name (ie: if the song title name was identical)
: pages. My current solr query is:
:
: ?q=ne+yo&qf=artist&defType=dismax&sort=lyric%20desc,links%20desc&start=0&rows=20&indent=on
: So the results will shows some same song names together cause their
: scores are totally the same.
: How to modify to support random, hash effect?
you aren't using "score" in your sort at all -- so score isn't influencing
your result order at all.
assuming "lyric" is a boolean indicating you have lyrics, you might wnat
something like "sort=lyric+desc,+score+desc,+links+desc" ... so it will
make sure things with lyrics appear first, but all songs with lyrics will
be in score order; if and only if two docs have identicle scores (and both
have lyrics) will it then do a secondary sort on "links"
: BTW: I find the sorting with multi conditions does not work well. I
: want to sort the second attribute
: (links desc)based on the first condition. ( lyric desc) . The results
: with lyric shows really in
: the front, but the links attribute seems not in order.
you haven't explained what "links" is so it's hard to guess what might be
happening here. if you give contrete examples (ie: show us your schema,
show us a real query, show us real results) then people might be able to
help you.
-Hoss