lucene-solr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Inger (JIRA)" <>
Subject [jira] Commented: (SOLR-1612) Use java.sql.Array to populate Multivalue field in DataImportHandler
Date Wed, 02 Dec 2009 21:02:20 GMT


Matt Inger commented on SOLR-1612:

Seems the second issues is caused by the class loading problem.  Since I have to include a
second copy of the dataimporter jar file in order to resolve the ClassNotFoundException, it
fails the "instanceof" condition since the base class of my transformer is not the same Transformer
class that the EntityProcessorWrapper is aware of.  As a result, it falls through to else
clause, and it ends up requiring the simple  version of the method. 

As a future optimization, this is not the best way to check anyway, you're better off doing
this, which is faster, and doesn't require an object to be constructed, to check to see if
the class extends the Transformer class.  The way you currently have it implemented, it's
needlessly constructing the object twice no matter which type of transformer is being used.

if ( Transformer.class.isAssignableFrom(clazz) ) {


> Use java.sql.Array to populate Multivalue field in DataImportHandler
> --------------------------------------------------------------------
>                 Key: SOLR-1612
>                 URL:
>             Project: Solr
>          Issue Type: Improvement
>          Components: contrib - DataImportHandler
>    Affects Versions: 1.4
>            Reporter: Matt Inger
>             Fix For: 1.5
>         Attachments: SOLR-1612.patch
> I am attaching a patch to the JdbcDataSource class which allows the it to populate a
multiValued field from a query which returns a java.sql.Array type for a column value.
> In order to make this work, you need to do the following:
> 1.  In your schema.xml file, set the "multiValued" attribute to the value "true"
>          <field name=foo" type="string"  ... multiValued="true" />
> 2.  Have your sql query return a sql type of java.sql.Types.ARRAY.  How to do this is
very database dependent, but in oracle, you first create a type:
>              create or replace type FOO_TYPE IS TABLE OF VARCHAR2(255);
>       and then when you select the values, you have to use MULTISET and cast to the created
type (assuming here that FOO_PARENT_ID is the condition to
>       limit which foos belong to the current record):
> The main advantage this has is it can save you a ton of queries over the current method
which will fire off an individual query for each document in order to retrieve the values
for each multiValued field.  This method executes much faster, and saves alot of database

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message