Search in sources :

Example 26 with Query

use of org.apache.lucene.search.Query in project elasticsearch by elastic.

the class PercolateQueryBuilder method createMultiDocumentSearcher.

static IndexSearcher createMultiDocumentSearcher(Analyzer analyzer, ParsedDocument doc) {
    RAMDirectory ramDirectory = new RAMDirectory();
    try (IndexWriter indexWriter = new IndexWriter(ramDirectory, new IndexWriterConfig(analyzer))) {
        indexWriter.addDocuments(doc.docs());
        indexWriter.commit();
        DirectoryReader directoryReader = DirectoryReader.open(ramDirectory);
        assert directoryReader.leaves().size() == 1 : "Expected single leaf, but got [" + directoryReader.leaves().size() + "]";
        final IndexSearcher slowSearcher = new IndexSearcher(directoryReader) {

            @Override
            public Weight createNormalizedWeight(Query query, boolean needsScores) throws IOException {
                BooleanQuery.Builder bq = new BooleanQuery.Builder();
                bq.add(query, BooleanClause.Occur.MUST);
                bq.add(Queries.newNestedFilter(), BooleanClause.Occur.MUST_NOT);
                return super.createNormalizedWeight(bq.build(), needsScores);
            }
        };
        slowSearcher.setQueryCache(null);
        return slowSearcher;
    } catch (IOException e) {
        throw new ElasticsearchException("Failed to create index for percolator with nested document ", e);
    }
}
Also used : IndexSearcher(org.apache.lucene.search.IndexSearcher) BooleanQuery(org.apache.lucene.search.BooleanQuery) Query(org.apache.lucene.search.Query) PercolatorFieldMapper.parseQuery(org.elasticsearch.percolator.PercolatorFieldMapper.parseQuery) BooleanQuery(org.apache.lucene.search.BooleanQuery) IndexWriter(org.apache.lucene.index.IndexWriter) DirectoryReader(org.apache.lucene.index.DirectoryReader) XContentBuilder(org.elasticsearch.common.xcontent.XContentBuilder) QueryBuilder(org.elasticsearch.index.query.QueryBuilder) AbstractQueryBuilder(org.elasticsearch.index.query.AbstractQueryBuilder) IOException(java.io.IOException) ElasticsearchException(org.elasticsearch.ElasticsearchException) RAMDirectory(org.apache.lucene.store.RAMDirectory) IndexWriterConfig(org.apache.lucene.index.IndexWriterConfig)

Example 27 with Query

use of org.apache.lucene.search.Query in project elasticsearch by elastic.

the class CandidateQueryTests method testDuel.

public void testDuel() throws Exception {
    List<Function<String, Query>> queryFunctions = new ArrayList<>();
    queryFunctions.add((id) -> new PrefixQuery(new Term("field", id)));
    queryFunctions.add((id) -> new WildcardQuery(new Term("field", id + "*")));
    queryFunctions.add((id) -> new CustomQuery(new Term("field", id)));
    queryFunctions.add((id) -> new SpanTermQuery(new Term("field", id)));
    queryFunctions.add((id) -> new TermQuery(new Term("field", id)));
    queryFunctions.add((id) -> {
        BooleanQuery.Builder builder = new BooleanQuery.Builder();
        return builder.build();
    });
    queryFunctions.add((id) -> {
        BooleanQuery.Builder builder = new BooleanQuery.Builder();
        builder.add(new TermQuery(new Term("field", id)), BooleanClause.Occur.MUST);
        if (randomBoolean()) {
            builder.add(new MatchNoDocsQuery("no reason"), BooleanClause.Occur.MUST_NOT);
        }
        if (randomBoolean()) {
            builder.add(new CustomQuery(new Term("field", id)), BooleanClause.Occur.MUST);
        }
        return builder.build();
    });
    queryFunctions.add((id) -> {
        BooleanQuery.Builder builder = new BooleanQuery.Builder();
        builder.add(new TermQuery(new Term("field", id)), BooleanClause.Occur.SHOULD);
        if (randomBoolean()) {
            builder.add(new MatchNoDocsQuery("no reason"), BooleanClause.Occur.MUST_NOT);
        }
        if (randomBoolean()) {
            builder.add(new CustomQuery(new Term("field", id)), BooleanClause.Occur.SHOULD);
        }
        return builder.build();
    });
    queryFunctions.add((id) -> {
        BooleanQuery.Builder builder = new BooleanQuery.Builder();
        builder.add(new MatchAllDocsQuery(), BooleanClause.Occur.MUST);
        builder.add(new MatchAllDocsQuery(), BooleanClause.Occur.MUST);
        if (randomBoolean()) {
            builder.add(new MatchNoDocsQuery("no reason"), BooleanClause.Occur.MUST_NOT);
        }
        return builder.build();
    });
    queryFunctions.add((id) -> {
        BooleanQuery.Builder builder = new BooleanQuery.Builder();
        builder.add(new MatchAllDocsQuery(), BooleanClause.Occur.SHOULD);
        builder.add(new MatchAllDocsQuery(), BooleanClause.Occur.SHOULD);
        if (randomBoolean()) {
            builder.add(new MatchNoDocsQuery("no reason"), BooleanClause.Occur.MUST_NOT);
        }
        return builder.build();
    });
    queryFunctions.add((id) -> {
        BooleanQuery.Builder builder = new BooleanQuery.Builder();
        builder.setMinimumNumberShouldMatch(randomIntBetween(0, 4));
        builder.add(new TermQuery(new Term("field", id)), BooleanClause.Occur.SHOULD);
        builder.add(new CustomQuery(new Term("field", id)), BooleanClause.Occur.SHOULD);
        return builder.build();
    });
    queryFunctions.add((id) -> new MatchAllDocsQuery());
    queryFunctions.add((id) -> new MatchNoDocsQuery("no reason at all"));
    int numDocs = randomIntBetween(queryFunctions.size(), queryFunctions.size() * 3);
    List<ParseContext.Document> documents = new ArrayList<>();
    for (int i = 0; i < numDocs; i++) {
        String id = Integer.toString(i);
        Query query = queryFunctions.get(i % queryFunctions.size()).apply(id);
        addQuery(query, documents);
    }
    indexWriter.addDocuments(documents);
    indexWriter.close();
    directoryReader = DirectoryReader.open(directory);
    IndexSearcher shardSearcher = newSearcher(directoryReader);
    // Disable query cache, because ControlQuery cannot be cached...
    shardSearcher.setQueryCache(null);
    for (int i = 0; i < numDocs; i++) {
        String id = Integer.toString(i);
        Iterable<? extends IndexableField> doc = Collections.singleton(new StringField("field", id, Field.Store.NO));
        MemoryIndex memoryIndex = MemoryIndex.fromDocument(doc, new WhitespaceAnalyzer());
        duelRun(queryStore, memoryIndex, shardSearcher);
    }
    Iterable<? extends IndexableField> doc = Collections.singleton(new StringField("field", "value", Field.Store.NO));
    MemoryIndex memoryIndex = MemoryIndex.fromDocument(doc, new WhitespaceAnalyzer());
    duelRun(queryStore, memoryIndex, shardSearcher);
    // Empty percolator doc:
    memoryIndex = new MemoryIndex();
    duelRun(queryStore, memoryIndex, shardSearcher);
}
Also used : IndexSearcher(org.apache.lucene.search.IndexSearcher) WhitespaceAnalyzer(org.apache.lucene.analysis.core.WhitespaceAnalyzer) WildcardQuery(org.apache.lucene.search.WildcardQuery) BlendedTermQuery(org.apache.lucene.queries.BlendedTermQuery) SpanTermQuery(org.apache.lucene.search.spans.SpanTermQuery) TermQuery(org.apache.lucene.search.TermQuery) BooleanQuery(org.apache.lucene.search.BooleanQuery) Query(org.apache.lucene.search.Query) MatchNoDocsQuery(org.apache.lucene.search.MatchNoDocsQuery) CommonTermsQuery(org.apache.lucene.queries.CommonTermsQuery) BlendedTermQuery(org.apache.lucene.queries.BlendedTermQuery) PrefixQuery(org.apache.lucene.search.PrefixQuery) MatchAllDocsQuery(org.apache.lucene.search.MatchAllDocsQuery) WildcardQuery(org.apache.lucene.search.WildcardQuery) SpanTermQuery(org.apache.lucene.search.spans.SpanTermQuery) SpanNotQuery(org.apache.lucene.search.spans.SpanNotQuery) ConstantScoreQuery(org.apache.lucene.search.ConstantScoreQuery) SpanNearQuery(org.apache.lucene.search.spans.SpanNearQuery) TermQuery(org.apache.lucene.search.TermQuery) BooleanQuery(org.apache.lucene.search.BooleanQuery) SpanOrQuery(org.apache.lucene.search.spans.SpanOrQuery) MatchNoDocsQuery(org.apache.lucene.search.MatchNoDocsQuery) ArrayList(java.util.ArrayList) Term(org.apache.lucene.index.Term) MatchAllDocsQuery(org.apache.lucene.search.MatchAllDocsQuery) Document(org.apache.lucene.document.Document) LongPoint(org.apache.lucene.document.LongPoint) CheckedFunction(org.elasticsearch.common.CheckedFunction) Function(java.util.function.Function) MemoryIndex(org.apache.lucene.index.memory.MemoryIndex) PrefixQuery(org.apache.lucene.search.PrefixQuery) SpanTermQuery(org.apache.lucene.search.spans.SpanTermQuery) StringField(org.apache.lucene.document.StringField)

Example 28 with Query

use of org.apache.lucene.search.Query in project elasticsearch by elastic.

the class PercolateQueryBuilderTests method testCreateMultiDocumentSearcher.

public void testCreateMultiDocumentSearcher() throws Exception {
    int numDocs = randomIntBetween(2, 8);
    List<ParseContext.Document> docs = new ArrayList<>(numDocs);
    for (int i = 0; i < numDocs; i++) {
        docs.add(new ParseContext.Document());
    }
    Analyzer analyzer = new WhitespaceAnalyzer();
    ParsedDocument parsedDocument = new ParsedDocument(null, null, "_id", "_type", null, docs, null, null, null);
    IndexSearcher indexSearcher = PercolateQueryBuilder.createMultiDocumentSearcher(analyzer, parsedDocument);
    assertThat(indexSearcher.getIndexReader().numDocs(), equalTo(numDocs));
    // ensure that any query get modified so that the nested docs are never included as hits:
    Query query = new MatchAllDocsQuery();
    BooleanQuery result = (BooleanQuery) indexSearcher.createNormalizedWeight(query, true).getQuery();
    assertThat(result.clauses().size(), equalTo(2));
    assertThat(result.clauses().get(0).getQuery(), sameInstance(query));
    assertThat(result.clauses().get(0).getOccur(), equalTo(BooleanClause.Occur.MUST));
    assertThat(result.clauses().get(1).getOccur(), equalTo(BooleanClause.Occur.MUST_NOT));
}
Also used : WhitespaceAnalyzer(org.apache.lucene.analysis.core.WhitespaceAnalyzer) IndexSearcher(org.apache.lucene.search.IndexSearcher) BooleanQuery(org.apache.lucene.search.BooleanQuery) Query(org.apache.lucene.search.Query) MatchAllDocsQuery(org.apache.lucene.search.MatchAllDocsQuery) BooleanQuery(org.apache.lucene.search.BooleanQuery) ArrayList(java.util.ArrayList) ParsedDocument(org.elasticsearch.index.mapper.ParsedDocument) WhitespaceAnalyzer(org.apache.lucene.analysis.core.WhitespaceAnalyzer) Analyzer(org.apache.lucene.analysis.Analyzer) MatchAllDocsQuery(org.apache.lucene.search.MatchAllDocsQuery) ParsedDocument(org.elasticsearch.index.mapper.ParsedDocument) ParseContext(org.elasticsearch.index.mapper.ParseContext)

Example 29 with Query

use of org.apache.lucene.search.Query in project elasticsearch by elastic.

the class PercolateQueryTests method testPercolateQuery.

public void testPercolateQuery() throws Exception {
    List<Iterable<? extends IndexableField>> docs = new ArrayList<>();
    List<Query> queries = new ArrayList<>();
    PercolateQuery.QueryStore queryStore = ctx -> queries::get;
    queries.add(new TermQuery(new Term("field", "fox")));
    docs.add(Collections.singleton(new StringField("select", "a", Field.Store.NO)));
    SpanNearQuery.Builder snp = new SpanNearQuery.Builder("field", true);
    snp.addClause(new SpanTermQuery(new Term("field", "jumps")));
    snp.addClause(new SpanTermQuery(new Term("field", "lazy")));
    snp.addClause(new SpanTermQuery(new Term("field", "dog")));
    snp.setSlop(2);
    queries.add(snp.build());
    docs.add(Collections.singleton(new StringField("select", "b", Field.Store.NO)));
    PhraseQuery.Builder pq1 = new PhraseQuery.Builder();
    pq1.add(new Term("field", "quick"));
    pq1.add(new Term("field", "brown"));
    pq1.add(new Term("field", "jumps"));
    pq1.setSlop(1);
    queries.add(pq1.build());
    docs.add(Collections.singleton(new StringField("select", "b", Field.Store.NO)));
    BooleanQuery.Builder bq1 = new BooleanQuery.Builder();
    bq1.add(new TermQuery(new Term("field", "quick")), BooleanClause.Occur.MUST);
    bq1.add(new TermQuery(new Term("field", "brown")), BooleanClause.Occur.MUST);
    bq1.add(new TermQuery(new Term("field", "fox")), BooleanClause.Occur.MUST);
    queries.add(bq1.build());
    docs.add(Collections.singleton(new StringField("select", "b", Field.Store.NO)));
    indexWriter.addDocuments(docs);
    indexWriter.close();
    directoryReader = DirectoryReader.open(directory);
    IndexSearcher shardSearcher = newSearcher(directoryReader);
    MemoryIndex memoryIndex = new MemoryIndex();
    memoryIndex.addField("field", "the quick brown fox jumps over the lazy dog", new WhitespaceAnalyzer());
    IndexSearcher percolateSearcher = memoryIndex.createSearcher();
    // no scoring, wrapping it in a constant score query:
    Query query = new ConstantScoreQuery(new PercolateQuery("type", queryStore, new BytesArray("a"), new TermQuery(new Term("select", "a")), percolateSearcher, new MatchNoDocsQuery("")));
    TopDocs topDocs = shardSearcher.search(query, 10);
    assertThat(topDocs.totalHits, equalTo(1));
    assertThat(topDocs.scoreDocs.length, equalTo(1));
    assertThat(topDocs.scoreDocs[0].doc, equalTo(0));
    Explanation explanation = shardSearcher.explain(query, 0);
    assertThat(explanation.isMatch(), is(true));
    assertThat(explanation.getValue(), equalTo(topDocs.scoreDocs[0].score));
    query = new ConstantScoreQuery(new PercolateQuery("type", queryStore, new BytesArray("b"), new TermQuery(new Term("select", "b")), percolateSearcher, new MatchNoDocsQuery("")));
    topDocs = shardSearcher.search(query, 10);
    assertThat(topDocs.totalHits, equalTo(3));
    assertThat(topDocs.scoreDocs.length, equalTo(3));
    assertThat(topDocs.scoreDocs[0].doc, equalTo(1));
    explanation = shardSearcher.explain(query, 1);
    assertThat(explanation.isMatch(), is(true));
    assertThat(explanation.getValue(), equalTo(topDocs.scoreDocs[0].score));
    assertThat(topDocs.scoreDocs[1].doc, equalTo(2));
    explanation = shardSearcher.explain(query, 2);
    assertThat(explanation.isMatch(), is(true));
    assertThat(explanation.getValue(), equalTo(topDocs.scoreDocs[1].score));
    assertThat(topDocs.scoreDocs[2].doc, equalTo(3));
    explanation = shardSearcher.explain(query, 2);
    assertThat(explanation.isMatch(), is(true));
    assertThat(explanation.getValue(), equalTo(topDocs.scoreDocs[2].score));
    query = new ConstantScoreQuery(new PercolateQuery("type", queryStore, new BytesArray("c"), new MatchAllDocsQuery(), percolateSearcher, new MatchAllDocsQuery()));
    topDocs = shardSearcher.search(query, 10);
    assertThat(topDocs.totalHits, equalTo(4));
    query = new PercolateQuery("type", queryStore, new BytesArray("{}"), new TermQuery(new Term("select", "b")), percolateSearcher, new MatchNoDocsQuery(""));
    topDocs = shardSearcher.search(query, 10);
    assertThat(topDocs.totalHits, equalTo(3));
    assertThat(topDocs.scoreDocs.length, equalTo(3));
    assertThat(topDocs.scoreDocs[0].doc, equalTo(3));
    explanation = shardSearcher.explain(query, 3);
    assertThat(explanation.isMatch(), is(true));
    assertThat(explanation.getValue(), equalTo(topDocs.scoreDocs[0].score));
    assertThat(explanation.getDetails(), arrayWithSize(1));
    assertThat(topDocs.scoreDocs[1].doc, equalTo(2));
    explanation = shardSearcher.explain(query, 2);
    assertThat(explanation.isMatch(), is(true));
    assertThat(explanation.getValue(), equalTo(topDocs.scoreDocs[1].score));
    assertThat(explanation.getDetails(), arrayWithSize(1));
    assertThat(topDocs.scoreDocs[2].doc, equalTo(1));
    explanation = shardSearcher.explain(query, 1);
    assertThat(explanation.isMatch(), is(true));
    assertThat(explanation.getValue(), equalTo(topDocs.scoreDocs[2].score));
    assertThat(explanation.getDetails(), arrayWithSize(1));
}
Also used : Query(org.apache.lucene.search.Query) SpanTermQuery(org.apache.lucene.search.spans.SpanTermQuery) NoMergePolicy(org.apache.lucene.index.NoMergePolicy) Matchers.arrayWithSize(org.hamcrest.Matchers.arrayWithSize) MatchNoDocsQuery(org.apache.lucene.search.MatchNoDocsQuery) StringField(org.apache.lucene.document.StringField) IndexableField(org.apache.lucene.index.IndexableField) Term(org.apache.lucene.index.Term) MemoryIndex(org.apache.lucene.index.memory.MemoryIndex) PhraseQuery(org.apache.lucene.search.PhraseQuery) WhitespaceAnalyzer(org.apache.lucene.analysis.core.WhitespaceAnalyzer) ArrayList(java.util.ArrayList) BytesArray(org.elasticsearch.common.bytes.BytesArray) ConstantScoreQuery(org.apache.lucene.search.ConstantScoreQuery) Directory(org.apache.lucene.store.Directory) After(org.junit.After) ESTestCase(org.elasticsearch.test.ESTestCase) Before(org.junit.Before) SpanNearQuery(org.apache.lucene.search.spans.SpanNearQuery) TopDocs(org.apache.lucene.search.TopDocs) Explanation(org.apache.lucene.search.Explanation) DirectoryReader(org.apache.lucene.index.DirectoryReader) MatchAllDocsQuery(org.apache.lucene.search.MatchAllDocsQuery) BooleanClause(org.apache.lucene.search.BooleanClause) IndexWriter(org.apache.lucene.index.IndexWriter) TermQuery(org.apache.lucene.search.TermQuery) List(java.util.List) BooleanQuery(org.apache.lucene.search.BooleanQuery) Field(org.apache.lucene.document.Field) Matchers.equalTo(org.hamcrest.Matchers.equalTo) Matchers.is(org.hamcrest.Matchers.is) IndexWriterConfig(org.apache.lucene.index.IndexWriterConfig) Collections(java.util.Collections) IndexSearcher(org.apache.lucene.search.IndexSearcher) IndexSearcher(org.apache.lucene.search.IndexSearcher) BooleanQuery(org.apache.lucene.search.BooleanQuery) Query(org.apache.lucene.search.Query) SpanTermQuery(org.apache.lucene.search.spans.SpanTermQuery) MatchNoDocsQuery(org.apache.lucene.search.MatchNoDocsQuery) PhraseQuery(org.apache.lucene.search.PhraseQuery) ConstantScoreQuery(org.apache.lucene.search.ConstantScoreQuery) SpanNearQuery(org.apache.lucene.search.spans.SpanNearQuery) MatchAllDocsQuery(org.apache.lucene.search.MatchAllDocsQuery) TermQuery(org.apache.lucene.search.TermQuery) BooleanQuery(org.apache.lucene.search.BooleanQuery) MatchNoDocsQuery(org.apache.lucene.search.MatchNoDocsQuery) Explanation(org.apache.lucene.search.Explanation) ArrayList(java.util.ArrayList) TopDocs(org.apache.lucene.search.TopDocs) SpanTermQuery(org.apache.lucene.search.spans.SpanTermQuery) ConstantScoreQuery(org.apache.lucene.search.ConstantScoreQuery) WhitespaceAnalyzer(org.apache.lucene.analysis.core.WhitespaceAnalyzer) SpanTermQuery(org.apache.lucene.search.spans.SpanTermQuery) TermQuery(org.apache.lucene.search.TermQuery) BytesArray(org.elasticsearch.common.bytes.BytesArray) PhraseQuery(org.apache.lucene.search.PhraseQuery) Term(org.apache.lucene.index.Term) MatchAllDocsQuery(org.apache.lucene.search.MatchAllDocsQuery) IndexableField(org.apache.lucene.index.IndexableField) MemoryIndex(org.apache.lucene.index.memory.MemoryIndex) StringField(org.apache.lucene.document.StringField) SpanNearQuery(org.apache.lucene.search.spans.SpanNearQuery)

Example 30 with Query

use of org.apache.lucene.search.Query in project elasticsearch by elastic.

the class PercolateQuery method createWeight.

@Override
public Weight createWeight(IndexSearcher searcher, boolean needsScores) throws IOException {
    final Weight verifiedMatchesWeight = verifiedMatchesQuery.createWeight(searcher, false);
    final Weight candidateMatchesWeight = candidateMatchesQuery.createWeight(searcher, false);
    return new Weight(this) {

        @Override
        public void extractTerms(Set<Term> set) {
        }

        @Override
        public Explanation explain(LeafReaderContext leafReaderContext, int docId) throws IOException {
            Scorer scorer = scorer(leafReaderContext);
            if (scorer != null) {
                TwoPhaseIterator twoPhaseIterator = scorer.twoPhaseIterator();
                int result = twoPhaseIterator.approximation().advance(docId);
                if (result == docId) {
                    if (twoPhaseIterator.matches()) {
                        if (needsScores) {
                            CheckedFunction<Integer, Query, IOException> percolatorQueries = queryStore.getQueries(leafReaderContext);
                            Query query = percolatorQueries.apply(docId);
                            Explanation detail = percolatorIndexSearcher.explain(query, 0);
                            return Explanation.match(scorer.score(), "PercolateQuery", detail);
                        } else {
                            return Explanation.match(scorer.score(), "PercolateQuery");
                        }
                    }
                }
            }
            return Explanation.noMatch("PercolateQuery");
        }

        @Override
        public float getValueForNormalization() throws IOException {
            return candidateMatchesWeight.getValueForNormalization();
        }

        @Override
        public void normalize(float v, float v1) {
            candidateMatchesWeight.normalize(v, v1);
        }

        @Override
        public Scorer scorer(LeafReaderContext leafReaderContext) throws IOException {
            final Scorer approximation = candidateMatchesWeight.scorer(leafReaderContext);
            if (approximation == null) {
                return null;
            }
            final CheckedFunction<Integer, Query, IOException> queries = queryStore.getQueries(leafReaderContext);
            if (needsScores) {
                return new BaseScorer(this, approximation, queries, percolatorIndexSearcher) {

                    float score;

                    @Override
                    boolean matchDocId(int docId) throws IOException {
                        Query query = percolatorQueries.apply(docId);
                        if (query != null) {
                            TopDocs topDocs = percolatorIndexSearcher.search(query, 1);
                            if (topDocs.totalHits > 0) {
                                score = topDocs.scoreDocs[0].score;
                                return true;
                            } else {
                                return false;
                            }
                        } else {
                            return false;
                        }
                    }

                    @Override
                    public float score() throws IOException {
                        return score;
                    }
                };
            } else {
                Scorer verifiedDocsScorer = verifiedMatchesWeight.scorer(leafReaderContext);
                Bits verifiedDocsBits = Lucene.asSequentialAccessBits(leafReaderContext.reader().maxDoc(), verifiedDocsScorer);
                return new BaseScorer(this, approximation, queries, percolatorIndexSearcher) {

                    @Override
                    public float score() throws IOException {
                        return 0f;
                    }

                    boolean matchDocId(int docId) throws IOException {
                        // the MemoryIndex verification.
                        if (verifiedDocsBits.get(docId)) {
                            return true;
                        }
                        Query query = percolatorQueries.apply(docId);
                        return query != null && Lucene.exists(percolatorIndexSearcher, query);
                    }
                };
            }
        }
    };
}
Also used : Set(java.util.Set) TwoPhaseIterator(org.apache.lucene.search.TwoPhaseIterator) Query(org.apache.lucene.search.Query) Explanation(org.apache.lucene.search.Explanation) Scorer(org.apache.lucene.search.Scorer) IOException(java.io.IOException) Weight(org.apache.lucene.search.Weight) TopDocs(org.apache.lucene.search.TopDocs) LeafReaderContext(org.apache.lucene.index.LeafReaderContext) Bits(org.apache.lucene.util.Bits)

Aggregations

Query (org.apache.lucene.search.Query)1371 BooleanQuery (org.apache.lucene.search.BooleanQuery)663 TermQuery (org.apache.lucene.search.TermQuery)633 Term (org.apache.lucene.index.Term)395 MatchAllDocsQuery (org.apache.lucene.search.MatchAllDocsQuery)359 BoostQuery (org.apache.lucene.search.BoostQuery)284 IndexSearcher (org.apache.lucene.search.IndexSearcher)283 Test (org.junit.Test)258 PhraseQuery (org.apache.lucene.search.PhraseQuery)247 MatchNoDocsQuery (org.apache.lucene.search.MatchNoDocsQuery)234 TopDocs (org.apache.lucene.search.TopDocs)224 Document (org.apache.lucene.document.Document)216 ConstantScoreQuery (org.apache.lucene.search.ConstantScoreQuery)205 TermRangeQuery (org.apache.lucene.search.TermRangeQuery)194 PrefixQuery (org.apache.lucene.search.PrefixQuery)188 FuzzyQuery (org.apache.lucene.search.FuzzyQuery)174 IndexReader (org.apache.lucene.index.IndexReader)167 RegexpQuery (org.apache.lucene.search.RegexpQuery)159 WildcardQuery (org.apache.lucene.search.WildcardQuery)141 ArrayList (java.util.ArrayList)139