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 Harry Yu <50...@qq.com> on 2014/09/23 06:14:29 UTC

How to rank by name in the same score when using DisjunctionMaxQuery?

Hi everyone,


I searched an index with 3 its' fields({"name", "addr", "fullname"}), and used DisjunctionMaxQuery to rank the results by the max score of 3 fields.  When the hits have same score, lucene would rank by doc Id(low doc Id would be front). 


But I don't want rank by doc Id in that case. I would rank by field. If the hits have same score, I expect that the hit which's score (max score) is from field "name"  is front to the hit which's score is from other field.


I think the customer Collector & HitQueue is good idea and rewrite the method PriorityQueue.lessThan could change rank in priority queue. Unfortunately, the info in ScoreDoc is too less. And it's hard to get the source of max score for every hits.


Someone else know how to solve it? Thx!


Regards,


------------------
Harry YuInstitute of Remote Sensing and Geographic Information System.
School of Earth and Space Sciences, Peking University;
Beijing, China, 100871;
Email: 502437499@qq.com OR harryyu1018@163.com