lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Matheis <matheis.ste...@googlemail.com>
Subject Re: Indexing multiple languages
Date Tue, 03 May 2011 08:32:51 GMT
Peter,

is there a specific need to split these entities? why not just fetch
both columns in one entity? like this:

<entity name="artist_category" query="select categoryid from
artist_categories where objectid=${artist.id}">
       <entity name="category" query="select title_en, title_nl from
music_categories
where id = '${artist_category.categoryid}'">
               <field name="categories_nl" column="title_nl"  />
               <field name="categories_en" column="title_en"  />
       </entity>
</entity>

two additional hints:
1) if you 'alias' your fields in your select query (select title_en as
categories_en) then it's no longer needed to use a <field> assignment
2) if you join both tables already in your first entity, you can skip
the second query to the database

Regards
Stefan

On Mon, May 2, 2011 at 11:53 PM, PeterKerk <vetteparty@hotmail.com> wrote:
> I have categories facets. Currently on in 1 language, but since my site is
> multilanguage, I need to index them in multiple languages.
>
> My table looks like this:
>
> [music_categories]
> id      int     Unchecked
> title   nvarchar(50)    Unchecked
> title_en        nvarchar(50)    Unchecked
> title_nl        nvarchar(50)    Unchecked
>
>
>
>
> In my data-config.xml I have this, only for 1 language:
>
> <entity name="artist_category" query="select categoryid from
> artist_categories where objectid=${artist.id}">
>        <entity name="category" query="select title from music_categories where
id
> = '${artist_category.categoryid}'">
>                <field name="categories" column="title"  />
>        </entity>
> </entity>
>
>
> Now, the only way I can imagine indexing multiple languages is by
> duplicating these lines:
>
> <entity name="artist_category_en" query="select categoryid from
> artist_categories where objectid=${artist.id}">
>        <entity name="category_en" query="select title_en from music_categories
> where id = '${artist_category.categoryid}'">
>                <field name="categories_en" column="title_en"  />
>        </entity>
> </entity>
>
> <entity name="artist_category_nl" query="select categoryid from
> artist_categories where objectid=${artist.id}">
>        <entity name="category_nl" query="select title_nl from music_categories
> where id = '${artist_category.categoryid}'">
>                <field name="categories_nl" column="title_nl"  />
>        </entity>
> </entity>
>
>
> Is there a better way, e.g. where I can do some sort of parametering like
> {lang] or something?
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Indexing-multiple-languages-tp2891546p2891546.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Mime
View raw message