lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tommy Chheng <tommy.chh...@gmail.com>
Subject Re: DIH and multivariable fields problems
Date Sat, 07 Aug 2010 00:29:35 GMT
  For multiple value fields using the DIH, i use group_concat with the 
regextransformer's splitby:
ex:
<entity dataSource="grad_schools" query="
           SELECT    group_concat(professors.name separator '|') as 
university_professors
           FROM professors
             WHERE     professors.university_guid = '${universities.guid}'
         "
         transformer="RegexTransformer">
<field column="university_professors" splitBy="\|" />
</entity>

hope that's helpful.

@tommychheng
Programmer and UC Irvine Graduate Student
Find a great grad school based on research interests: http://gradschoolnow.com


On 8/6/10 4:39 PM, harrysmith wrote:
> I'm having a difficult time understanding how multivariable fields work with
> the DataImportHandler when the source is a RDBMS. I've read the following
> from the wiki:
>
> ----------
> What is a row?
>
> A row in DataImportHandler is a Map (Map<String, Object>). In the map , the
> key is the name of the field and the value can be anything which is a valid
> Solr type. The value can also be a Collection of the valid Solr types (this
> may get mapped to a multi-valued field). If the DataSource is RDBMS a query
> cannot emit a multivalued field. But it is possible to create a multivalued
> field by joining an entity with another.i.e if the sub-entity returns
> multiple rows for one row from parent entity it can go into a multivalued
> field. If the datasource is xml, it is possible to return a multivalued
> field.
> --------------
>
> How does one 'join an entity with another'?  Below are the relevant sections
> of my schema.xml and data-config.xml.
>
> schema.xml
>
> <dynamicField name="*_s"  type="string"  indexed="true"  stored="true"
> multiValued="true" />
>
> =========
>
> data-config.xml
>
> <entity name="item" query="select * from project_items where
> projectid_fk=1">
>              <field column="ID_PK" name="id" />
>               <entity name="terms" query="select distinct DESC_TERM from
> tem_metadata where item_id=${item.ID_PK}">
>                        <entity name="metadata" query="select * from
> term_metadata where item_id=${item.ID_PK} AND
> desc_term='${terms.DESC_TERM}'">
>                               <field name="${terms.DESC_TERM}_s"
> column="TEXT_VALUE" />
>                         </entity>
>                </entity>
> </entity>
>
> ========================
>
> I have multiple terms (rows) in the term_metadata table that are returned
> from the query, but only the first one gets added. Am I missing something
> obvious?
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

Mime
View raw message