Lucene exact ordering

后端 未结 3 1256
长情又很酷
长情又很酷 2021-01-19 05:21

I\'ve had this long term issue in not quite understanding how to implement a decent Lucene sort or ranking. Say I have a list of cities and their populations. If someone se

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-19 06:15

    API for

    Sortcomparator

    says

    There is a distinct Comparable for each unique term in the field - if some documents have the same term in the field, the cache array will have entries which reference the same Comparable

    You can apply a

    FieldSortedHitQueue

    to the sortcomparator which has a Comparator field for which the api says ...

    Stores a comparator corresponding to each field being sorted by.

    Thus the term can be sorted accordingly

提交回复
热议问题