Optimizing Solr for Sorting

后端 未结 3 563
一生所求
一生所求 2021-02-04 18:36

I\'m using Solr for a realtime search index. My dataset is about 60M large documents. Instead of sorting by relevance, I need to sort by time. Currently I\'m using the sort flag

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-04 19:21

    I found the answer.

    If you want to sort by time, and not relevance, use fq= instead of q= for all of your filters. This way, Solr doesn't waste time figuring out the weighted value of the documents matching q=. It turns out that Solr was spending too much time weighting, not sorting.

    Additionally, you can speed sorting up by pre-warming your sort fields in the newSearcher and firstSearcher event listeners in solrconfig.xml. This will ensure that sorts are done via cache.

提交回复
热议问题