0
votes

I want indexing a database with a solr field name different from the column name "TR.nom" :

<entity name="id" query="select R.id, R.titre, R.description, TR.nom
                            from Ressource as R
                            join TypeRessource as TR
                            on R.typeRessource_id = TR.id">
<field column="R.id" name="id" />
    <field column="R.titre" name="titre" />
    <field column="R.description" name="description" />
    <field column="TR.nom" name="typeRessource" />
</entity>

In the schema.xml :

<field name="typeRessource" type="text" indexed="true" stored="true" />

Indexing works fine for all fields but not for "typeRessource".

If the field name is the same as the column name I don't have any problems.

Thanks for your help

1

1 Answers

1
votes

You can always use AS on your sql query to make the column name match the solr field name
in your case :

select R.id, R.titre, R.description, TR.nom AS typeRessource
from Ressource as R
join TypeRessource as TR
on R.typeRessource_id = TR.id