Search in sources :

Example 1 with MockSynonymAnalyzer

use of org.apache.lucene.tests.analysis.MockSynonymAnalyzer in project OpenSearch by opensearch-project.

the class TextFieldMapperTests method testFastPhraseMapping.

public void testFastPhraseMapping() throws IOException {
    MapperService mapperService = createMapperService(mapping(b -> {
        b.startObject("field").field("type", "text").field("analyzer", "my_stop_analyzer").field("index_phrases", true).endObject();
        // "standard" will be replaced with MockSynonymAnalyzer
        b.startObject("synfield").field("type", "text").field("analyzer", "standard").field("index_phrases", true).endObject();
    }));
    QueryShardContext queryShardContext = createQueryShardContext(mapperService);
    Query q = new MatchPhraseQueryBuilder("field", "two words").toQuery(queryShardContext);
    assertThat(q, is(new PhraseQuery("field._index_phrase", "two words")));
    Query q2 = new MatchPhraseQueryBuilder("field", "three words here").toQuery(queryShardContext);
    assertThat(q2, is(new PhraseQuery("field._index_phrase", "three words", "words here")));
    Query q3 = new MatchPhraseQueryBuilder("field", "two words").slop(1).toQuery(queryShardContext);
    assertThat(q3, is(new PhraseQuery(1, "field", "two", "words")));
    Query q4 = new MatchPhraseQueryBuilder("field", "singleton").toQuery(queryShardContext);
    assertThat(q4, is(new TermQuery(new Term("field", "singleton"))));
    Query q5 = new MatchPhraseQueryBuilder("field", "sparkle a stopword").toQuery(queryShardContext);
    assertThat(q5, is(new PhraseQuery.Builder().add(new Term("field", "sparkle")).add(new Term("field", "stopword"), 2).build()));
    MatchQuery matchQuery = new MatchQuery(queryShardContext);
    matchQuery.setAnalyzer(new MockSynonymAnalyzer());
    Query q6 = matchQuery.parse(MatchQuery.Type.PHRASE, "synfield", "motor dogs");
    assertThat(q6, is(new MultiPhraseQuery.Builder().add(new Term[] { new Term("synfield._index_phrase", "motor dogs"), new Term("synfield._index_phrase", "motor dog") }).build()));
    // https://github.com/elastic/elasticsearch/issues/43976
    CannedTokenStream cts = new CannedTokenStream(new Token("foo", 1, 0, 2, 2), new Token("bar", 0, 0, 2), new Token("baz", 1, 0, 2));
    Analyzer synonymAnalyzer = new Analyzer() {

        @Override
        protected TokenStreamComponents createComponents(String fieldName) {
            return new TokenStreamComponents(reader -> {
            }, cts);
        }
    };
    matchQuery.setAnalyzer(synonymAnalyzer);
    Query q7 = matchQuery.parse(MatchQuery.Type.BOOLEAN, "synfield", "foo");
    assertThat(q7, is(new BooleanQuery.Builder().add(new BooleanQuery.Builder().add(new TermQuery(new Term("synfield", "foo")), BooleanClause.Occur.SHOULD).add(new PhraseQuery.Builder().add(new Term("synfield._index_phrase", "bar baz")).build(), BooleanClause.Occur.SHOULD).build(), BooleanClause.Occur.SHOULD).build()));
    ParsedDocument doc = mapperService.documentMapper().parse(source(b -> b.field("field", "Some English text that is going to be very useful")));
    IndexableField[] fields = doc.rootDoc().getFields("field._index_phrase");
    assertEquals(1, fields.length);
    try (TokenStream ts = fields[0].tokenStream(queryShardContext.getMapperService().indexAnalyzer(), null)) {
        CharTermAttribute termAtt = ts.addAttribute(CharTermAttribute.class);
        ts.reset();
        assertTrue(ts.incrementToken());
        assertEquals("Some English", termAtt.toString());
    }
    Exception e = expectThrows(MapperParsingException.class, () -> createMapperService(fieldMapping(b -> b.field("type", "text").field("index", "false").field("index_phrases", true))));
    assertThat(e.getMessage(), containsString("Cannot set index_phrases on unindexed field [field]"));
    e = expectThrows(MapperParsingException.class, () -> createMapperService(fieldMapping(b -> b.field("type", "text").field("index_options", "freqs").field("index_phrases", true))));
    assertThat(e.getMessage(), containsString("Cannot set index_phrases on field [field] if positions are not enabled"));
}
Also used : Query(org.apache.lucene.search.Query) SpanOrQuery(org.apache.lucene.queries.spans.SpanOrQuery) Arrays(java.util.Arrays) SpanTermQuery(org.apache.lucene.queries.spans.SpanTermQuery) FieldType(org.apache.lucene.document.FieldType) IndexableField(org.apache.lucene.index.IndexableField) ToXContent(org.opensearch.common.xcontent.ToXContent) Term(org.apache.lucene.index.Term) PhraseQuery(org.apache.lucene.search.PhraseQuery) AnalyzerScope(org.opensearch.index.analysis.AnalyzerScope) KeywordAnalyzer(org.apache.lucene.analysis.core.KeywordAnalyzer) Strings(org.opensearch.common.Strings) TermsEnum(org.apache.lucene.index.TermsEnum) Map(java.util.Map) XContentFactory(org.opensearch.common.xcontent.XContentFactory) Is.is(org.hamcrest.core.Is.is) CustomAnalyzer(org.opensearch.index.analysis.CustomAnalyzer) EnglishAnalyzer(org.apache.lucene.analysis.en.EnglishAnalyzer) BytesRef(org.apache.lucene.util.BytesRef) Matchers.instanceOf(org.hamcrest.Matchers.instanceOf) StandardAnalyzer(org.apache.lucene.analysis.standard.StandardAnalyzer) Matchers.equalTo(org.hamcrest.Matchers.equalTo) IndexSettings(org.opensearch.index.IndexSettings) QueryShardContext(org.opensearch.index.query.QueryShardContext) Matchers.containsString(org.hamcrest.Matchers.containsString) SpanNearQuery(org.apache.lucene.queries.spans.SpanNearQuery) IndexAnalyzers(org.opensearch.index.analysis.IndexAnalyzers) MatchQuery(org.opensearch.index.search.MatchQuery) TokenFilterFactory(org.opensearch.index.analysis.TokenFilterFactory) HashMap(java.util.HashMap) WhitespaceAnalyzer(org.apache.lucene.analysis.core.WhitespaceAnalyzer) IndexableFieldType(org.apache.lucene.index.IndexableFieldType) CharFilterFactory(org.opensearch.index.analysis.CharFilterFactory) MultiPhraseQuery(org.apache.lucene.search.MultiPhraseQuery) StandardTokenizerFactory(org.opensearch.index.analysis.StandardTokenizerFactory) MatchPhraseQueryBuilder(org.opensearch.index.query.MatchPhraseQueryBuilder) Token(org.apache.lucene.tests.analysis.Token) CannedTokenStream(org.apache.lucene.tests.analysis.CannedTokenStream) CharTermAttribute(org.apache.lucene.analysis.tokenattributes.CharTermAttribute) StopFilter(org.apache.lucene.analysis.StopFilter) NamedAnalyzer(org.opensearch.index.analysis.NamedAnalyzer) MockSynonymAnalyzer(org.apache.lucene.tests.analysis.MockSynonymAnalyzer) PostingsEnum(org.apache.lucene.index.PostingsEnum) TokenStream(org.apache.lucene.analysis.TokenStream) Analyzer(org.apache.lucene.analysis.Analyzer) IOException(java.io.IOException) MatchPhrasePrefixQueryBuilder(org.opensearch.index.query.MatchPhrasePrefixQueryBuilder) MultiPhrasePrefixQuery(org.opensearch.common.lucene.search.MultiPhrasePrefixQuery) BooleanClause(org.apache.lucene.search.BooleanClause) XContentBuilder(org.opensearch.common.xcontent.XContentBuilder) TermQuery(org.apache.lucene.search.TermQuery) TextFieldType(org.opensearch.index.mapper.TextFieldMapper.TextFieldType) SynonymQuery(org.apache.lucene.search.SynonymQuery) BooleanQuery(org.apache.lucene.search.BooleanQuery) DocValuesType(org.apache.lucene.index.DocValuesType) FieldMaskingSpanQuery(org.apache.lucene.queries.spans.FieldMaskingSpanQuery) IndexOptions(org.apache.lucene.index.IndexOptions) Collections(java.util.Collections) MatchPhraseQueryBuilder(org.opensearch.index.query.MatchPhraseQueryBuilder) BooleanQuery(org.apache.lucene.search.BooleanQuery) CannedTokenStream(org.apache.lucene.tests.analysis.CannedTokenStream) TokenStream(org.apache.lucene.analysis.TokenStream) Query(org.apache.lucene.search.Query) SpanOrQuery(org.apache.lucene.queries.spans.SpanOrQuery) SpanTermQuery(org.apache.lucene.queries.spans.SpanTermQuery) PhraseQuery(org.apache.lucene.search.PhraseQuery) SpanNearQuery(org.apache.lucene.queries.spans.SpanNearQuery) MatchQuery(org.opensearch.index.search.MatchQuery) MultiPhraseQuery(org.apache.lucene.search.MultiPhraseQuery) MultiPhrasePrefixQuery(org.opensearch.common.lucene.search.MultiPhrasePrefixQuery) TermQuery(org.apache.lucene.search.TermQuery) SynonymQuery(org.apache.lucene.search.SynonymQuery) BooleanQuery(org.apache.lucene.search.BooleanQuery) FieldMaskingSpanQuery(org.apache.lucene.queries.spans.FieldMaskingSpanQuery) MatchPhraseQueryBuilder(org.opensearch.index.query.MatchPhraseQueryBuilder) MatchPhrasePrefixQueryBuilder(org.opensearch.index.query.MatchPhrasePrefixQueryBuilder) XContentBuilder(org.opensearch.common.xcontent.XContentBuilder) Token(org.apache.lucene.tests.analysis.Token) Matchers.containsString(org.hamcrest.Matchers.containsString) KeywordAnalyzer(org.apache.lucene.analysis.core.KeywordAnalyzer) CustomAnalyzer(org.opensearch.index.analysis.CustomAnalyzer) EnglishAnalyzer(org.apache.lucene.analysis.en.EnglishAnalyzer) StandardAnalyzer(org.apache.lucene.analysis.standard.StandardAnalyzer) WhitespaceAnalyzer(org.apache.lucene.analysis.core.WhitespaceAnalyzer) NamedAnalyzer(org.opensearch.index.analysis.NamedAnalyzer) MockSynonymAnalyzer(org.apache.lucene.tests.analysis.MockSynonymAnalyzer) Analyzer(org.apache.lucene.analysis.Analyzer) QueryShardContext(org.opensearch.index.query.QueryShardContext) MatchQuery(org.opensearch.index.search.MatchQuery) CannedTokenStream(org.apache.lucene.tests.analysis.CannedTokenStream) SpanTermQuery(org.apache.lucene.queries.spans.SpanTermQuery) TermQuery(org.apache.lucene.search.TermQuery) PhraseQuery(org.apache.lucene.search.PhraseQuery) MultiPhraseQuery(org.apache.lucene.search.MultiPhraseQuery) MockSynonymAnalyzer(org.apache.lucene.tests.analysis.MockSynonymAnalyzer) Term(org.apache.lucene.index.Term) IOException(java.io.IOException) IndexableField(org.apache.lucene.index.IndexableField) CharTermAttribute(org.apache.lucene.analysis.tokenattributes.CharTermAttribute)

Example 2 with MockSynonymAnalyzer

use of org.apache.lucene.tests.analysis.MockSynonymAnalyzer in project OpenSearch by opensearch-project.

the class SimpleQueryStringBuilderTests method testAnalyzerWithGraph.

public void testAnalyzerWithGraph() {
    SimpleQueryStringQueryParser.Settings settings = new SimpleQueryStringQueryParser.Settings();
    settings.analyzeWildcard(true);
    SimpleQueryStringQueryParser parser = new SimpleQueryStringQueryParser(new MockSynonymAnalyzer(), Collections.singletonMap(TEXT_FIELD_NAME, 1.0f), -1, settings, createShardContext());
    for (Operator op : Operator.values()) {
        BooleanClause.Occur defaultOp = op.toBooleanClauseOccur();
        parser.setDefaultOperator(defaultOp);
        // non-phrase won't detect multi-word synonym because of whitespace splitting
        Query query = parser.parse("guinea pig");
        Query expectedQuery = new BooleanQuery.Builder().add(new BooleanClause(new TermQuery(new Term(TEXT_FIELD_NAME, "guinea")), defaultOp)).add(new BooleanClause(new TermQuery(new Term(TEXT_FIELD_NAME, "pig")), defaultOp)).build();
        assertThat(query, equalTo(expectedQuery));
        // phrase will pick it up
        query = parser.parse("\"guinea pig\"");
        SpanTermQuery span1 = new SpanTermQuery(new Term(TEXT_FIELD_NAME, "guinea"));
        SpanTermQuery span2 = new SpanTermQuery(new Term(TEXT_FIELD_NAME, "pig"));
        expectedQuery = new SpanOrQuery(new SpanNearQuery(new SpanQuery[] { span1, span2 }, 0, true), new SpanTermQuery(new Term(TEXT_FIELD_NAME, "cavy")));
        assertThat(query, equalTo(expectedQuery));
        // phrase with slop
        query = parser.parse("big \"tiny guinea pig\"~2");
        PhraseQuery pq1 = new PhraseQuery.Builder().add(new Term(TEXT_FIELD_NAME, "tiny")).add(new Term(TEXT_FIELD_NAME, "guinea")).add(new Term(TEXT_FIELD_NAME, "pig")).setSlop(2).build();
        PhraseQuery pq2 = new PhraseQuery.Builder().add(new Term(TEXT_FIELD_NAME, "tiny")).add(new Term(TEXT_FIELD_NAME, "cavy")).setSlop(2).build();
        expectedQuery = new BooleanQuery.Builder().add(new TermQuery(new Term(TEXT_FIELD_NAME, "big")), defaultOp).add(new BooleanQuery.Builder().add(pq1, BooleanClause.Occur.SHOULD).add(pq2, BooleanClause.Occur.SHOULD).build(), defaultOp).build();
        assertThat(query, equalTo(expectedQuery));
    }
}
Also used : BooleanQuery(org.apache.lucene.search.BooleanQuery) SpanTermQuery(org.apache.lucene.queries.spans.SpanTermQuery) TermQuery(org.apache.lucene.search.TermQuery) SimpleQueryStringQueryParser(org.opensearch.index.search.SimpleQueryStringQueryParser) Query(org.apache.lucene.search.Query) SpanOrQuery(org.apache.lucene.queries.spans.SpanOrQuery) MatchNoDocsQuery(org.apache.lucene.search.MatchNoDocsQuery) SpanTermQuery(org.apache.lucene.queries.spans.SpanTermQuery) PhraseQuery(org.apache.lucene.search.PhraseQuery) PrefixQuery(org.apache.lucene.search.PrefixQuery) FuzzyQuery(org.apache.lucene.search.FuzzyQuery) SpanQuery(org.apache.lucene.queries.spans.SpanQuery) DisjunctionMaxQuery(org.apache.lucene.search.DisjunctionMaxQuery) TermQuery(org.apache.lucene.search.TermQuery) SynonymQuery(org.apache.lucene.search.SynonymQuery) BooleanQuery(org.apache.lucene.search.BooleanQuery) BoostQuery(org.apache.lucene.search.BoostQuery) SpanNearQuery(org.apache.lucene.queries.spans.SpanNearQuery) PhraseQuery(org.apache.lucene.search.PhraseQuery) MockSynonymAnalyzer(org.apache.lucene.tests.analysis.MockSynonymAnalyzer) Term(org.apache.lucene.index.Term) SpanOrQuery(org.apache.lucene.queries.spans.SpanOrQuery) BooleanClause(org.apache.lucene.search.BooleanClause) SpanTermQuery(org.apache.lucene.queries.spans.SpanTermQuery) SpanNearQuery(org.apache.lucene.queries.spans.SpanNearQuery) Settings(org.opensearch.common.settings.Settings)

Example 3 with MockSynonymAnalyzer

use of org.apache.lucene.tests.analysis.MockSynonymAnalyzer in project OpenSearch by opensearch-project.

the class MatchQueryBuilderTests method testMultiWordSynonymsPhrase.

public void testMultiWordSynonymsPhrase() throws Exception {
    final MatchQuery matchQuery = new MatchQuery(createShardContext());
    matchQuery.setAnalyzer(new MockSynonymAnalyzer());
    final Query actual = matchQuery.parse(Type.PHRASE, TEXT_FIELD_NAME, "guinea pig dogs");
    Query expected = SpanNearQuery.newOrderedNearQuery(TEXT_FIELD_NAME).addClause(new SpanOrQuery(new SpanQuery[] { SpanNearQuery.newOrderedNearQuery(TEXT_FIELD_NAME).addClause(new SpanTermQuery(new Term(TEXT_FIELD_NAME, "guinea"))).addClause(new SpanTermQuery(new Term(TEXT_FIELD_NAME, "pig"))).setSlop(0).build(), new SpanTermQuery(new Term(TEXT_FIELD_NAME, "cavy")) })).addClause(new SpanOrQuery(new SpanQuery[] { new SpanTermQuery(new Term(TEXT_FIELD_NAME, "dogs")), new SpanTermQuery(new Term(TEXT_FIELD_NAME, "dog")) })).build();
    assertEquals(expected, actual);
}
Also used : Query(org.apache.lucene.search.Query) SpanOrQuery(org.apache.lucene.queries.spans.SpanOrQuery) MatchNoDocsQuery(org.apache.lucene.search.MatchNoDocsQuery) SpanTermQuery(org.apache.lucene.queries.spans.SpanTermQuery) PhraseQuery(org.apache.lucene.search.PhraseQuery) ExtendedCommonTermsQuery(org.apache.lucene.queries.ExtendedCommonTermsQuery) PointRangeQuery(org.apache.lucene.search.PointRangeQuery) FuzzyQuery(org.apache.lucene.search.FuzzyQuery) MatchAllDocsQuery(org.apache.lucene.search.MatchAllDocsQuery) MultiPhrasePrefixQuery(org.opensearch.common.lucene.search.MultiPhrasePrefixQuery) SpanQuery(org.apache.lucene.queries.spans.SpanQuery) TermQuery(org.apache.lucene.search.TermQuery) SynonymQuery(org.apache.lucene.search.SynonymQuery) BooleanQuery(org.apache.lucene.search.BooleanQuery) ZeroTermsQuery(org.opensearch.index.search.MatchQuery.ZeroTermsQuery) SpanNearQuery(org.apache.lucene.queries.spans.SpanNearQuery) MatchQuery(org.opensearch.index.search.MatchQuery) SpanTermQuery(org.apache.lucene.queries.spans.SpanTermQuery) MatchQuery(org.opensearch.index.search.MatchQuery) MockSynonymAnalyzer(org.apache.lucene.tests.analysis.MockSynonymAnalyzer) Term(org.apache.lucene.index.Term) SpanOrQuery(org.apache.lucene.queries.spans.SpanOrQuery) SpanQuery(org.apache.lucene.queries.spans.SpanQuery)

Example 4 with MockSynonymAnalyzer

use of org.apache.lucene.tests.analysis.MockSynonymAnalyzer in project OpenSearch by opensearch-project.

the class MultiMatchQueryTests method testMultiMatchCrossFieldsWithSynonymsPhrase.

public void testMultiMatchCrossFieldsWithSynonymsPhrase() throws IOException {
    QueryShardContext queryShardContext = indexService.newQueryShardContext(randomInt(20), null, () -> {
        throw new UnsupportedOperationException();
    }, null);
    MultiMatchQuery parser = new MultiMatchQuery(queryShardContext);
    parser.setAnalyzer(new MockSynonymAnalyzer());
    Map<String, Float> fieldNames = new HashMap<>();
    fieldNames.put("name.first", 1.0f);
    fieldNames.put("name.last", 1.0f);
    Query query = parser.parse(MultiMatchQueryBuilder.Type.CROSS_FIELDS, fieldNames, "guinea pig", null);
    Term[] terms = new Term[2];
    terms[0] = new Term("name.first", "cavy");
    terms[1] = new Term("name.last", "cavy");
    float[] boosts = new float[2];
    Arrays.fill(boosts, 1.0f);
    List<Query> phraseDisjuncts = new ArrayList<>();
    phraseDisjuncts.add(new PhraseQuery.Builder().add(new Term("name.first", "guinea")).add(new Term("name.first", "pig")).build());
    phraseDisjuncts.add(new PhraseQuery.Builder().add(new Term("name.last", "guinea")).add(new Term("name.last", "pig")).build());
    BooleanQuery expected = new BooleanQuery.Builder().add(new BooleanQuery.Builder().add(new DisjunctionMaxQuery(phraseDisjuncts, 0.0f), BooleanClause.Occur.SHOULD).add(BlendedTermQuery.dismaxBlendedQuery(terms, boosts, 1.0f), BooleanClause.Occur.SHOULD).build(), BooleanClause.Occur.SHOULD).build();
    assertEquals(expected, query);
}
Also used : BooleanQuery(org.apache.lucene.search.BooleanQuery) Query(org.apache.lucene.search.Query) PhraseQuery(org.apache.lucene.search.PhraseQuery) BlendedTermQuery(org.apache.lucene.queries.BlendedTermQuery) QueryBuilders.multiMatchQuery(org.opensearch.index.query.QueryBuilders.multiMatchQuery) MatchAllDocsQuery(org.apache.lucene.search.MatchAllDocsQuery) DisjunctionMaxQuery(org.apache.lucene.search.DisjunctionMaxQuery) TermQuery(org.apache.lucene.search.TermQuery) SynonymQuery(org.apache.lucene.search.SynonymQuery) BooleanQuery(org.apache.lucene.search.BooleanQuery) BoostQuery(org.apache.lucene.search.BoostQuery) HashMap(java.util.HashMap) DisjunctionMaxQuery(org.apache.lucene.search.DisjunctionMaxQuery) MultiMatchQueryBuilder(org.opensearch.index.query.MultiMatchQueryBuilder) ArrayList(java.util.ArrayList) MockSynonymAnalyzer(org.apache.lucene.tests.analysis.MockSynonymAnalyzer) Term(org.apache.lucene.index.Term) QueryShardContext(org.opensearch.index.query.QueryShardContext)

Example 5 with MockSynonymAnalyzer

use of org.apache.lucene.tests.analysis.MockSynonymAnalyzer in project OpenSearch by opensearch-project.

the class MultiMatchQueryTests method testMultiMatchCrossFieldsWithSynonyms.

public void testMultiMatchCrossFieldsWithSynonyms() throws IOException {
    QueryShardContext queryShardContext = indexService.newQueryShardContext(randomInt(20), null, () -> {
        throw new UnsupportedOperationException();
    }, null);
    MultiMatchQuery parser = new MultiMatchQuery(queryShardContext);
    parser.setAnalyzer(new MockSynonymAnalyzer());
    Map<String, Float> fieldNames = new HashMap<>();
    fieldNames.put("name.first", 1.0f);
    // check that synonym query is used for a single field
    Query parsedQuery = parser.parse(MultiMatchQueryBuilder.Type.CROSS_FIELDS, fieldNames, "dogs", null);
    Query expectedQuery = new SynonymQuery.Builder("name.first").addTerm(new Term("name.first", "dog")).addTerm(new Term("name.first", "dogs")).build();
    assertThat(parsedQuery, equalTo(expectedQuery));
    // check that blended term query is used for multiple fields
    fieldNames.put("name.last", 1.0f);
    parsedQuery = parser.parse(MultiMatchQueryBuilder.Type.CROSS_FIELDS, fieldNames, "dogs", null);
    Term[] terms = new Term[4];
    terms[0] = new Term("name.first", "dog");
    terms[1] = new Term("name.first", "dogs");
    terms[2] = new Term("name.last", "dog");
    terms[3] = new Term("name.last", "dogs");
    float[] boosts = new float[4];
    Arrays.fill(boosts, 1.0f);
    expectedQuery = BlendedTermQuery.dismaxBlendedQuery(terms, boosts, 1.0f);
    assertThat(parsedQuery, equalTo(expectedQuery));
}
Also used : Query(org.apache.lucene.search.Query) PhraseQuery(org.apache.lucene.search.PhraseQuery) BlendedTermQuery(org.apache.lucene.queries.BlendedTermQuery) QueryBuilders.multiMatchQuery(org.opensearch.index.query.QueryBuilders.multiMatchQuery) MatchAllDocsQuery(org.apache.lucene.search.MatchAllDocsQuery) DisjunctionMaxQuery(org.apache.lucene.search.DisjunctionMaxQuery) TermQuery(org.apache.lucene.search.TermQuery) SynonymQuery(org.apache.lucene.search.SynonymQuery) BooleanQuery(org.apache.lucene.search.BooleanQuery) BoostQuery(org.apache.lucene.search.BoostQuery) HashMap(java.util.HashMap) SynonymQuery(org.apache.lucene.search.SynonymQuery) MockSynonymAnalyzer(org.apache.lucene.tests.analysis.MockSynonymAnalyzer) Term(org.apache.lucene.index.Term) QueryShardContext(org.opensearch.index.query.QueryShardContext)

Aggregations

Term (org.apache.lucene.index.Term)11 TermQuery (org.apache.lucene.search.TermQuery)11 MockSynonymAnalyzer (org.apache.lucene.tests.analysis.MockSynonymAnalyzer)11 BooleanQuery (org.apache.lucene.search.BooleanQuery)10 Query (org.apache.lucene.search.Query)10 SynonymQuery (org.apache.lucene.search.SynonymQuery)10 PhraseQuery (org.apache.lucene.search.PhraseQuery)9 SpanTermQuery (org.apache.lucene.queries.spans.SpanTermQuery)8 SpanNearQuery (org.apache.lucene.queries.spans.SpanNearQuery)7 SpanOrQuery (org.apache.lucene.queries.spans.SpanOrQuery)7 FuzzyQuery (org.apache.lucene.search.FuzzyQuery)6 MatchAllDocsQuery (org.apache.lucene.search.MatchAllDocsQuery)6 MatchQuery (org.opensearch.index.search.MatchQuery)6 MatchNoDocsQuery (org.apache.lucene.search.MatchNoDocsQuery)5 MultiPhrasePrefixQuery (org.opensearch.common.lucene.search.MultiPhrasePrefixQuery)5 HashMap (java.util.HashMap)4 SpanQuery (org.apache.lucene.queries.spans.SpanQuery)4 BooleanClause (org.apache.lucene.search.BooleanClause)4 BoostQuery (org.apache.lucene.search.BoostQuery)3 DisjunctionMaxQuery (org.apache.lucene.search.DisjunctionMaxQuery)3