SOLR将新数据添加到现有索引中


SOLR add new data to existing index

我正在从数据库中创建一些数据索引。代码如下:

       // Load the documents into the index
        try {
            // $documents holds all the documents
            $solr->addDocuments($documents);     
            $solr->commit();
            $solr->optimize();
        } catch (Exception $e) {
            print $e->getMessage();
        } 

正在正确创建索引。现在,如果我想添加一些额外的数据到它,我是按照相同的过程来处理这些额外的数据,还是有其他的过程来更新solr index?

如果我遵循相同的过程,它会覆盖现有的索引还是只是更新它?

Lucene的索引过程包括插入和删除。Solr通过模式设计和实施,通过在一个方法调用中组合一个删除/插入序列,通过消息处理程序提供类似更新的功能。

当你的模式设计包含一个uniqueKey时,向Solr发布更新将自动更新索引中的记录