You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by to...@apache.org on 2016/11/28 08:26:46 UTC

[1/2] lucene-solr:master: SOLR-8871 - adjusted UIMA processor test, patch from Alessandro Benedetti

Repository: lucene-solr
Updated Branches:
  refs/heads/master 500c2befe -> c36ec0b75


SOLR-8871 - adjusted UIMA processor test, patch from Alessandro Benedetti


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/641294a9
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/641294a9
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/641294a9

Branch: refs/heads/master
Commit: 641294a967b0cc030f5fccdaf07514cf8a2e2ed0
Parents: 500c2be
Author: Tommaso Teofili <to...@apache.org>
Authored: Mon Nov 28 09:20:02 2016 +0100
Committer: Tommaso Teofili <to...@apache.org>
Committed: Mon Nov 28 09:20:02 2016 +0100

----------------------------------------------------------------------
 .../UIMAUpdateRequestProcessorTest.java         | 37 +++++++++++---------
 1 file changed, 21 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/641294a9/solr/contrib/uima/src/test/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorTest.java
----------------------------------------------------------------------
diff --git a/solr/contrib/uima/src/test/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorTest.java b/solr/contrib/uima/src/test/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorTest.java
index 3833696..9a89168 100644
--- a/solr/contrib/uima/src/test/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorTest.java
+++ b/solr/contrib/uima/src/test/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorTest.java
@@ -37,6 +37,11 @@ import org.junit.Test;
 @Slow
 public class UIMAUpdateRequestProcessorTest extends SolrTestCaseJ4 {
 
+  public static final String UIMA_CHAIN = "uima";
+  public static final String UIMA_MULTI_MAP_CHAIN = "uima-multi-map";
+  public static final String UIMA_IGNORE_ERRORS_CHAIN = "uima-ignoreErrors";
+  public static final String UIMA_NOT_IGNORE_ERRORS_CHAIN = "uima-not-ignoreErrors";
+
   @BeforeClass
   public static void beforeClass() throws Exception {
     initCore("solrconfig.xml", "schema.xml", getFile("uima/solr").getAbsolutePath());
@@ -53,7 +58,7 @@ public class UIMAUpdateRequestProcessorTest extends SolrTestCaseJ4 {
   @Test
   public void testProcessorConfiguration() {
     SolrCore core = h.getCore();
-    UpdateRequestProcessorChain chained = core.getUpdateProcessingChain("uima");
+    UpdateRequestProcessorChain chained = core.getUpdateProcessingChain(UIMA_CHAIN);
     assertNotNull(chained);
     UIMAUpdateRequestProcessorFactory factory = (UIMAUpdateRequestProcessorFactory)chained.getProcessors().get(0);
     assertNotNull(factory);
@@ -64,7 +69,7 @@ public class UIMAUpdateRequestProcessorTest extends SolrTestCaseJ4 {
   @Test
   public void testMultiMap() {
     SolrCore core = h.getCore();
-    UpdateRequestProcessorChain chained = core.getUpdateProcessingChain("uima-multi-map");
+    UpdateRequestProcessorChain chained = core.getUpdateProcessingChain(UIMA_MULTI_MAP_CHAIN);
     assertNotNull(chained);
     UIMAUpdateRequestProcessorFactory factory = (UIMAUpdateRequestProcessorFactory)chained.getProcessors().get(0);
     assertNotNull(factory);
@@ -80,7 +85,7 @@ public class UIMAUpdateRequestProcessorTest extends SolrTestCaseJ4 {
 
   @Test
   public void testProcessing() throws Exception {
-    addDoc("uima", adoc(
+    addDoc(adoc(
             "id",
             "2312312321312",
             "text",
@@ -88,7 +93,7 @@ public class UIMAUpdateRequestProcessorTest extends SolrTestCaseJ4 {
                     + "Add support for specifying Spelling SuggestWord Comparator to Lucene spell "
                     + "checkers for SpellCheckComponent. Issue SOLR-2053 is already fixed, patch is"
                     + " attached if you need it, but it is also committed to trunk and 3_x branch."
-                    + " Last Lucene European Conference has been held in Prague."));
+                + " Last Lucene European Conference has been held in Prague."), UIMA_CHAIN);
     assertU(commit());
     assertQ(req("sentence:*"), "//*[@numFound='1']");
     assertQ(req("sentiment:*"), "//*[@numFound='0']");
@@ -98,16 +103,16 @@ public class UIMAUpdateRequestProcessorTest extends SolrTestCaseJ4 {
   @Test
   public void testTwoUpdates() throws Exception {
 
-    addDoc("uima", adoc("id", "1", "text", "The Apache Software Foundation is happy to announce "
+    addDoc(adoc("id", "1", "text", "The Apache Software Foundation is happy to announce "
             + "BarCampApache Sydney, Australia, the first ASF-backed event in the Southern "
-            + "Hemisphere!"));
+        + "Hemisphere!"), UIMA_CHAIN);
     assertU(commit());
     assertQ(req("sentence:*"), "//*[@numFound='1']");
 
-    addDoc("uima", adoc("id", "2", "text", "Taking place 11th December 2010 at the University "
+    addDoc(adoc("id", "2", "text", "Taking place 11th December 2010 at the University "
             + "of Sydney's Darlington Centre, the BarCampApache \"unconference\" will be"
             + " attendee-driven, facilitated by members of the Apache community and will "
-            + "focus on the Apache..."));
+        + "focus on the Apache..."), UIMA_CHAIN);
     assertU(commit());
     assertQ(req("sentence:*"), "//*[@numFound='2']");
 
@@ -119,7 +124,7 @@ public class UIMAUpdateRequestProcessorTest extends SolrTestCaseJ4 {
   public void testErrorHandling() throws Exception {
 
     try{
-      addDoc("uima-not-ignoreErrors", adoc(
+      addDoc(adoc(
             "id",
             "2312312321312",
             "text",
@@ -127,14 +132,14 @@ public class UIMAUpdateRequestProcessorTest extends SolrTestCaseJ4 {
                     + "Add support for specifying Spelling SuggestWord Comparator to Lucene spell "
                     + "checkers for SpellCheckComponent. Issue SOLR-2053 is already fixed, patch is"
                     + " attached if you need it, but it is also committed to trunk and 3_x branch."
-                    + " Last Lucene European Conference has been held in Prague."));
+                + " Last Lucene European Conference has been held in Prague."), UIMA_NOT_IGNORE_ERRORS_CHAIN);
       fail("exception shouldn't be ignored");
     }
     catch(RuntimeException expected){}
     assertU(commit());
     assertQ(req("*:*"), "//*[@numFound='0']");
 
-    addDoc("uima-ignoreErrors", adoc(
+    addDoc(adoc(
             "id",
             "2312312321312",
             "text",
@@ -142,16 +147,16 @@ public class UIMAUpdateRequestProcessorTest extends SolrTestCaseJ4 {
                     + "Add support for specifying Spelling SuggestWord Comparator to Lucene spell "
                     + "checkers for SpellCheckComponent. Issue SOLR-2053 is already fixed, patch is"
                     + " attached if you need it, but it is also committed to trunk and 3_x branch."
-                    + " Last Lucene European Conference has been held in Prague."));
+                + " Last Lucene European Conference has been held in Prague."), UIMA_IGNORE_ERRORS_CHAIN);
     assertU(commit());
     assertQ(req("*:*"), "//*[@numFound='1']");
 
     try{
-      addDoc("uima-not-ignoreErrors", adoc(
+      addDoc(adoc(
             "id",
             "2312312321312",
             "text",
-            "SpellCheckComponent got improvement related to recent Lucene changes."));
+          "SpellCheckComponent got improvement related to recent Lucene changes."), UIMA_NOT_IGNORE_ERRORS_CHAIN);
       fail("exception shouldn't be ignored");
     }
     catch(StringIndexOutOfBoundsException e){  // SOLR-2579
@@ -160,11 +165,11 @@ public class UIMAUpdateRequestProcessorTest extends SolrTestCaseJ4 {
     catch(SolrException expected){}
 
     try{
-      addDoc("uima-ignoreErrors", adoc(
+      addDoc(adoc(
             "id",
             "2312312321312",
             "text",
-            "SpellCheckComponent got improvement related to recent Lucene changes."));
+          "SpellCheckComponent got improvement related to recent Lucene changes."), UIMA_IGNORE_ERRORS_CHAIN);
     }
     catch(StringIndexOutOfBoundsException e){  // SOLR-2579
       fail("exception shouldn't be raised");


[2/2] lucene-solr:master: SOLR-8871 - removed suppress for forbidden API, added locale to toUpperCase

Posted by to...@apache.org.
SOLR-8871 - removed suppress for forbidden API, added locale to toUpperCase


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/c36ec0b7
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/c36ec0b7
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/c36ec0b7

Branch: refs/heads/master
Commit: c36ec0b75e06295143601e76de9b71c20295fb7d
Parents: 641294a
Author: Tommaso Teofili <to...@apache.org>
Authored: Mon Nov 28 09:22:36 2016 +0100
Committer: Tommaso Teofili <to...@apache.org>
Committed: Mon Nov 28 09:22:36 2016 +0100

----------------------------------------------------------------------
 .../processor/ClassificationUpdateProcessorFactory.java      | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c36ec0b7/solr/core/src/java/org/apache/solr/update/processor/ClassificationUpdateProcessorFactory.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/update/processor/ClassificationUpdateProcessorFactory.java b/solr/core/src/java/org/apache/solr/update/processor/ClassificationUpdateProcessorFactory.java
index cbe571b..8341ad4 100644
--- a/solr/core/src/java/org/apache/solr/update/processor/ClassificationUpdateProcessorFactory.java
+++ b/solr/core/src/java/org/apache/solr/update/processor/ClassificationUpdateProcessorFactory.java
@@ -17,12 +17,13 @@
 
 package org.apache.solr.update.processor;
 
+import java.util.Locale;
+
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.search.Query;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.NamedList;
-import org.apache.solr.common.util.SuppressForbidden;
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.response.SolrQueryResponse;
 import org.apache.solr.schema.IndexSchema;
@@ -60,7 +61,6 @@ public class ClassificationUpdateProcessorFactory extends UpdateRequestProcessor
   private SolrParams params;
   private ClassificationUpdateProcessorParams classificationParams;
 
-  @SuppressForbidden(reason = "Need toUpperCase to match algorithm enum value")
   @Override
   public void init(final NamedList args) {
     if (args != null) {
@@ -86,10 +86,10 @@ public class ClassificationUpdateProcessorFactory extends UpdateRequestProcessor
       String algorithmString = params.get(ALGORITHM_PARAM);
       Algorithm classificationAlgorithm;
       try {
-        if (algorithmString == null || Algorithm.valueOf(algorithmString.toUpperCase()) == null) {
+        if (algorithmString == null || Algorithm.valueOf(algorithmString.toUpperCase(Locale.ROOT)) == null) {
           classificationAlgorithm = DEFAULT_ALGORITHM;
         } else {
-          classificationAlgorithm = Algorithm.valueOf(algorithmString.toUpperCase());
+          classificationAlgorithm = Algorithm.valueOf(algorithmString.toUpperCase(Locale.ROOT));
         }
       } catch (IllegalArgumentException e) {
         throw new SolrException