Return-Path: Delivered-To: apmail-lucene-solr-dev-archive@minotaur.apache.org Received: (qmail 55465 invoked from network); 4 Jan 2010 15:30:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Jan 2010 15:30:16 -0000 Received: (qmail 71043 invoked by uid 500); 4 Jan 2010 15:30:15 -0000 Delivered-To: apmail-lucene-solr-dev-archive@lucene.apache.org Received: (qmail 70968 invoked by uid 500); 4 Jan 2010 15:30:15 -0000 Mailing-List: contact solr-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-dev@lucene.apache.org Delivered-To: mailing list solr-dev@lucene.apache.org Received: (qmail 70958 invoked by uid 99); 4 Jan 2010 15:30:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Jan 2010 15:30:15 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Jan 2010 15:30:14 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 7292E29A0013 for ; Mon, 4 Jan 2010 07:29:54 -0800 (PST) Message-ID: <289688621.22151262618994468.JavaMail.jira@brutus.apache.org> Date: Mon, 4 Jan 2010 15:29:54 +0000 (UTC) From: "Matt Inger (JIRA)" To: solr-dev@lucene.apache.org Subject: [jira] Commented: (SOLR-1612) Use java.sql.Array to populate Multivalue field in DataImportHandler In-Reply-To: <1537893849.1259599640730.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/SOLR-1612?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12796211#action_12796211 ] Matt Inger commented on SOLR-1612: ---------------------------------- Yes, and I have attached that transformer to SOLR-1675, and will link to this ticket. Perhaps it's useful enough to include directly in the contrib code. > 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: 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" > > 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 is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.