产品数据更改后更新Solr索引 [英] Updating Solr Index when product data has changed

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

问题描述

我们正在努力在电子商务网站上实施Solr.通过更新现有产品信息或完全添加新产品,用新数据不断更新站点.

We are working on implementing Solr on e-commerce site. The site is continuously updated with a new data, either by updates made in existing product information or add new product altogether.

我们在带有solrnet的asp.net mvc3应用程序上使用它.

We are using it on asp.net mvc3 application with solrnet.

我们正面临索引编制的问题.我们目前正在使用以下内容进行提交:

We are facing issue with indexing. We are currently doing commit using following:

private static ISolrOperations<ProductSolr> solrWorker;
         public void ProductIndex()
         {
             //Check connection instance invoked or not
             if (solrWorker == null)
             {
                  Startup.Init<ProductSolr>("http://localhost:8983/solr/");
                  solrWorker = ServiceLocator.Current.GetInstance<ISolrOperations<ProductSolr>>();

             }
             var products = GetProductIdandName();
             solrWorker.Add(products);
             solrWorker.Commit();

         }

尽管这只是一个简单的测试应用程序,我们只是在solr索引中插入了产品名称和ID.每次运行时,新产品都会立即全部更新,并且在我们搜索时可用.我认为这会在每次运行时将新数据索引创建到solr中吗?如果我错了,请纠正我.

Although this is just a simple test application where we have inserted just product name and id into the solr index. Every time it runs, the new products gets updated all at once, and available when we search it. I think this create the new data index into solr everytime it runs? Correct me if I'm wrong.

我的问题是:

  1. 这是否会重新创建Solr索引数据?还是只更新已更改/新的数据?如何?即使仅更新已更改/新数据,它如何知道哪些数据已更改?对于大数据集,这肯定会有一些问题.
  2. 跟踪自上次提交以来已更改的内容的另一种方法是什么,有什么方法可以将那些产品添加到已更改的Solr索引中.
  3. 当我们将现有记录更新为solr时会发生什么?它会删除旧数据并插入新数据并重新创建整个索引吗?这是资源密集型吗?
  4. 大型电子商务零售商使用数百万种产品来做到这一点.

解决此问题的最佳策略是什么?

What is the best strategy to solve this problem?

推荐答案

  1. 进行更新时,只会删除并插入该记录. Solr不会更新记录.其他记录保持不变.提交数据时,将使用此新数据创建新的段.在优化时,数据被优化为单个段.

  1. When you do an update only that record is delete and inserted. Solr does not update the records. The other records are untouched. When you commit the data new segments would be created with this new data. On optimize the data is optimized into a single segment.

您可以使用增量构建技术在上次构建之后添加/更新记录. DIH可以立即提供,如果您要通过作业手动处理它,可以维护时间戳并运行构建.

You can use Incremental build technique to add/update records after the last build. DIH provides it out of the box, If you are handling it manually through jobs you can maintain the timestamp and run builds.

Solr没有更新操作.它将执行删除和添加.因此,您必须再次使用完整的数据,而不仅仅是更新的字段.它不占用资源.通常只有Commit和Optimize是.

Solr does not have an update operation. It will perform a delete and add. So you have to use the complete data again and not just the updated fields. Its not resource intensive. Usually only Commit and Optimize are.

Solr可以处理任意数量的数据.如果您的数据增长到超出一台计算机的处理能力,则可以使用分片.

Solr can handle any amount of data. You can use Sharding if your data grows beyond the handling capacity of a single machine.

这篇关于产品数据更改后更新Solr索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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