Search in sources :

Example 1 with StopwordAnalyzerBase

use of org.apache.lucene.analysis.util.StopwordAnalyzerBase in project orientdb by orientechnologies.

the class OLuceneAnalyzerFactoryTest method shouldAssignConfiguredAnalyzerForIndexing.

@Test
public void shouldAssignConfiguredAnalyzerForIndexing() throws Exception {
    OLucenePerFieldAnalyzerWrapper analyzer = (OLucenePerFieldAnalyzerWrapper) analyzerFactory.createAnalyzer(indexDef, INDEX, metadata);
    assertThat(analyzer.getWrappedAnalyzer("title")).isInstanceOf(EnglishAnalyzer.class);
    assertThat(analyzer.getWrappedAnalyzer("author")).isInstanceOf(KeywordAnalyzer.class);
    assertThat(analyzer.getWrappedAnalyzer("lyrics")).isInstanceOf(EnglishAnalyzer.class);
    assertThat(analyzer.getWrappedAnalyzer("description")).isInstanceOf(StandardAnalyzer.class);
    StopwordAnalyzerBase description = (StopwordAnalyzerBase) analyzer.getWrappedAnalyzer("description");
    assertThat(description.getStopwordSet()).isNotEmpty();
    assertThat(description.getStopwordSet()).hasSize(2);
    assertThat(description.getStopwordSet().contains("the")).isTrue();
    assertThat(description.getStopwordSet().contains("is")).isTrue();
}
Also used : StopwordAnalyzerBase(org.apache.lucene.analysis.util.StopwordAnalyzerBase) Test(org.junit.Test)

Aggregations

StopwordAnalyzerBase (org.apache.lucene.analysis.util.StopwordAnalyzerBase)1 Test (org.junit.Test)1