You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "Alexandre Rafalovitch (Jira)" <ji...@apache.org> on 2020/08/29 18:30:00 UTC

[jira] [Resolved] (SOLR-1612) Use java.sql.Array to populate Multivalue field in DataImportHandler

     [ https://issues.apache.org/jira/browse/SOLR-1612?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexandre Rafalovitch resolved SOLR-1612.
-----------------------------------------
    Resolution: Won't Fix

> Use java.sql.Array to populate Multivalue field in DataImportHandler
> --------------------------------------------------------------------
>
>                 Key: SOLR-1612
>                 URL: https://issues.apache.org/jira/browse/SOLR-1612
>             Project: Solr
>          Issue Type: Improvement
>          Components: contrib - DataImportHandler
>    Affects Versions: 1.4
>            Reporter: Matthew P. Inger
>            Priority: Major
>             Fix For: 6.0, 4.9
>
>         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):
>              CAST(MULTISET(SELECT FOO FROM FOOS WHERE FOO_PARENT=FOO_PARENT_ID) AS FOO_TYPE ) MY_FOOS
> 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 resources.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org