Reputation:
I have the solr document:
@SolrDocument(solrCoreName = "mydocument")
public class MyDocument {
@Indexed(name = "email", type = "text_general")
private String email;
...
}
And I want to set tokenizer for this field at Keyword Tokenizer
beacuse I have problems when I search by email like user@site*
.
How I can do that?
Upvotes: 0
Views: 293
Reputation: 9320
Spring Boot does not have control over these settings (it's called Schema)
You've already marked the field email
, to be named email
and have field type of text_general
. To change anything related to the process of indexing/searching using this filed, you need to update schema.xml
or managed-schema
(depends on your setup) and change fieldType definition.
Below is the standard text_general definition, you could change here solr.StandardTokenizerFactory
to the solr.KeywordTokenizerFactory
(however, I would recommend to rather create the new fieldType
for this particular email field.
<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
<!-- in this example, we will only use synonyms at query time
<filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
-->
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
Upvotes: 2