Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/config/run.properties.example
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/org/icatproject/lucene/Lucene.java
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/run.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/site/xhtml/installation.xhtml.vm
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@

<dt>commitSeconds</dt>
<dd>the interval in seconds between committing lucene changes to
disk and updating the index.</dd>
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.</dd>

<dt>maxShardSize</dt>
<dd>The maximum number of documents to store in a single index before "sharding"
Expand Down