Return-Path: Delivered-To: apmail-lucene-solr-commits-archive@minotaur.apache.org Received: (qmail 25802 invoked from network); 22 Jun 2009 11:28:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 22 Jun 2009 11:28:12 -0000 Received: (qmail 61386 invoked by uid 500); 22 Jun 2009 11:28:22 -0000 Delivered-To: apmail-lucene-solr-commits-archive@lucene.apache.org Received: (qmail 61312 invoked by uid 500); 22 Jun 2009 11:28:22 -0000 Mailing-List: contact solr-commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-dev@lucene.apache.org Delivered-To: mailing list solr-commits@lucene.apache.org Received: (qmail 61303 invoked by uid 99); 22 Jun 2009 11:28:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Jun 2009 11:28:22 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Jun 2009 11:28:14 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id CF3472388876; Mon, 22 Jun 2009 11:27:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r787205 - in /lucene/solr/trunk/contrib/dataimporthandler: CHANGES.txt src/main/java/org/apache/solr/handler/dataimport/DataImportHandler.java src/main/java/org/apache/solr/handler/dataimport/SolrWriter.java Date: Mon, 22 Jun 2009 11:27:53 -0000 To: solr-commits@lucene.apache.org From: noble@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090622112753.CF3472388876@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: noble Date: Mon Jun 22 11:27:53 2009 New Revision: 787205 URL: http://svn.apache.org/viewvc?rev=787205&view=rev Log: 36.SOLR-1234: Multiple DIH does not work because all of them write to dataimport.properties. Use the handler name as the properties file name Modified: lucene/solr/trunk/contrib/dataimporthandler/CHANGES.txt lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataImportHandler.java lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/SolrWriter.java Modified: lucene/solr/trunk/contrib/dataimporthandler/CHANGES.txt URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/CHANGES.txt?rev=787205&r1=787204&r2=787205&view=diff ============================================================================== --- lucene/solr/trunk/contrib/dataimporthandler/CHANGES.txt (original) +++ lucene/solr/trunk/contrib/dataimporthandler/CHANGES.txt Mon Jun 22 11:27:53 2009 @@ -1,4 +1,4 @@ - Apache Solr - DataImportHandler Version 1.3-dev + Apache Solr - DataImportHandler Version 1.4-dev Release Notes Introduction @@ -150,6 +150,8 @@ 35.SOLR-1235: disallow period (.) in entity names (noble) +36.SOLR-1234: Multiple DIH does not work because all of them write to dataimport.properties. Use the handler name as the properties file name (noble) + Optimizations ---------------------- 1. SOLR-846: Reduce memory consumption during delta import by removing keys when used Modified: lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataImportHandler.java URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataImportHandler.java?rev=787205&r1=787204&r2=787205&view=diff ============================================================================== --- lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataImportHandler.java (original) +++ lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataImportHandler.java Mon Jun 22 11:27:53 2009 @@ -34,6 +34,7 @@ import org.apache.solr.request.RawResponseWriter; import org.apache.solr.request.SolrQueryRequest; import org.apache.solr.request.SolrQueryResponse; +import org.apache.solr.request.SolrRequestHandler; import org.apache.solr.update.processor.UpdateRequestProcessor; import org.apache.solr.update.processor.UpdateRequestProcessorChain; import org.apache.solr.util.plugin.SolrCoreAware; @@ -74,6 +75,8 @@ private boolean debugEnabled = true; + private String myName = "dataimport"; + private Map coreScopeSession = new HashMap(); @Override @@ -85,6 +88,17 @@ @SuppressWarnings("unchecked") public void inform(SolrCore core) { try { + //hack to get the name of this handler + for (Map.Entry e : core.getRequestHandlers().entrySet()) { + SolrRequestHandler handler = e.getValue(); + //this will not work if startup=lazy is set + if( this == handler) { + String name= e.getKey(); + if(name.startsWith("/")){ + myName = name.substring(1); + } + } + } String debug = (String) initArgs.get(ENABLE_DEBUG); if (debug != null && "no".equals(debug)) debugEnabled = false; @@ -263,7 +277,7 @@ private SolrWriter getSolrWriter(final UpdateRequestProcessor processor, final SolrResourceLoader loader, final DataImporter.RequestParams requestParams) { - return new SolrWriter(processor, loader.getConfigDir()) { + return new SolrWriter(processor, loader.getConfigDir(), myName) { @Override public boolean upload(SolrInputDocument document) { Modified: lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/SolrWriter.java URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/SolrWriter.java?rev=787205&r1=787204&r2=787205&view=diff ============================================================================== --- lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/SolrWriter.java (original) +++ lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/SolrWriter.java Mon Jun 22 11:27:53 2009 @@ -49,12 +49,20 @@ private final String configDir; + private String persistFilename = IMPORTER_PROPERTIES; + DebugLogger debugLogger; public SolrWriter(UpdateRequestProcessor processor, String confDir) { this.processor = processor; configDir = confDir; - + } + public SolrWriter(UpdateRequestProcessor processor, String confDir, String filePrefix) { + this.processor = processor; + configDir = confDir; + if(filePrefix != null){ + persistFilename = filePrefix+".properties"; + } } public boolean upload(SolrInputDocument d) { @@ -126,11 +134,11 @@ try { propInput = new FileInputStream(configDir - + SolrWriter.IMPORTER_PROPERTIES); + + persistFilename); props.load(propInput); - log.info("Read " + SolrWriter.IMPORTER_PROPERTIES); + log.info("Read " + persistFilename); } catch (Exception e) { - log.warn("Unable to read: " + SolrWriter.IMPORTER_PROPERTIES); + log.warn("Unable to read: " + persistFilename); } finally { try { if (propInput != null) @@ -225,7 +233,7 @@ } catch (ParseException e) { throw new DataImportHandlerException(DataImportHandlerException.WARN, "Unable to read last indexed time from: " - + SolrWriter.IMPORTER_PROPERTIES, e); + + persistFilename, e); } return null; }