Permalink
Browse files

Commit document changes manually and raise Solr autoCommit time.

When testing the new solr4 branch, newly uploaded documents where not
appearing in search until after solr was restarted.

This was because commit was not being called on the index.  autoCommit
was enabled, but the openSearcher option wasn't.

This extends the run interval for autoCommit to 10 minutes, and
enables autoSoftCommit every 5 minutes.  It also calls commit manually
on the index after a document is inserted or updated.

Documents will appear in the search immediately after uploading and
the somewhat expensive commit will be called less often.
  • Loading branch information...
1 parent 299d923 commit e9e8ae8b51cc9e592215eff14cec5548db1dd4fd @nathanstitt nathanstitt committed Jan 7, 2013
Showing with 10 additions and 6 deletions.
  1. +1 −0 app/actions/document_import.rb
  2. +1 −0 app/models/document.rb
  3. +8 −6 solr/collection1/conf/solrconfig.xml
@@ -124,6 +124,7 @@ def process_text
document.save!
pages = document.reload.pages
Sunspot.index pages
+ Sunspot.commit
DC::Import::EntityExtractor.new.extract(document, text) unless options['secure'] or not DC::Language::SUPPORTED.include? document.language
document.upload_text_assets(pages, access)
document.id
View
@@ -598,6 +598,7 @@ def reindex_all!(access=nil)
EntityDate.reset(self)
pages = self.reload.pages
Sunspot.index pages
+ Sunspot.commit
reprocess_entities if calais_id
upload_text_assets(pages, access)
self.access = access if access
@@ -317,20 +317,22 @@
searcher to be opened to make those changes visible.
-->
<autoCommit>
- <maxTime>15000</maxTime>
- <openSearcher>false</openSearcher>
+ <!-- 10 minutes -->
+ <maxTime>600000</maxTime>
+ <openSearcher>false</openSearcher>
</autoCommit>
<!-- softAutoCommit is like autoCommit except it causes a
'soft' commit which only ensures that changes are visible
but does not ensure that data is synced to disk. This is
faster and more near-realtime friendly than a hard commit.
-->
- <!--
- <autoSoftCommit>
- <maxTime>1000</maxTime>
+
+ <autoSoftCommit>
+ <!-- 5 minutes -->
+ <maxTime>300000</maxTime>
</autoSoftCommit>
- -->
+
<!-- Update Related Event Listeners

0 comments on commit e9e8ae8

Please sign in to comment.