solr - 记录没有被删除使用cloudsolrclient 中的功能
问题描述
我看到太阳能功能的奇怪行为。SolrConfig.xml 配置在我的本地和舞台实例中是相同的。
<autoCommit>
<maxTime>${solr.autoCommit.maxTime:5000}</maxTime>
<openSearcher>false</openSearcher>
</autoCommit>
<autoSoftCommit>
<maxTime>${solr.autoSoftCommit.maxTime:-1}</maxTime>
</autoSoftCommit>
在我的本地设置中,我使用以下代码
String urlString = "http://localhost:8983/solr/usersession";
SolrClient Solr = new HttpSolrClient.Builder(urlString).build();
List<SolrInputDocument> doclist = new ArrayList<>();
for(int i=0;i<100;i++){
SolrInputDocument doc = new SolrInputDocument();
doc.addField("id", "test"+i);
doc.addField("cecid", "test"+i);
doc.addField("name","34"+i);
doc.addField("time_to_live_s", "+30000SECONDS");
doclist.add(doc);
}
Solr.add(doclist);
自动提交行为按预期工作。5 秒后,我在 5 秒后看到 solr 管理 UI 中的记录。
但是在阶段我们使用 CloudSolrclient 和 zookeeper 设置,但 5 秒后在 solr 管理 UI 中看不到记录。我不确定为什么自动提交功能在阶段服务器中不起作用。谁能让我知道在相同配置设置下这种不一致行为的原因是什么。
解决方案
我最好的猜测是${solr.autoSoftCommit.maxTime}
变量没有设置,-1 表示没有 autoSoftCommit。
尝试直接在中设置字段solrconfig.xml
并再次构建索引。
<!-- Example Config -->
<autoSoftCommit>
<maxTime>1000</maxTime>
</autoSoftCommit>
由于 Solr 在启动时编写文档,您只需重新启动 Solr 服务器即可快速检查${solr.autoSoftCommit.maxTime}
问题是否存在。重新启动后,您的文档应该可供搜索。
推荐阅读
- typescript - NavCtrl 和 Click 的离子问题
- java - 我可以将 Java 中的日期作为 TYPED INTO excel 单元格获取吗?
- asp.net-core - Chrome 将带有 304 状态代码响应的请求报告为已取消
- ios - 将 UIImage 保存到 PhotoLibrary Swift 4.2 iOS 12
- javascript - 如何将脚本 url 的结果存储在 Javascript 变量中
- php - 试图分割一个字符串
- pytorch - 在 PyTorch 中,是什么让张量具有非连续内存?
- api - 索尼 DSC-RX10M3 和方法“getCameraFunction”和“setCameraFunction”
- ascii - 十进制数字的字符代码表示
- java - 2.1.1.RELEASE 中 SpringBoot 中的 @Value