优化 Solr 以进行排序 [英] Optimizing Solr for Sorting

查看:16
本文介绍了优化 Solr 以进行排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Solr 进行实时搜索索引.我的数据集大约有 60M 大文档.我需要按时间排序,而不是按相关性排序.目前我在查询中使用排序标志按时间排序.这适用于特定搜索,但是当搜索返回大量结果时,Solr 必须获取所有结果文档并在返回之前按时间排序.这很慢,必须有更好的方法.

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 in the query to sort by time. This works fine for specific searches, but when searches return large numbers of results, Solr has to take all of the resulting documents and sort them by time before returning. This is slow, and there has to be a better way.

有什么更好的方法?

推荐答案

我找到了答案.

如果您想按时间而非相关性排序,请对所有过滤器使用 fq= 而不是 q=.这样,Solr 就不会浪费时间找出匹配 q= 的文档的加权值.事实证明,Solr 花费了太多时间加权,而不是排序.

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.

此外,您可以通过预热 solrconfig.xml 中的 newSearcher 和 firstSearcher 事件侦听器中的排序字段来加快排序.这将确保通过缓存完成排序.

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.

这篇关于优化 Solr 以进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆