且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Solr中对同一文档同时进行多个更新

更新时间:2022-02-11 22:59:46

Lucene锁定工厂文档中提到了不同的锁定机制。默认情况下,使用NativeFSLockFactory来为要建立索引的文档获取文件锁。可以在solrconfig.xml中更改使用其他锁定机制的设置

There are different Locking mechanisms as mentioned in Lucene locking factory docs. By default NativeFSLockFactory is used in which file lock is acquired for the document that is being indexed. The settings for using a different locking mechanism can be changed in solrconfig.xml

这是solconfig.xml中的摘录

Here is a snippet from solconfig.xml

<!-- LockFactory 

     This option specifies which Lucene LockFactory implementation
     to use.

     single = SingleInstanceLockFactory - suggested for a
              read-only index or when there is no possibility of
              another process trying to modify the index.
     native = NativeFSLockFactory - uses OS native file locking.
              Do not use when multiple solr webapps in the same
              JVM are attempting to share a single index.
     simple = SimpleFSLockFactory  - uses a plain file for locking

     Defaults: 'native' is default for Solr3.6 and later, otherwise
               'simple' is the default

     More details on the nuances of each LockFactory...
     http://wiki.apache.org/lucene-java/AvailableLockFactories
-->
<lockType>${solr.lock.type:native}</lockType>