Reputation: 203
I have a field in Solr
<dynamicField name="Phrase_*" type="string" indexed="true" stored="true" multiValued="true" required="false"/>
which is used to hold phrases in different languages, so the names tend to be "Phrase_en", "Phrase_sp", etc. I have analyzers and filters to do work against differently languaged fields for types named in a similar fashion ("string_en", "string_sp", etc) that do the correct stemming/synonyming for the corresponding language, and I'd like to find some way of rigging it up so that the correct analyzer/filter set is used for each language, based on the field name.
At the moment, the only thing I can think to do is create a type that multiplexes these analyzer sets and makes the judgement on which one to send it to, but I don't know how to do that.
Any ideas on how to pull that off, or a better way of achieving that goal?
Upvotes: 4
Views: 1232
Reputation: 27487
This problem is covered in a fair amount of detail in the book Solr In Action (highly recommended for those looking to dive deep in Solr config) and by others trying to achieve the same result. There are 3 basic approaches:
Your proposal is a variation on 1 and 3 - the best place I can give you to start is to read the book in question (it's in chapter 14) and study the code that he's placed on Github to implement it:
https://github.com/treygrainger/solr-in-action/tree/master/src/main/java/sia/ch14 https://github.com/treygrainger/solr-in-action/tree/master/example-docs/ch14/cores
Upvotes: 4