Solr 3.6 中的一些延迟后文件正在反映 [英] Documents are reflecting after some delay in Solr 3.6

查看:35
本文介绍了Solr 3.6 中的一些延迟后文件正在反映的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为 ASP.net 应用程序使用 Solr 3.6.我们正在使用 SolrNet 库.

Working with Solr 3.6 for ASP.net application. We're using SolrNet library.

我们有一个用 asp.net 编写的自定义程序,用于使用 SolrNet 将文档增量添加到 Solr.这会监视将文档插入 Solr 的进度.

We have a custom program written in asp.net to incrementally add a documents to Solr using SolrNet. This monitors the progress for inserting documents into Solr.

问题是,应用程序显示流程已完成,但检查 Solr 结果,我们只在结果中看到少数文档,而不是所有文档.尽管 15 分钟后再次检查,但现在 Solr 结果中列出的文档数量很少,大约是初始结果的两倍.请注意,我们没有执行任何将文档添加到 Solr 的过程.

The issue is, the application shows process as completed but checking into Solr results we only see few documents in results, and not all of the document. Although checking it again after 15 minutes, few more documents are now listed in Solr results, which are roughly a double of what was initial results. Note that we didn't executed any process to add documents into Solr.

用 Solr 自然吗?或者我们可以假设在插入所有文档后立即列出所有文档吗?坚定的?这种行为背后的原因是什么?以及如何处理?

Is it natural with Solr? Or can we assume to list all documents as soon as they are inserted & committed? What is the reason behind this kind of behavior? And how to handle it?

编辑 1在应用程序端一个小时后,我们能够查询 80-90% 的文档.但是 Solr Admin Query 仍然没有列出超过 25% 的文档.

Edit 1 After an hour on application side we're able to query 80-90% of documents. But still Solr Admin Query doesn't list more than 25% documents.

推荐答案

在您的自定义 ASP.NET 程序完成向 Solr 添加文档后,您是否向 Solr 发出提交?因为在您将新文档提交到索引之前,Solr 中的搜索者不会看到您的新文档.

Are you issuing a commit to Solr after your custom ASP.NET program has completed adding documents to Solr? Because your new documents will not be visible to the searchers within Solr until you have committed them to the index.

 var solr = ServiceLocator.Current.GetInstance<ISolrOperations<IndexEntry>>();
 solr.Add(entry);   
 solr.Commit();         

我猜您会在一段时间后看到文档出现,因为您的 Solr 实例在 solrconfig.xml 文件中配置了某种 <autoCommit> 设置.请参阅此处了解更多详情

I am guessing that you are seeing documents appear after some time because your Solr instance is configured with some sort of <autoCommit> setting in your solrconfig.xml file. See here for more details

要尝试的一件事是,您可以通过 SolrNet 传递一个软提交"参数来告诉索引多快提交您添加到索引中的新文档.这是一小段代码,显示了 CommitWithin AddParameter 的使用,它告诉 Solr 在 5 秒内提交文档.

One thing to try is that you can pass a "soft-commit" parameter via SolrNet to tell the index how soon to commit the new document that you have added to the index. Here is a small snippet of code that shows the use of the CommitWithin AddParameter which tells Solr to commit the document within 5 seconds.

var solr = ServiceLocator.Current.GetInstance<ISolrOperations<IndexEntry>>();
solr.Add(entry, new AddParameters { CommitWithin = 5000 });            

我建议使用 CommitWithin 参数而不是显式的 Commit(),因为提交是昂贵的操作,而 Solr 可以更好地管理这些操作.

I would recommend the use of the CommitWithin parameter versus the explicit Commit() as commits are expensive operations and Solr can better manage those itself.

这篇关于Solr 3.6 中的一些延迟后文件正在反映的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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