其实Lucene 的Search方法有结果排序的功能,加个参数,之前还自己写个排序。
search(Query query, int n, Sort sort)
Search implementation with arbitrary sorting and no filter.
查看Sort类
Field Summary | |
---|---|
static Sort | INDEXORDER Represents sorting by index order. |
static Sort | RELEVANCE Represents sorting by computed relevance. |
如果按照文件号排序: Sort.INDEXORDER
按照相似度排序: Sort.RELEVANCE