Reputation: 293
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
Upvotes: 0
Views: 688
Reputation: 11864
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
Upvotes: 1