Search in sources :

Example 26 with EnglishAnalyzer

use of org.apache.lucene.analysis.en.EnglishAnalyzer in project orientdb by orientechnologies.

the class OLucenePerFieldAnalyzerWrapperTest method shouldReturnCustomAnalyzerForEachFieldInitializedByConstructor.

@Test
public void shouldReturnCustomAnalyzerForEachFieldInitializedByConstructor() throws Exception {
    OLucenePerFieldAnalyzerWrapper analyzer = new OLucenePerFieldAnalyzerWrapper(new StandardAnalyzer(), new HashMap<String, Analyzer>() {

        {
            put("text_en", new EnglishAnalyzer());
            put("text_it", new ItalianAnalyzer());
        }
    });
    assertThat(analyzer.getWrappedAnalyzer("text_en")).isNotNull();
    assertThat(analyzer.getWrappedAnalyzer("text_en")).isInstanceOf(EnglishAnalyzer.class);
    assertThat(analyzer.getWrappedAnalyzer("text_it")).isNotNull();
    assertThat(analyzer.getWrappedAnalyzer("text_it")).isInstanceOf(ItalianAnalyzer.class);
}
Also used : StandardAnalyzer(org.apache.lucene.analysis.standard.StandardAnalyzer) EnglishAnalyzer(org.apache.lucene.analysis.en.EnglishAnalyzer) EnglishAnalyzer(org.apache.lucene.analysis.en.EnglishAnalyzer) ItalianAnalyzer(org.apache.lucene.analysis.it.ItalianAnalyzer) StandardAnalyzer(org.apache.lucene.analysis.standard.StandardAnalyzer) Analyzer(org.apache.lucene.analysis.Analyzer) ItalianAnalyzer(org.apache.lucene.analysis.it.ItalianAnalyzer) Test(org.junit.Test)

Aggregations

EnglishAnalyzer (org.apache.lucene.analysis.en.EnglishAnalyzer)26 Analyzer (org.apache.lucene.analysis.Analyzer)9 Directory (org.apache.lucene.store.Directory)9 FSDirectory (org.apache.lucene.store.FSDirectory)9 Test (org.junit.Test)6 IndexWriter (org.apache.lucene.index.IndexWriter)5 IndexWriterConfig (org.apache.lucene.index.IndexWriterConfig)5 QueryParser (org.apache.lucene.queryparser.classic.QueryParser)5 ScoredDocuments (io.anserini.rerank.ScoredDocuments)4 IOException (java.io.IOException)4 MockAnalyzer (org.apache.lucene.analysis.MockAnalyzer)4 Query (org.apache.lucene.search.Query)4 RerankerContext (io.anserini.rerank.RerankerContext)3 StandardAnalyzer (org.apache.lucene.analysis.standard.StandardAnalyzer)3 Document (org.apache.lucene.document.Document)3 Term (org.apache.lucene.index.Term)3 IndexSearcher (org.apache.lucene.search.IndexSearcher)3 ScoreDoc (org.apache.lucene.search.ScoreDoc)3 TopDocs (org.apache.lucene.search.TopDocs)3 BM25Similarity (org.apache.lucene.search.similarities.BM25Similarity)3