You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by no...@apache.org on 2016/12/07 13:12:56 UTC

[1/2] lucene-solr:master: added an extra testcase

Repository: lucene-solr
Updated Branches:
  refs/heads/master 8b98b158f -> 10500c894


added an extra testcase


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

Branch: refs/heads/master
Commit: 3f6164c76e2fc581abe4408066e08cf9fc817260
Parents: bd8b191
Author: Noble Paul <no...@apache.org>
Authored: Wed Dec 7 18:42:07 2016 +0530
Committer: Noble Paul <no...@apache.org>
Committed: Wed Dec 7 18:42:07 2016 +0530

----------------------------------------------------------------------
 .../TestPlainTextEntityProcessor.java           | 108 +++++++++++++++++++
 1 file changed, 108 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/3f6164c7/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestPlainTextEntityProcessor.java
----------------------------------------------------------------------
diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestPlainTextEntityProcessor.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestPlainTextEntityProcessor.java
index 82b757e..a286d84 100644
--- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestPlainTextEntityProcessor.java
+++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestPlainTextEntityProcessor.java
@@ -16,12 +16,23 @@
  */
 package org.apache.solr.handler.dataimport;
 
+import java.io.ByteArrayInputStream;
 import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.io.StringReader;
+import java.nio.charset.StandardCharsets;
+import java.sql.Blob;
+import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.Collections;
 import java.util.Properties;
 
+import org.apache.solr.common.util.Utils;
 import org.junit.Test;
 
+import static java.nio.charset.StandardCharsets.UTF_8;
+
 /**
  * Test for PlainTextEntityProcessor
  *
@@ -42,6 +53,103 @@ public class TestPlainTextEntityProcessor extends AbstractDataImportHandlerTestC
     assertEquals(DS.s, sw.docs.get(0).getFieldValue("x"));
   }
 
+  static class BlobImpl implements Blob{
+    private final byte[] bytes;
+
+    BlobImpl(byte[] bytes) {
+      this.bytes = bytes;
+    }
+
+    @Override
+    public long length() throws SQLException {
+      return 0;
+    }
+
+    @Override
+    public byte[] getBytes(long pos, int length) throws SQLException {
+      return bytes;
+    }
+
+    @Override
+    public InputStream getBinaryStream() throws SQLException {
+      return new ByteArrayInputStream(bytes);
+    }
+
+    @Override
+    public long position(byte[] pattern, long start) throws SQLException {
+      return 0;
+    }
+
+    @Override
+    public long position(Blob pattern, long start) throws SQLException {
+      return 0;
+    }
+
+    @Override
+    public int setBytes(long pos, byte[] bytes) throws SQLException {
+      return 0;
+    }
+
+    @Override
+    public int setBytes(long pos, byte[] bytes, int offset, int len) throws SQLException {
+      return 0;
+    }
+
+    @Override
+    public OutputStream setBinaryStream(long pos) throws SQLException {
+      return null;
+    }
+
+    @Override
+    public void truncate(long len) throws SQLException {
+
+    }
+
+    @Override
+    public void free() throws SQLException {
+
+    }
+
+    @Override
+    public InputStream getBinaryStream(long pos, long length) throws SQLException {
+      return new ByteArrayInputStream(bytes);
+    }
+  }
+
+  @Test
+  public void testSimple2() throws IOException {
+    DataImporter di = new DataImporter();
+    MockDataSource.setIterator("select id, name, blob_field from lw_table4", Collections.singletonList(Utils.makeMap("blob_field",new BlobImpl(DS.s.getBytes(UTF_8)) ) ).iterator());
+
+    String dc =
+
+        " <dataConfig>" +
+            "<dataSource name=\"ds1\" type=\"MockDataSource\"/>\n" +
+        " <!-- dataSource for FieldReaderDataSource -->\n" +
+        " <dataSource dataField=\"root.blob_field\" name=\"fr\" type=\"FieldReaderDataSource\"/>\n" +
+        "\n" +
+        " <document name=\"items\">\n" +
+        "   <entity dataSource=\"ds1\" name=\"root\" pk=\"id\"  query=\"select id, name, blob_field from lw_table4\" transformer=\"TemplateTransformer\">\n" +
+        "           <field column=\"id\" name=\"id\"/>\n" +
+        "\n" +
+        "        <entity dataField=\"root.blob_field\" dataSource=\"fr\" format=\"text\" name=\"n1\" processor=\"PlainTextEntityProcessor\" url=\"blob_field\">\n" +
+        "                       <field column=\"plainText\" name=\"plainText\"/>\n" +
+        "           </entity>\n" +
+        "\n" +
+        "   </entity>\n" +
+        " </document>\n" +
+        "</dataConfig>";
+    System.out.println(dc);
+    di.loadAndInit(dc);
+    redirectTempProperties(di);
+
+    TestDocBuilder.SolrWriterImpl sw = new TestDocBuilder.SolrWriterImpl();
+    RequestInfo rp = new RequestInfo(null, createMap("command", "full-import"), null);
+    di.runCmd(rp, sw);
+    assertEquals(DS.s, sw.docs.get(0).getFieldValue("plainText"));
+  }
+
+
   public static class DS extends DataSource {
     static String s = "hello world";
 


[2/2] lucene-solr:master: Merge remote-tracking branch 'origin/master'

Posted by no...@apache.org.
Merge remote-tracking branch 'origin/master'


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

Branch: refs/heads/master
Commit: 10500c894da171b6826e5101a981283ec434b9de
Parents: 3f6164c 8b98b15
Author: Noble Paul <no...@apache.org>
Authored: Wed Dec 7 18:42:39 2016 +0530
Committer: Noble Paul <no...@apache.org>
Committed: Wed Dec 7 18:42:39 2016 +0530

----------------------------------------------------------------------
 lucene/CHANGES.txt                              |   4 +
 .../uhighlight/MemoryIndexOffsetStrategy.java   |  10 +-
 .../uhighlight/MultiTermHighlighting.java       |  37 +--
 .../lucene/search/uhighlight/PhraseHelper.java  | 158 ++++++++---
 .../search/uhighlight/UnifiedHighlighter.java   |  64 +++--
 .../uhighlight/TestUnifiedHighlighter.java      | 275 +++++++++++++++++++
 .../TestUnifiedHighlighterExtensibility.java    |   3 +-
 solr/CHANGES.txt                                |   9 +
 .../src/java/org/apache/solr/core/SolrCore.java |   8 -
 .../solr/handler/admin/SystemInfoHandler.java   |  51 +++-
 .../solr/schema/ManagedIndexSchemaFactory.java  |  12 +
 .../org/apache/solr/schema/SchemaManager.java   |   2 +-
 .../ManagedSchemaRoundRobinCloudTest.java       |  98 +++++++
 .../solrj/impl/ConcurrentUpdateSolrClient.java  |  16 +-
 .../solr/client/solrj/SolrExampleTests.java     |   7 +-
 15 files changed, 649 insertions(+), 105 deletions(-)
----------------------------------------------------------------------