Search in sources :

Example 6 with SpanOrQuery

use of org.apache.lucene.queries.spans.SpanOrQuery in project OpenSearch by opensearch-project.

the class SpanOrQueryBuilderTests method doAssertLuceneQuery.

@Override
protected void doAssertLuceneQuery(SpanOrQueryBuilder queryBuilder, Query query, QueryShardContext context) throws IOException {
    assertThat(query, instanceOf(SpanOrQuery.class));
    SpanOrQuery spanOrQuery = (SpanOrQuery) query;
    assertThat(spanOrQuery.getClauses().length, equalTo(queryBuilder.clauses().size()));
    Iterator<SpanQueryBuilder> spanQueryBuilderIterator = queryBuilder.clauses().iterator();
    for (SpanQuery spanQuery : spanOrQuery.getClauses()) {
        assertThat(spanQuery, equalTo(spanQueryBuilderIterator.next().toQuery(context)));
    }
}
Also used : SpanOrQuery(org.apache.lucene.queries.spans.SpanOrQuery) SpanQuery(org.apache.lucene.queries.spans.SpanQuery)

Example 7 with SpanOrQuery

use of org.apache.lucene.queries.spans.SpanOrQuery in project OpenSearch by opensearch-project.

the class SpanMatchNoDocsQueryTests method testQuery.

public void testQuery() throws Exception {
    Directory dir = newDirectory();
    Analyzer analyzer = new MockAnalyzer(random());
    IndexWriter iw = new IndexWriter(dir, newIndexWriterConfig(analyzer).setMaxBufferedDocs(2).setMergePolicy(newLogMergePolicy()));
    addDoc("one", iw);
    addDoc("two", iw);
    addDoc("three", iw);
    IndexReader ir = DirectoryReader.open(iw);
    IndexSearcher searcher = new IndexSearcher(ir);
    Query query = new SpanMatchNoDocsQuery("unknown", "field not found");
    assertEquals(searcher.count(query), 0);
    ScoreDoc[] hits;
    hits = searcher.search(query, 1000).scoreDocs;
    assertEquals(0, hits.length);
    assertEquals(query.toString(), "SpanMatchNoDocsQuery(\"field not found\")");
    SpanOrQuery orQuery = new SpanOrQuery(new SpanMatchNoDocsQuery("unknown", "field not found"), new SpanTermQuery(new Term("unknown", "one")));
    assertEquals(searcher.count(orQuery), 0);
    hits = searcher.search(orQuery, 1000).scoreDocs;
    assertEquals(0, hits.length);
    orQuery = new SpanOrQuery(new SpanMatchNoDocsQuery("key", "a good reason"), new SpanTermQuery(new Term("key", "one")));
    assertEquals(searcher.count(orQuery), 1);
    hits = searcher.search(orQuery, 1000).scoreDocs;
    assertEquals(1, hits.length);
    Query rewrite = orQuery.rewrite(ir);
    assertEquals(rewrite, orQuery);
    SpanNearQuery nearQuery = new SpanNearQuery(new SpanQuery[] { new SpanMatchNoDocsQuery("same", ""), new SpanMatchNoDocsQuery("same", "") }, 0, true);
    assertEquals(searcher.count(nearQuery), 0);
    hits = searcher.search(nearQuery, 1000).scoreDocs;
    assertEquals(0, hits.length);
    rewrite = nearQuery.rewrite(ir);
    assertEquals(rewrite, nearQuery);
    iw.close();
    ir.close();
    dir.close();
}
Also used : IndexSearcher(org.apache.lucene.search.IndexSearcher) Query(org.apache.lucene.search.Query) SpanOrQuery(org.apache.lucene.queries.spans.SpanOrQuery) SpanTermQuery(org.apache.lucene.queries.spans.SpanTermQuery) SpanMatchNoDocsQuery(org.apache.lucene.queries.SpanMatchNoDocsQuery) SpanQuery(org.apache.lucene.queries.spans.SpanQuery) SpanNearQuery(org.apache.lucene.queries.spans.SpanNearQuery) Term(org.apache.lucene.index.Term) MockAnalyzer(org.apache.lucene.tests.analysis.MockAnalyzer) Analyzer(org.apache.lucene.analysis.Analyzer) SpanOrQuery(org.apache.lucene.queries.spans.SpanOrQuery) ScoreDoc(org.apache.lucene.search.ScoreDoc) MockAnalyzer(org.apache.lucene.tests.analysis.MockAnalyzer) IndexWriter(org.apache.lucene.index.IndexWriter) SpanTermQuery(org.apache.lucene.queries.spans.SpanTermQuery) IndexReader(org.apache.lucene.index.IndexReader) SpanMatchNoDocsQuery(org.apache.lucene.queries.SpanMatchNoDocsQuery) SpanNearQuery(org.apache.lucene.queries.spans.SpanNearQuery) Directory(org.apache.lucene.store.Directory)

Example 8 with SpanOrQuery

use of org.apache.lucene.queries.spans.SpanOrQuery 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 9 with SpanOrQuery

use of org.apache.lucene.queries.spans.SpanOrQuery in project OpenSearch by opensearch-project.

the class QueryStringQueryBuilderTests method testToQueryWithGraph.

public void testToQueryWithGraph() throws Exception {
    for (Operator op : Operator.values()) {
        BooleanClause.Occur defaultOp = op.toBooleanClauseOccur();
        QueryStringQueryParser queryParser = new QueryStringQueryParser(createShardContext(), TEXT_FIELD_NAME);
        queryParser.setAnalyzeWildcard(true);
        queryParser.setMultiTermRewriteMethod(MultiTermQuery.CONSTANT_SCORE_REWRITE);
        queryParser.setDefaultOperator(op.toQueryParserOperator());
        queryParser.setAnalyzeWildcard(true);
        queryParser.setMultiTermRewriteMethod(MultiTermQuery.CONSTANT_SCORE_REWRITE);
        queryParser.setDefaultOperator(op.toQueryParserOperator());
        queryParser.setForceAnalyzer(new MockSynonymAnalyzer());
        queryParser.setAutoGenerateMultiTermSynonymsPhraseQuery(false);
        // simple multi-term
        Query query = queryParser.parse("guinea pig");
        Query guineaPig = new BooleanQuery.Builder().add(new TermQuery(new Term(TEXT_FIELD_NAME, "guinea")), Occur.MUST).add(new TermQuery(new Term(TEXT_FIELD_NAME, "pig")), Occur.MUST).build();
        TermQuery cavy = new TermQuery(new Term(TEXT_FIELD_NAME, "cavy"));
        Query expectedQuery = new BooleanQuery.Builder().add(new BooleanQuery.Builder().add(guineaPig, Occur.SHOULD).add(cavy, Occur.SHOULD).build(), defaultOp).build();
        assertThat(query, Matchers.equalTo(expectedQuery));
        queryParser.setAutoGenerateMultiTermSynonymsPhraseQuery(true);
        // simple multi-term with phrase query
        query = queryParser.parse("guinea pig");
        expectedQuery = new BooleanQuery.Builder().add(new BooleanQuery.Builder().add(new PhraseQuery.Builder().add(new Term(TEXT_FIELD_NAME, "guinea")).add(new Term(TEXT_FIELD_NAME, "pig")).build(), Occur.SHOULD).add(new TermQuery(new Term(TEXT_FIELD_NAME, "cavy")), Occur.SHOULD).build(), defaultOp).build();
        assertThat(query, Matchers.equalTo(expectedQuery));
        queryParser.setAutoGenerateMultiTermSynonymsPhraseQuery(false);
        // simple with additional tokens
        query = queryParser.parse("that guinea pig smells");
        expectedQuery = new BooleanQuery.Builder().add(new TermQuery(new Term(TEXT_FIELD_NAME, "that")), defaultOp).add(new BooleanQuery.Builder().add(guineaPig, Occur.SHOULD).add(cavy, Occur.SHOULD).build(), defaultOp).add(new TermQuery(new Term(TEXT_FIELD_NAME, "smells")), defaultOp).build();
        assertThat(query, Matchers.equalTo(expectedQuery));
        // complex
        query = queryParser.parse("+that -(guinea pig) +smells");
        expectedQuery = new BooleanQuery.Builder().add(new TermQuery(new Term(TEXT_FIELD_NAME, "that")), Occur.MUST).add(new BooleanQuery.Builder().add(new BooleanQuery.Builder().add(guineaPig, Occur.SHOULD).add(cavy, Occur.SHOULD).build(), defaultOp).build(), Occur.MUST_NOT).add(new TermQuery(new Term(TEXT_FIELD_NAME, "smells")), Occur.MUST).build();
        assertThat(query, Matchers.equalTo(expectedQuery));
        // no parent should cause guinea and pig to be treated as separate tokens
        query = queryParser.parse("+that -guinea pig +smells");
        expectedQuery = new BooleanQuery.Builder().add(new TermQuery(new Term(TEXT_FIELD_NAME, "that")), BooleanClause.Occur.MUST).add(new TermQuery(new Term(TEXT_FIELD_NAME, "guinea")), BooleanClause.Occur.MUST_NOT).add(new TermQuery(new Term(TEXT_FIELD_NAME, "pig")), defaultOp).add(new TermQuery(new Term(TEXT_FIELD_NAME, "smells")), BooleanClause.Occur.MUST).build();
        assertThat(query, Matchers.equalTo(expectedQuery));
        // span query
        query = queryParser.parse("\"that guinea pig smells\"");
        expectedQuery = new SpanNearQuery.Builder(TEXT_FIELD_NAME, true).addClause(new SpanTermQuery(new Term(TEXT_FIELD_NAME, "that"))).addClause(new SpanOrQuery(new SpanNearQuery.Builder(TEXT_FIELD_NAME, true).addClause(new SpanTermQuery(new Term(TEXT_FIELD_NAME, "guinea"))).addClause(new SpanTermQuery(new Term(TEXT_FIELD_NAME, "pig"))).build(), new SpanTermQuery(new Term(TEXT_FIELD_NAME, "cavy")))).addClause(new SpanTermQuery(new Term(TEXT_FIELD_NAME, "smells"))).build();
        assertThat(query, Matchers.equalTo(expectedQuery));
        // span query with slop
        query = queryParser.parse("\"that guinea pig smells\"~2");
        PhraseQuery pq1 = new PhraseQuery.Builder().add(new Term(TEXT_FIELD_NAME, "that")).add(new Term(TEXT_FIELD_NAME, "guinea")).add(new Term(TEXT_FIELD_NAME, "pig")).add(new Term(TEXT_FIELD_NAME, "smells")).setSlop(2).build();
        PhraseQuery pq2 = new PhraseQuery.Builder().add(new Term(TEXT_FIELD_NAME, "that")).add(new Term(TEXT_FIELD_NAME, "cavy")).add(new Term(TEXT_FIELD_NAME, "smells")).setSlop(2).build();
        expectedQuery = new BooleanQuery.Builder().add(pq1, Occur.SHOULD).add(pq2, Occur.SHOULD).build();
        assertThat(query, Matchers.equalTo(expectedQuery));
    }
}
Also used : BooleanQuery(org.apache.lucene.search.BooleanQuery) SpanTermQuery(org.apache.lucene.queries.spans.SpanTermQuery) BlendedTermQuery(org.apache.lucene.queries.BlendedTermQuery) MultiTermQuery(org.apache.lucene.search.MultiTermQuery) TermQuery(org.apache.lucene.search.TermQuery) 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) QueryBuilders.queryStringQuery(org.opensearch.index.query.QueryBuilders.queryStringQuery) PhraseQuery(org.apache.lucene.search.PhraseQuery) IndexOrDocValuesQuery(org.apache.lucene.search.IndexOrDocValuesQuery) BlendedTermQuery(org.apache.lucene.queries.BlendedTermQuery) RegexpQuery(org.apache.lucene.search.RegexpQuery) MultiTermQuery(org.apache.lucene.search.MultiTermQuery) PrefixQuery(org.apache.lucene.search.PrefixQuery) FuzzyQuery(org.apache.lucene.search.FuzzyQuery) MatchAllDocsQuery(org.apache.lucene.search.MatchAllDocsQuery) WildcardQuery(org.apache.lucene.search.WildcardQuery) DisjunctionMaxQuery(org.apache.lucene.search.DisjunctionMaxQuery) SpanNearQuery(org.apache.lucene.queries.spans.SpanNearQuery) AutomatonQuery(org.apache.lucene.search.AutomatonQuery) OpenSearchAssertions.assertBooleanSubQuery(org.opensearch.test.hamcrest.OpenSearchAssertions.assertBooleanSubQuery) ConstantScoreQuery(org.apache.lucene.search.ConstantScoreQuery) TermQuery(org.apache.lucene.search.TermQuery) NormsFieldExistsQuery(org.apache.lucene.search.NormsFieldExistsQuery) SynonymQuery(org.apache.lucene.search.SynonymQuery) BooleanQuery(org.apache.lucene.search.BooleanQuery) BoostQuery(org.apache.lucene.search.BoostQuery) TermRangeQuery(org.apache.lucene.search.TermRangeQuery) PhraseQuery(org.apache.lucene.search.PhraseQuery) XContentFactory.jsonBuilder(org.opensearch.common.xcontent.XContentFactory.jsonBuilder) AbstractQueryBuilder.parseInnerQueryBuilder(org.opensearch.index.query.AbstractQueryBuilder.parseInnerQueryBuilder) XContentBuilder(org.opensearch.common.xcontent.XContentBuilder) Occur(org.apache.lucene.search.BooleanClause.Occur) 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) QueryStringQueryParser(org.opensearch.index.search.QueryStringQueryParser) SpanNearQuery(org.apache.lucene.queries.spans.SpanNearQuery)

Example 10 with SpanOrQuery

use of org.apache.lucene.queries.spans.SpanOrQuery in project OpenSearch by opensearch-project.

the class TextFieldMapperTests method testFastPhrasePrefixes.

public void testFastPhrasePrefixes() throws IOException {
    MapperService mapperService = createMapperService(mapping(b -> {
        b.startObject("field");
        {
            b.field("type", "text");
            b.field("analyzer", "my_stop_analyzer");
            b.startObject("index_prefixes").field("min_chars", 2).field("max_chars", 10).endObject();
        }
        b.endObject();
        b.startObject("synfield");
        {
            b.field("type", "text");
            // "standard" will be replaced with MockSynonymAnalyzer
            b.field("analyzer", "standard");
            b.field("index_phrases", true);
            b.startObject("index_prefixes").field("min_chars", 2).field("max_chars", 10).endObject();
        }
        b.endObject();
    }));
    QueryShardContext queryShardContext = createQueryShardContext(mapperService);
    {
        Query q = new MatchPhrasePrefixQueryBuilder("field", "two words").toQuery(queryShardContext);
        Query expected = new SpanNearQuery.Builder("field", true).addClause(new SpanTermQuery(new Term("field", "two"))).addClause(new FieldMaskingSpanQuery(new SpanTermQuery(new Term("field._index_prefix", "words")), "field")).build();
        assertThat(q, equalTo(expected));
    }
    {
        Query q = new MatchPhrasePrefixQueryBuilder("field", "three words here").toQuery(queryShardContext);
        Query expected = new SpanNearQuery.Builder("field", true).addClause(new SpanTermQuery(new Term("field", "three"))).addClause(new SpanTermQuery(new Term("field", "words"))).addClause(new FieldMaskingSpanQuery(new SpanTermQuery(new Term("field._index_prefix", "here")), "field")).build();
        assertThat(q, equalTo(expected));
    }
    {
        Query q = new MatchPhrasePrefixQueryBuilder("field", "two words").slop(1).toQuery(queryShardContext);
        MultiPhrasePrefixQuery mpq = new MultiPhrasePrefixQuery("field");
        mpq.setSlop(1);
        mpq.add(new Term("field", "two"));
        mpq.add(new Term("field", "words"));
        assertThat(q, equalTo(mpq));
    }
    {
        Query q = new MatchPhrasePrefixQueryBuilder("field", "singleton").toQuery(queryShardContext);
        assertThat(q, is(new SynonymQuery.Builder("field._index_prefix").addTerm(new Term("field._index_prefix", "singleton")).build()));
    }
    {
        Query q = new MatchPhrasePrefixQueryBuilder("field", "sparkle a stopword").toQuery(queryShardContext);
        Query expected = new SpanNearQuery.Builder("field", true).addClause(new SpanTermQuery(new Term("field", "sparkle"))).addGap(1).addClause(new FieldMaskingSpanQuery(new SpanTermQuery(new Term("field._index_prefix", "stopword")), "field")).build();
        assertThat(q, equalTo(expected));
    }
    {
        MatchQuery matchQuery = new MatchQuery(queryShardContext);
        matchQuery.setAnalyzer(new MockSynonymAnalyzer());
        Query q = matchQuery.parse(MatchQuery.Type.PHRASE_PREFIX, "synfield", "motor dogs");
        Query expected = new SpanNearQuery.Builder("synfield", true).addClause(new SpanTermQuery(new Term("synfield", "motor"))).addClause(new SpanOrQuery(new FieldMaskingSpanQuery(new SpanTermQuery(new Term("synfield._index_prefix", "dogs")), "synfield"), new FieldMaskingSpanQuery(new SpanTermQuery(new Term("synfield._index_prefix", "dog")), "synfield"))).build();
        assertThat(q, equalTo(expected));
    }
    {
        MatchQuery matchQuery = new MatchQuery(queryShardContext);
        matchQuery.setPhraseSlop(1);
        matchQuery.setAnalyzer(new MockSynonymAnalyzer());
        Query q = matchQuery.parse(MatchQuery.Type.PHRASE_PREFIX, "synfield", "two dogs");
        MultiPhrasePrefixQuery mpq = new MultiPhrasePrefixQuery("synfield");
        mpq.setSlop(1);
        mpq.add(new Term("synfield", "two"));
        mpq.add(new Term[] { new Term("synfield", "dogs"), new Term("synfield", "dog") });
        assertThat(q, equalTo(mpq));
    }
    {
        Query q = new MatchPhrasePrefixQueryBuilder("field", "motor d").toQuery(queryShardContext);
        MultiPhrasePrefixQuery mpq = new MultiPhrasePrefixQuery("field");
        mpq.add(new Term("field", "motor"));
        mpq.add(new Term("field", "d"));
        assertThat(q, equalTo(mpq));
    }
}
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) MatchPhrasePrefixQueryBuilder(org.opensearch.index.query.MatchPhrasePrefixQueryBuilder) 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) SynonymQuery(org.apache.lucene.search.SynonymQuery) MatchPhraseQueryBuilder(org.opensearch.index.query.MatchPhraseQueryBuilder) MatchPhrasePrefixQueryBuilder(org.opensearch.index.query.MatchPhrasePrefixQueryBuilder) XContentBuilder(org.opensearch.common.xcontent.XContentBuilder) MockSynonymAnalyzer(org.apache.lucene.tests.analysis.MockSynonymAnalyzer) Term(org.apache.lucene.index.Term) SpanOrQuery(org.apache.lucene.queries.spans.SpanOrQuery) SpanTermQuery(org.apache.lucene.queries.spans.SpanTermQuery) FieldMaskingSpanQuery(org.apache.lucene.queries.spans.FieldMaskingSpanQuery) QueryShardContext(org.opensearch.index.query.QueryShardContext) MatchQuery(org.opensearch.index.search.MatchQuery) MultiPhrasePrefixQuery(org.opensearch.common.lucene.search.MultiPhrasePrefixQuery) SpanNearQuery(org.apache.lucene.queries.spans.SpanNearQuery)

Aggregations

SpanOrQuery (org.apache.lucene.queries.spans.SpanOrQuery)12 SpanTermQuery (org.apache.lucene.queries.spans.SpanTermQuery)10 Term (org.apache.lucene.index.Term)9 SpanNearQuery (org.apache.lucene.queries.spans.SpanNearQuery)8 SpanQuery (org.apache.lucene.queries.spans.SpanQuery)8 Query (org.apache.lucene.search.Query)7 BooleanQuery (org.apache.lucene.search.BooleanQuery)5 PhraseQuery (org.apache.lucene.search.PhraseQuery)5 SynonymQuery (org.apache.lucene.search.SynonymQuery)5 TermQuery (org.apache.lucene.search.TermQuery)5 BooleanClause (org.apache.lucene.search.BooleanClause)4 PrefixQuery (org.apache.lucene.search.PrefixQuery)4 MockSynonymAnalyzer (org.apache.lucene.tests.analysis.MockSynonymAnalyzer)4 MultiPhrasePrefixQuery (org.opensearch.common.lucene.search.MultiPhrasePrefixQuery)4 Analyzer (org.apache.lucene.analysis.Analyzer)3 MultiTermQuery (org.apache.lucene.search.MultiTermQuery)3 BytesRef (org.apache.lucene.util.BytesRef)3 XContentBuilder (org.opensearch.common.xcontent.XContentBuilder)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2