You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Jingkang Zhang <zj...@yahoo.com.cn> on 2005/02/01 10:21:55 UTC

Can I sort search results by score and docID at one time?

Lucene support sort by score or docID.Now I want to
sort search results by score and docID or by two
fields at one time, like sql
command " order by score,docID" , how can I do it?

_________________________________________________________
Do You Yahoo!?
150万曲MP3疯狂搜,带您闯入音乐殿堂
http://music.yisou.com/
美女明星应有尽有,搜遍美图、艳图和酷图
http://image.yisou.com
1G就是1000兆,雅虎电邮自助扩容!
http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/event/mail_1g/

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Re: Can I sort search results by score and docID at one time?

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Feb 1, 2005, at 4:21 AM, Jingkang Zhang wrote:

> Lucene support sort by score or docID.Now I want to
> sort search results by score and docID or by two
> fields at one time, like sql
> command " order by score,docID" , how can I do it?

Sorting by multiple fields (including score and document id) is 
supported.  Here's an example:

	 new Sort(new SortField[]{
           new SortField("category"),
           SortField.FIELD_SCORE,
           new SortField("pubmonth", SortField.INT, true)
         })



---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org