diff --git a/src/main/config/run.properties.example b/src/main/config/run.properties.example index cb0060a..f94ed5c 100644 --- a/src/main/config/run.properties.example +++ b/src/main/config/run.properties.example @@ -2,7 +2,8 @@ # are marked with '!' directory = ${HOME}/data/search -commitSeconds = 5 +# A value of 0 will disable automatic commits and rely on icat.server to explicitly call commit after creating new documents +commitSeconds = 0 # Lucene limits the max number of documents in an index to Integer.MAX_VALUE - 128 maxShardSize = 2147483519 ip = 127.0.0.1/32 diff --git a/src/main/java/org/icatproject/lucene/Lucene.java b/src/main/java/org/icatproject/lucene/Lucene.java index 12a9f93..1068fa0 100755 --- a/src/main/java/org/icatproject/lucene/Lucene.java +++ b/src/main/java/org/icatproject/lucene/Lucene.java @@ -1041,7 +1041,7 @@ private void init() { throw new Exception(luceneDirectory + " is not a directory"); } - commitSeconds = props.getPositiveInt("commitSeconds"); + commitSeconds = props.getNonNegativeInt("commitSeconds"); luceneCommitMillis = commitSeconds * 1000; luceneMaxShardSize = Math.min(props.getPositiveLong("maxShardSize"), Long.valueOf(Integer.MAX_VALUE - 128)); maxSearchTimeSeconds = props.has("maxSearchTimeSeconds") ? props.getPositiveLong("maxSearchTimeSeconds") @@ -1072,8 +1072,10 @@ private void init() { * Starts a timer and schedules regular commits of the IndexWriter. */ private void initTimer() { - timer = new Timer("LuceneCommitTimer"); - timer.schedule(new CommitTimerTask(), luceneCommitMillis, luceneCommitMillis); + if (luceneCommitMillis > 0) { + timer = new Timer("LuceneCommitTimer"); + timer.schedule(new CommitTimerTask(), luceneCommitMillis, luceneCommitMillis); + } } class CommitTimerTask extends TimerTask { diff --git a/src/main/resources/run.properties b/src/main/resources/run.properties index f1266ab..a907b42 100644 --- a/src/main/resources/run.properties +++ b/src/main/resources/run.properties @@ -2,7 +2,8 @@ # are marked with '!' directory = ${HOME}/data/search -commitSeconds = 5 +# A value of 0 will disable automatic commits and rely on icat.server to explicitly call commit after creating new documents +commitSeconds = 0 maxShardSize = 2147483519 ip = 127.0.0.1/32 # A search taking longer than this will be cancelled to avoid blocking other users' searches diff --git a/src/site/xhtml/installation.xhtml.vm b/src/site/xhtml/installation.xhtml.vm index 8d997f0..171b7cb 100644 --- a/src/site/xhtml/installation.xhtml.vm +++ b/src/site/xhtml/installation.xhtml.vm @@ -54,7 +54,9 @@
commitSeconds
the interval in seconds between committing lucene changes to - disk and updating the index.
+ disk and updating the index. Automatic commits can be disabled by setting to + 0, in which case icat.server will need to explicitly commit after creating a + batch of documents.
maxShardSize
The maximum number of documents to store in a single index before "sharding"