Search in sources :

Example 1 with TextSearchInfo

use of org.opensearch.index.mapper.TextSearchInfo in project OpenSearch by opensearch-project.

the class AbstractSuggestionBuilderTestCase method mockFieldType.

protected MappedFieldType mockFieldType(String fieldName, boolean analyzerSet) {
    MappedFieldType fieldType = mock(MappedFieldType.class);
    when(fieldType.name()).thenReturn(fieldName);
    NamedAnalyzer searchAnalyzer = analyzerSet ? new NamedAnalyzer("fieldSearchAnalyzer", AnalyzerScope.INDEX, new SimpleAnalyzer()) : null;
    TextSearchInfo tsi = new TextSearchInfo(TextFieldMapper.Defaults.FIELD_TYPE, null, searchAnalyzer, searchAnalyzer);
    when(fieldType.getTextSearchInfo()).thenReturn(tsi);
    return fieldType;
}
Also used : TextSearchInfo(org.opensearch.index.mapper.TextSearchInfo) NamedAnalyzer(org.opensearch.index.analysis.NamedAnalyzer) SimpleAnalyzer(org.apache.lucene.analysis.core.SimpleAnalyzer) MappedFieldType(org.opensearch.index.mapper.MappedFieldType)

Aggregations

SimpleAnalyzer (org.apache.lucene.analysis.core.SimpleAnalyzer)1 NamedAnalyzer (org.opensearch.index.analysis.NamedAnalyzer)1 MappedFieldType (org.opensearch.index.mapper.MappedFieldType)1 TextSearchInfo (org.opensearch.index.mapper.TextSearchInfo)1