You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ge...@apache.org on 2019/11/04 13:43:31 UTC

[lucene-solr] branch master updated: SOLR-13762: Allow BinaryField use with non-binary wt's.

This is an automated email from the ASF dual-hosted git repository.

gerlowskija pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/master by this push:
     new de28c67  SOLR-13762: Allow BinaryField use with non-binary wt's.
de28c67 is described below

commit de28c67627c43b9937511f130c6d7d481fe80895
Author: Jason Gerlowski <ge...@apache.org>
AuthorDate: Fri Nov 1 10:05:09 2019 -0400

    SOLR-13762: Allow BinaryField use with non-binary wt's.
    
    Closes #883
---
 solr/CHANGES.txt                                                       | 2 ++
 solr/core/src/java/org/apache/solr/schema/BinaryField.java             | 3 +++
 .../solr/update/processor/AbstractAtomicUpdatesMultivalueTestBase.java | 1 -
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 10c88ca..adeb9ff 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -148,6 +148,8 @@ Bug Fixes
 * SOLR-13207: In dismax and edismax "minimum should match" queries, the < operator not followed by a number will now return
   an HTTP 400 error rather than 500, and the error message will explain that < must be followed by a number. (Chris Hennick)
 
+* SOLR-13762: Fix BinaryField support for non-binary wt's (Thomas Woeckinger via Jason Gerlowski)
+
 Other Changes
 ---------------------
 
diff --git a/solr/core/src/java/org/apache/solr/schema/BinaryField.java b/solr/core/src/java/org/apache/solr/schema/BinaryField.java
index 39b895a..a7eb64b 100644
--- a/solr/core/src/java/org/apache/solr/schema/BinaryField.java
+++ b/solr/core/src/java/org/apache/solr/schema/BinaryField.java
@@ -110,6 +110,9 @@ public class BinaryField extends FieldType  {
   public Object toNativeType(Object val) {
     if (val instanceof byte[]) {
       return ByteBuffer.wrap((byte[]) val);
+    } else if (val instanceof CharSequence) {
+      final CharSequence valAsCharSequence = (CharSequence) val;
+      return ByteBuffer.wrap(Base64.base64ToByteArray(valAsCharSequence.toString()));
     }
     return super.toNativeType(val);
   }
diff --git a/solr/core/src/test/org/apache/solr/update/processor/AbstractAtomicUpdatesMultivalueTestBase.java b/solr/core/src/test/org/apache/solr/update/processor/AbstractAtomicUpdatesMultivalueTestBase.java
index 05fd0e7..1bce422 100644
--- a/solr/core/src/test/org/apache/solr/update/processor/AbstractAtomicUpdatesMultivalueTestBase.java
+++ b/solr/core/src/test/org/apache/solr/update/processor/AbstractAtomicUpdatesMultivalueTestBase.java
@@ -209,7 +209,6 @@ public abstract class AbstractAtomicUpdatesMultivalueTestBase extends EmbeddedSo
   }
 
   @Test
-  @AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/SOLR-13762")
   public void testMultivalueBinaryField() throws SolrServerException, IOException {
     runTestForFieldWithoutQuery("binaryRemove",
         new byte[][] {new byte[] {0}, new byte[] {1}, new byte[] {2}, new byte[] {3}});