Solr:索引版本更改后的随机排序顺序 [英] Solr: Random sort order after index version change

查看:39
本文介绍了Solr:索引版本更改后的随机排序顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用solr.RandomSortField"根据传递的随机种子对搜索结果进行随机排序.它工作正常,并为相同的随机种子密钥提供相同的顺序.

I am using "solr.RandomSortField" to sort search result randomly base on passed random seed. it is working fine and giving same order for same random seed key.

问题是:

通过在运行时使用 API 创建/删除文档来更改索引版本时.然后,新版本和旧版本之间的相同密钥的随机顺序也会发生变化.

When index version get changed by creating/deleting doc using API at run time. Then random order also get changed for same key between newer and older version.

通过在谷歌搜索,我开始知道RandomSortField"使用索引版本,所以当索引版本改变时,排序顺序也会改变.

By Searching in google, i came to know that "RandomSortField" use index version so when index version get changed sort order also get change.

有什么方法可以从随机排序中排除索引版本或将索引版本传递给我的查询以在旧版本而不是新的更新版本中搜索并在分页搜索结果时获得相同的顺序.

Is there any way to exclude index version from random sort or pass index version to my query to search in older version instead of new updated version and get same order while paging search result.

每当订单更改时,大多数情况下都会出现分页问题.在某个页面后得到重复的结果.

Mostly getting issue in pagination whenever order change. get duplicate result after some page.

推荐答案

您是否尝试过删除 (int)top.getVersion();?

使用 RandomSortField 是一个模块/插件,可以在这里找到:https://svn.apache.org/repos/asf/lucene/dev/tags/lucene_solr_5_4_1/solr/core/src/java/org/apache/solr/schema/RandomSortField.java

Using RandomSortField is a module/plugin found here: https://svn.apache.org/repos/asf/lucene/dev/tags/lucene_solr_5_4_1/solr/core/src/java/org/apache/solr/schema/RandomSortField.java

能够具有可以持久化以用于分页的随机结果很有用.但是,如果您有一个经常更新的索引,那么由于对索引版本的依赖性,您将失去随机排序顺序.为了解决这个问题,你可以删除我上面写的那一行,或者你甚至可以简单地:

It's useful to be able to have random results that can be persisted for pagination. But if you have an index that gets updated often, then you will lose your random sort order because of the dependency on the index version. To get around this, you can remove the line i wrote above, or you can even simply:

return fieldName.hashCode();

在 getseed 函数中.

in the getseed function.

您需要将其制作成您自己的自定义插件,例如 jarfile 或您想要的任何内容,并将其加载到相同的命名空间中.

you will need to make that into your own custom plugin, like a jarfile or whatever you want, and load that in the same namespace instead.

这篇关于Solr:索引版本更改后的随机排序顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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