I followed Solr guide created a class and used @Field annotation in front of the class attributes.
public class MyDocument {
@Field
public String fra_contents;
... // Other fields
//NO getters and setters as shown https://lucene.apache.org/solr/guide/7_2/using-solrj.html#java-object-binding
}
Looking at the generated "managed-schema.xml" shows that "fra_contents" is of type "text_general" :
<field name="fra_contents" type="text_general"/>
Yet I need to apply a different tokenizer, and different filters to this field than the ones associated with "text_general". So I created a fieldtype programmatically (following based on Solr testing code) called "fra_contents_type" :
<fieldType name="fra_contents_type" class="solr.TextField">
<analyzer type="index">
<tokenizer class="solr.ClassicTokenizerFactory"/>
<filter class="solr.KeywordRepeatFilterFactory"/>
<filter class="solr.SynonymGraphFilterFactory" synonyms="lang/fra.txt"/>
<filter class="solr.FlattenGraphFilterFactory"/>
<filter class="solr.ASCIIFoldingFilterFactory"/>
<filter class="solr.ElisionFilterFactory" articles="lang/contractions_fr.txt"/>
<filter class="solr.SnowballPorterFilterFactory" language="French"/>
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.ClassicTokenizerFactory"/>
<filter class="solr.KeywordRepeatFilterFactory"/>
<filter class="solr.ASCIIFoldingFilterFactory"/>
<filter class="solr.ElisionFilterFactory" articles="lang/contractions_fr.txt"/>
<filter class="solr.SnowballPorterFilterFactory" language="French"/>
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
This other SO question explains how the fieldtype is set based on the java variable type, but does not tell how to change this defauld fieldtype.
So how can I change the fieldtype of this field programmatically while keeping the annotation (ie without editing the "managed-schema.xml") ?
Any help appreciated,