Skip to content

Apache Lucene open-source search software

SOLR-1348 -- Support binary field type in convertType logic in JdbcDataSource

Shalin Shekhar Mangarc8d24315487d
diff --git a/contrib/dataimporthandler/CHANGES.txt b/contrib/dataimporthandler/CHANGES.txt
index 16594d94667..c6093fa964b 100644
--- a/contrib/dataimporthandler/CHANGES.txt
+++ b/contrib/dataimporthandler/CHANGES.txt
@@ -150,7 +150,10 @@ New Features
35.SOLR-1235: disallow period (.) in entity names (noble)
-36.SOLR-1234: Multiple DIH does not work because all of them write to dataimport.properties. Use the handler name as the properties file name (noble)
+36.SOLR-1234: Multiple DIH does not work because all of them write to dataimport.properties.
+ Use the handler name as the properties file name (noble)
+
+37.SOLR-1348: Support binary field type in convertType logic in JdbcDataSource (shalin)
Optimizations
----------------------
diff --git a/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/JdbcDataSource.java b/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/JdbcDataSource.java
index b394f70451d..fafdbdf21c9 100644
--- a/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/JdbcDataSource.java
+++ b/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/JdbcDataSource.java
@@ -89,6 +89,8 @@ public class JdbcDataSource extends
fieldNameVsType.put(n, Types.DATE);
else if ("boolean".equals(t))
fieldNameVsType.put(n, Types.BOOLEAN);
+ else if ("binary".equals(t))
+ fieldNameVsType.put(n, Types.BLOB);
else
fieldNameVsType.put(n, Types.VARCHAR);
}
@@ -307,6 +309,9 @@ public class JdbcDataSource extends
case Types.BOOLEAN:
result.put(colName, resultSet.getBoolean(colName));
break;
+ case Types.BLOB:
+ result.put(colName, resultSet.getBytes(colName));
+ break;
default:
result.put(colName, resultSet.getString(colName));
break;