Return-Path: Delivered-To: apmail-incubator-connectors-commits-archive@minotaur.apache.org Received: (qmail 51974 invoked from network); 1 Jul 2010 10:23:47 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 1 Jul 2010 10:23:47 -0000 Received: (qmail 11215 invoked by uid 500); 1 Jul 2010 10:23:47 -0000 Delivered-To: apmail-incubator-connectors-commits-archive@incubator.apache.org Received: (qmail 10534 invoked by uid 500); 1 Jul 2010 10:23:45 -0000 Mailing-List: contact connectors-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: connectors-dev@incubator.apache.org Delivered-To: mailing list connectors-commits@incubator.apache.org Received: (qmail 10519 invoked by uid 99); 1 Jul 2010 10:23:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Jul 2010 10:23:44 +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; Thu, 01 Jul 2010 10:23:42 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id BADAB23888EA; Thu, 1 Jul 2010 10:22:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r959585 - /incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/HttpPoster.java Date: Thu, 01 Jul 2010 10:22:49 -0000 To: connectors-commits@incubator.apache.org From: kwright@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100701102249.BADAB23888EA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kwright Date: Thu Jul 1 10:22:49 2010 New Revision: 959585 URL: http://svn.apache.org/viewvc?rev=959585&view=rev Log: Put an insanity mapping in by default, so we don't get collisions with Solr's declared id field. This also restores backwards functional compatibility. Modified: incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/HttpPoster.java Modified: incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/HttpPoster.java URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/HttpPoster.java?rev=959585&r1=959584&r2=959585&view=diff ============================================================================== --- incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/HttpPoster.java (original) +++ incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/HttpPoster.java Thu Jul 1 10:22:49 2010 @@ -69,7 +69,8 @@ public class HttpPoster private static final String LITERAL = "literal."; private static final String NOTHING = "__NOTHING__"; - + private static final String ID_METADATA = "lcf_metadata_id"; + private int buffersize = 32768; // default buffer size double sizeCoefficient = 0.0005; // 20 ms additional timeout per 2000 bytes, pulled out of my butt /** the number of times we should poll for the response */ @@ -975,8 +976,11 @@ public class HttpPoster String newFieldName = (String)sourceTargets.get(fieldName); if (newFieldName == null) newFieldName = fieldName; - if (newFieldName.length() > 0) - { + // Make SURE we can't double up on the id field inadvertantly! + if (newFieldName.length() > 0) + { + if (newFieldName.toLowerCase().equals(idAttributeName.toLowerCase())) + newFieldName = ID_METADATA; Object[] values = document.getField(fieldName); // We only handle strings right now!!! int k = 0; @@ -1037,8 +1041,10 @@ public class HttpPoster String newFieldName = (String)sourceTargets.get(fieldName); if (newFieldName == null) newFieldName = fieldName; - if (newFieldName.length() > 0) - { + if (newFieldName.length() > 0) + { + if (newFieldName.toLowerCase().equals(idAttributeName.toLowerCase())) + newFieldName = ID_METADATA; Object[] values = document.getField(fieldName); // We only handle strings right now!!! int k = 0;