Return-Path: Delivered-To: apmail-incubator-connectors-commits-archive@minotaur.apache.org Received: (qmail 12455 invoked from network); 19 May 2010 09:09:10 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 19 May 2010 09:09:10 -0000 Received: (qmail 17219 invoked by uid 500); 19 May 2010 09:09:10 -0000 Delivered-To: apmail-incubator-connectors-commits-archive@incubator.apache.org Received: (qmail 17186 invoked by uid 500); 19 May 2010 09:09:09 -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 17179 invoked by uid 99); 19 May 2010 09:09:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 May 2010 09:09:09 +0000 X-ASF-Spam-Status: No, hits=-1999.9 required=10.0 tests=ALL_TRUSTED,AWL 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; Wed, 19 May 2010 09:09:08 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E0EFD23889ED; Wed, 19 May 2010 09:08:45 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r946090 - in /incubator/lcf/trunk/modules/connectors/solr: connector/org/apache/lcf/agents/output/solr/HttpPoster.java connector/org/apache/lcf/agents/output/solr/SolrConnector.java crawler-ui/output/solr/editconfig.jsp Date: Wed, 19 May 2010 09:08:45 -0000 To: connectors-commits@incubator.apache.org From: kwright@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100519090845.E0EFD23889ED@eris.apache.org> Author: kwright Date: Wed May 19 09:08:45 2010 New Revision: 946090 URL: http://svn.apache.org/viewvc?rev=946090&view=rev Log: Fix for ticket CONNECTORS-36. Revamp the Solr connector argument handling to be completely general. Modified: incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/HttpPoster.java incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/SolrConnector.java incubator/lcf/trunk/modules/connectors/solr/crawler-ui/output/solr/editconfig.jsp 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=946090&r1=946089&r2=946090&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 Wed May 19 09:08:45 2010 @@ -164,7 +164,7 @@ public class HttpPoster * Post the input stream to ingest * @param documentURI is the document's uri. * @param document is the document structure to ingest. - * @param arguments are the configuration arguments to pass in the post. + * @param arguments are the configuration arguments to pass in the post. Key is argument name, value is a list of the argument values. * @param authorityNameString is the name of the governing authority for this document's acls, or null if none. * @param activities is the activities object, so we can report what's happening. * @return true if the ingestion was successful, or false if the ingestion is illegal. @@ -893,9 +893,6 @@ public class HttpPoster try { - // Build the URL in question. - // MHL - // Do the operation! long fullStartTime = System.currentTimeMillis(); @@ -944,8 +941,13 @@ public class HttpPoster while (iter.hasNext()) { String name = (String)iter.next(); - String value = (String)arguments.get(name); - totalLength += lengthField(name,value); + List values = (List)arguments.get(name); + int j = 0; + while (j < values.size()) + { + String value = (String)values.get(j++); + totalLength += lengthField(name,value); + } } // Count the metadata. iter = document.getFields(); @@ -994,8 +996,13 @@ public class HttpPoster while (iter.hasNext()) { String name = (String)iter.next(); - String value = (String)arguments.get(name); - writeField(out,name,value); + List values = (List)arguments.get(name); + int j = 0; + while (j < values.size()) + { + String value = (String)values.get(j++); + writeField(out,name,value); + } } // Write the metadata, each in a field by itself Modified: incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/SolrConnector.java URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/SolrConnector.java?rev=946090&r1=946089&r2=946090&view=diff ============================================================================== --- incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/SolrConnector.java (original) +++ incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/SolrConnector.java Wed May 19 09:08:45 2010 @@ -174,7 +174,16 @@ public class SolrConnector extends org.a { ConfigNode node = params.getChild(i++); if (node.getType().equals(SolrConfig.NODE_ARGUMENT)) - args.put(node.getAttributeValue(SolrConfig.ATTRIBUTE_NAME),node.getAttributeValue(SolrConfig.ATTRIBUTE_VALUE)); + { + String attrName = node.getAttributeValue(SolrConfig.ATTRIBUTE_NAME); + ArrayList list = (ArrayList)args.get(attrName); + if (list == null) + { + list = new ArrayList(); + args.put(attrName,list); + } + list.add(node.getAttributeValue(SolrConfig.ATTRIBUTE_VALUE)); + } } String[] sortArray = new String[args.size()]; @@ -194,12 +203,17 @@ public class SolrConnector extends org.a while (i < sortArray.length) { String name = sortArray[i++]; - String value = (String)args.get(name); - fixedList[0] = name; - fixedList[1] = value; - StringBuffer pairBuffer = new StringBuffer(); - packFixedList(pairBuffer,fixedList,'='); - nameValues.add(pairBuffer.toString()); + ArrayList values = (ArrayList)args.get(name); + int j = 0; + while (j < values.size()) + { + String value = (String)values.get(j++); + fixedList[0] = name; + fixedList[1] = value; + StringBuffer pairBuffer = new StringBuffer(); + packFixedList(pairBuffer,fixedList,'='); + nameValues.add(pairBuffer.toString()); + } } StringBuffer sb = new StringBuffer(); @@ -233,7 +247,16 @@ public class SolrConnector extends org.a { ConfigNode node = params.getChild(i++); if (node.getType().equals(SolrConfig.NODE_ARGUMENT)) - args.put(node.getAttributeValue(SolrConfig.ATTRIBUTE_NAME),node.getAttributeValue(SolrConfig.ATTRIBUTE_VALUE)); + { + String attrName = node.getAttributeValue(SolrConfig.ATTRIBUTE_NAME); + ArrayList list = (ArrayList)args.get(attrName); + if (list == null) + { + list = new ArrayList(); + args.put(attrName,list); + } + list.add(node.getAttributeValue(SolrConfig.ATTRIBUTE_VALUE)); + } } // Establish a session Modified: incubator/lcf/trunk/modules/connectors/solr/crawler-ui/output/solr/editconfig.jsp URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/solr/crawler-ui/output/solr/editconfig.jsp?rev=946090&r1=946089&r2=946090&view=diff ============================================================================== --- incubator/lcf/trunk/modules/connectors/solr/crawler-ui/output/solr/editconfig.jsp (original) +++ incubator/lcf/trunk/modules/connectors/solr/crawler-ui/output/solr/editconfig.jsp Wed May 19 09:08:45 2010 @@ -178,7 +178,13 @@ { String name = sn.getAttributeValue(org.apache.lcf.agents.output.solr.SolrConfig.ATTRIBUTE_NAME); String value = sn.getAttributeValue(org.apache.lcf.agents.output.solr.SolrConfig.ATTRIBUTE_VALUE); - argumentMap.put(name,value); + ArrayList values = (ArrayList)argumentMap.get(name); + if (values == null) + { + values = new ArrayList(); + argumentMap.put(name,values); + } + values.add(value); } } // "Arguments" tab @@ -207,29 +213,34 @@ <% i = 0; - while (i < sortArray.length) + int k = 0; + while (k < sortArray.length) { - String name = sortArray[i]; - String value = (String)argumentMap.get(name); - // It's prefix will be... - String prefix = "argument_" + Integer.toString(i); + String name = sortArray[k++]; + ArrayList values = (ArrayList)argumentMap.get(name); + int j = 0; + while (j < values.size()) + { + String value = (String)values.get(j++); + // Its prefix will be... + String prefix = "argument_" + Integer.toString(i); %> - <%=org.apache.lcf.ui.util.Encoder.bodyEscape(name)%> - <%=org.apache.lcf.ui.util.Encoder.bodyEscape(value)%> + <% - i++; + i++; + } } if (i == 0) { @@ -266,13 +277,19 @@ while (iter.hasNext()) { String name = (String)iter.next(); - String value = (String)argumentMap.get(name); - // It's prefix will be... - String prefix = "argument_" + Integer.toString(i++); + ArrayList values = (ArrayList)argumentMap.get(name); + int j = 0; + while (j < values.size()) + { + String value = (String)values.get(j++); + // It's prefix will be... + String prefix = "argument_" + Integer.toString(i++); %> <% + + } } %>