Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-1306 Add option to not commit and clarify existing solr.commit.size

Ferdy Galema9400ebe98f11
diff --git a/CHANGES.txt b/CHANGES.txt
index b9467cf23..8603ddcf9 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,7 @@
Nutch Change Log
(trunk) Current Development:
+* NUTCH-1306 Add option to not commit and clarify existing solr.commit.size (ferdy)
* NUTCH-1405 Allow to overwrite CrawlDatum's with injected entries (markus)
diff --git a/conf/nutch-default.xml b/conf/nutch-default.xml
index ff0e1b088..b4a2bef9d 100644
--- a/conf/nutch-default.xml
+++ b/conf/nutch-default.xml
@@ -1398,9 +1398,17 @@
<description>
Defines the number of documents to send to Solr in a single update batch.
Decrease when handling very large documents to prevent Nutch from running
- out of memory.
- </description>
-</property>
+ out of memory. NOTE: It does not explicitly trigger a server side commit.
+ </description>
+</property>
+
+<property>
+ <name>solr.commit.index</name>
+ <value>true</value>
+ <description>
+ When closing the indexer, trigger a commit to the Solr server.
+ </description>
+</property>
<property>
<name>solr.auth</name>
diff --git a/src/java/org/apache/nutch/indexer/solr/SolrConstants.java b/src/java/org/apache/nutch/indexer/solr/SolrConstants.java
index 1b3629976..58a6328b1 100644
--- a/src/java/org/apache/nutch/indexer/solr/SolrConstants.java
+++ b/src/java/org/apache/nutch/indexer/solr/SolrConstants.java
@@ -23,6 +23,8 @@ public interface SolrConstants {
public static final String COMMIT_SIZE = SOLR_PREFIX + "commit.size";
+ public static final String COMMIT_INDEX = SOLR_PREFIX + "commit.index";
+
public static final String MAPPING_FILE = SOLR_PREFIX + "mapping.file";
public static final String USE_AUTH = SOLR_PREFIX + "auth";
diff --git a/src/java/org/apache/nutch/indexer/solr/SolrIndexer.java b/src/java/org/apache/nutch/indexer/solr/SolrIndexer.java
index 1c3fddaf1..f892a52d9 100644
--- a/src/java/org/apache/nutch/indexer/solr/SolrIndexer.java
+++ b/src/java/org/apache/nutch/indexer/solr/SolrIndexer.java
@@ -57,7 +57,8 @@ public class SolrIndexer extends Configured implements Tool {
public void indexSolr(String solrUrl, Path crawlDb, Path linkDb,
List<Path> segments) throws IOException {
- indexSolr(solrUrl, crawlDb, linkDb, segments, false, false, null);
+ boolean noCommit = !getConf().getBoolean(SolrConstants.COMMIT_INDEX, true);
+ indexSolr(solrUrl, crawlDb, linkDb, segments, noCommit, false, null);
}
public void indexSolr(String solrUrl, Path crawlDb, Path linkDb,