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

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

问题描述

我正在使用Solr作为实时搜索索引.我的数据集大约有6000万个大型文档.除了按相关性排序外,我还需要按时间排序.目前,我在查询中使用排序标志按时间排序.这对于特定的搜索效果很好,但是当搜索返回大量结果时,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天全站免登陆