Uses of Class
org.apache.lucene.search.Query
-
Packages that use Query Package Description org.apache.lucene.document The logical representation of aDocumentfor indexing and searching.org.apache.lucene.index Code to maintain and access indices.org.apache.lucene.search Code to search indices.org.apache.lucene.search.spans The calculus of spans.org.apache.lucene.util Some utility classes. -
-
Uses of Query in org.apache.lucene.document
Methods in org.apache.lucene.document that return Query Modifier and Type Method Description static QueryLatLonPoint. newBoxQuery(String field, double minLatitude, double maxLatitude, double minLongitude, double maxLongitude)Create a query for matching a bounding box.static QueryDoubleRange. newContainsQuery(String field, double[] min, double[] max)Create a query for matching indexed ranges that contain the defined range.static QueryFloatRange. newContainsQuery(String field, float[] min, float[] max)Create a query for matching indexed float ranges that contain the defined range.static QueryIntRange. newContainsQuery(String field, int[] min, int[] max)Create a query for matching indexed ranges that contain the defined range.static QueryLongRange. newContainsQuery(String field, long[] min, long[] max)Create a query for matching indexed ranges that contain the defined range.static QueryDoubleRange. newCrossesQuery(String field, double[] min, double[] max)Create a query for matching indexed ranges that cross the defined range.static QueryFloatRange. newCrossesQuery(String field, float[] min, float[] max)Create a query for matching indexed ranges that cross the defined range.static QueryIntRange. newCrossesQuery(String field, int[] min, int[] max)Create a query for matching indexed ranges that cross the defined range.static QueryLongRange. newCrossesQuery(String field, long[] min, long[] max)Create a query for matching indexed ranges that cross the defined range.static QueryLatLonPoint. newDistanceQuery(String field, double latitude, double longitude, double radiusMeters)Create a query for matching points within the specified distance of the supplied location.static QueryBinaryPoint. newExactQuery(String field, byte[] value)Create a query for matching an exact binary value.static QueryDoublePoint. newExactQuery(String field, double value)Create a query for matching an exact double value.static QueryFloatPoint. newExactQuery(String field, float value)Create a query for matching an exact float value.static QueryIntPoint. newExactQuery(String field, int value)Create a query for matching an exact integer value.static QueryLongPoint. newExactQuery(String field, long value)Create a query for matching an exact long value.static QueryDoubleRange. newIntersectsQuery(String field, double[] min, double[] max)Create a query for matching indexed ranges that intersect the defined range.static QueryFloatRange. newIntersectsQuery(String field, float[] min, float[] max)Create a query for matching indexed ranges that intersect the defined range.static QueryIntRange. newIntersectsQuery(String field, int[] min, int[] max)Create a query for matching indexed ranges that intersect the defined range.static QueryLongRange. newIntersectsQuery(String field, long[] min, long[] max)Create a query for matching indexed ranges that intersect the defined range.static QueryFeatureField. newLogQuery(String fieldName, String featureName, float weight, float scalingFactor)Return a newQuerythat will score documents asweight * Math.log(scalingFactor + S)where S is the value of the static feature.static QueryLatLonPoint. newPolygonQuery(String field, Polygon... polygons)Create a query for matching one or more polygons.static QueryBinaryPoint. newRangeQuery(String field, byte[][] lowerValue, byte[][] upperValue)Create a range query for n-dimensional binary values.static QueryBinaryPoint. newRangeQuery(String field, byte[] lowerValue, byte[] upperValue)Create a range query for binary values.static QueryDoublePoint. newRangeQuery(String field, double[] lowerValue, double[] upperValue)Create a range query for n-dimensional double values.static QueryDoublePoint. newRangeQuery(String field, double lowerValue, double upperValue)Create a range query for double values.static QueryFloatPoint. newRangeQuery(String field, float[] lowerValue, float[] upperValue)Create a range query for n-dimensional float values.static QueryFloatPoint. newRangeQuery(String field, float lowerValue, float upperValue)Create a range query for float values.static QueryIntPoint. newRangeQuery(String field, int[] lowerValue, int[] upperValue)Create a range query for n-dimensional integer values.static QueryIntPoint. newRangeQuery(String field, int lowerValue, int upperValue)Create a range query for integer values.static QueryLongPoint. newRangeQuery(String field, long[] lowerValue, long[] upperValue)Create a range query for n-dimensional long values.static QueryLongPoint. newRangeQuery(String field, long lowerValue, long upperValue)Create a range query for long values.static QueryFeatureField. newSaturationQuery(String fieldName, String featureName)Same asFeatureField.newSaturationQuery(String, String, float, float)but1fis used as a weight and a reasonably good default pivot value is computed based on index statistics and is approximately equal to the geometric mean of all values that exist in the index.static QueryFeatureField. newSaturationQuery(String fieldName, String featureName, float weight, float pivot)Return a newQuerythat will score documents asweight * S / (S + pivot)where S is the value of the static feature.static QueryBinaryPoint. newSetQuery(String field, byte[]... values)Create a query matching any of the specified 1D values.static QueryDoublePoint. newSetQuery(String field, double... values)Create a query matching any of the specified 1D values.static QueryDoublePoint. newSetQuery(String field, Collection<Double> values)Create a query matching any of the specified 1D values.static QueryFloatPoint. newSetQuery(String field, float... values)Create a query matching any of the specified 1D values.static QueryFloatPoint. newSetQuery(String field, Collection<Float> values)Create a query matching any of the specified 1D values.static QueryIntPoint. newSetQuery(String field, int... values)Create a query matching any of the specified 1D values.static QueryIntPoint. newSetQuery(String field, Collection<Integer> values)Create a query matching any of the specified 1D values.static QueryLongPoint. newSetQuery(String field, long... values)Create a query matching any of the specified 1D values.static QueryLongPoint. newSetQuery(String field, Collection<Long> values)Create a query matching any of the specified 1D values.static QueryFeatureField. newSigmoidQuery(String fieldName, String featureName, float weight, float pivot, float exp)Return a newQuerythat will score documents asweight * S^a / (S^a + pivot^a)where S is the value of the static feature.static QueryLatLonDocValuesField. newSlowBoxQuery(String field, double minLatitude, double maxLatitude, double minLongitude, double maxLongitude)Create a query for matching a bounding box using doc values.static QueryLatLonDocValuesField. newSlowDistanceQuery(String field, double latitude, double longitude, double radiusMeters)Create a query for matching points within the specified distance of the supplied location.static QueryNumericDocValuesField. newSlowExactQuery(String field, long value)Create a query for matching an exact long value.static QuerySortedDocValuesField. newSlowExactQuery(String field, BytesRef value)Create a query for matching an exactBytesRefvalue.static QuerySortedNumericDocValuesField. newSlowExactQuery(String field, long value)Create a query for matching an exact long value.static QuerySortedSetDocValuesField. newSlowExactQuery(String field, BytesRef value)Create a query for matching an exactBytesRefvalue.static QueryNumericDocValuesField. newSlowRangeQuery(String field, long lowerValue, long upperValue)Create a range query that matches all documents whose value is betweenlowerValueandupperValueincluded.static QuerySortedDocValuesField. newSlowRangeQuery(String field, BytesRef lowerValue, BytesRef upperValue, boolean lowerInclusive, boolean upperInclusive)Create a range query that matches all documents whose value is betweenlowerValueandupperValueincluded.static QuerySortedNumericDocValuesField. newSlowRangeQuery(String field, long lowerValue, long upperValue)Create a range query that matches all documents whose value is betweenlowerValueandupperValueincluded.static QuerySortedSetDocValuesField. newSlowRangeQuery(String field, BytesRef lowerValue, BytesRef upperValue, boolean lowerInclusive, boolean upperInclusive)Create a range query that matches all documents whose value is betweenlowerValueandupperValue.static QueryDoubleRange. newWithinQuery(String field, double[] min, double[] max)Create a query for matching indexed ranges that are within the defined range.static QueryFloatRange. newWithinQuery(String field, float[] min, float[] max)Create a query for matching indexed ranges that are within the defined range.static QueryIntRange. newWithinQuery(String field, int[] min, int[] max)Create a query for matching indexed ranges that are within the defined range.static QueryLongRange. newWithinQuery(String field, long[] min, long[] max)Create a query for matching indexed ranges that are within the defined range. -
Uses of Query in org.apache.lucene.index
Methods in org.apache.lucene.index with parameters of type Query Modifier and Type Method Description longIndexWriter. deleteDocuments(Query... queries)Deletes the document(s) matching any of the provided queries.Constructor parameters in org.apache.lucene.index with type arguments of type Query Constructor Description SoftDeletesRetentionMergePolicy(String field, Supplier<Query> retentionQuerySupplier, MergePolicy in)Creates a newSoftDeletesRetentionMergePolicy -
Uses of Query in org.apache.lucene.search
Subclasses of Query in org.apache.lucene.search Modifier and Type Class Description classAutomatonQueryAQuerythat will match terms against a finite-state machine.classBlendedTermQueryAQuerythat blends index statistics across multiple terms.classBooleanQueryA Query that matches documents matching boolean combinations of other queries, e.g.classBoostQueryAQuerywrapper that allows to give a boost to the wrapped query.classConstantScoreQueryA query that wraps another query and simply returns a constant score equal to 1 for every document that matches the query.classDisjunctionMaxQueryA query that generates the union of documents produced by its subqueries, and that scores each document with the maximum score for that document as produced by any subquery, plus a tie breaking increment for any additional matching subqueries.classDocValuesFieldExistsQueryAQuerythat matches documents that have a value for a given field as reported by doc values iterators.classFuzzyQueryImplements the fuzzy search query.classIndexOrDocValuesQueryA query that uses either an index structure (points or terms) or doc values in order to run a query, depending which one is more efficient.classMatchAllDocsQueryA query that matches all documents.classMatchNoDocsQueryA query that matches no documents.classMultiPhraseQueryA generalized version ofPhraseQuery, with the possibility of adding more than one term at the same position that are treated as a disjunction (OR).classMultiTermQueryAn abstractQuerythat matches documents containing a subset of terms provided by aFilteredTermsEnumenumeration.classNGramPhraseQueryThis is aPhraseQuerywhich is optimized for n-gram phrase query.classNormsFieldExistsQueryAQuerythat matches documents that have a value for a given field as reported by field norms.classPhraseQueryA Query that matches documents containing a particular sequence of terms.classPointInSetQueryAbstract query class to find all documents whose single or multi-dimensional point values, previously indexed with e.g.classPointRangeQueryAbstract class for range queries against single or multidimensional points such asIntPoint.classPrefixQueryA Query that matches documents containing terms with a specified prefix.classRegexpQueryA fast regular expression query based on theorg.apache.lucene.util.automatonpackage.classSynonymQueryA query that treats multiple terms as synonyms.classTermInSetQuerySpecialization for a disjunction over many terms that behaves like aConstantScoreQueryover aBooleanQuerycontaining onlyBooleanClause.Occur.SHOULDclauses.classTermQueryA Query that matches documents containing a term.classTermRangeQueryA Query that matches documents within an range of terms.classWildcardQueryImplements the wildcard search query.Fields in org.apache.lucene.search declared as Query Modifier and Type Field Description protected QueryWeight. parentQueryMethods in org.apache.lucene.search that return Query Modifier and Type Method Description protected QueryMultiTermQuery.TopTermsBlendedFreqScoringRewrite. build(BlendedTermQuery.Builder builder)protected QueryMultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite. build(BooleanQuery.Builder builder)protected QueryMultiTermQuery.TopTermsScoringBooleanQueryRewrite. build(BooleanQuery.Builder builder)QueryIndexOrDocValuesQuery. getIndexQuery()Return the wrapped query that may be costly to initialize but has a good iterator.QueryBooleanClause. getQuery()QueryBoostQuery. getQuery()Return the wrappedQuery.QueryConstantScoreQuery. getQuery()Returns the encapsulated query.QueryFilterMatchesIterator. getQuery()QueryMatchesIterator. getQuery()Returns the Query causing the current match If thisMatchesIteratorhas been returned from aMatchesIterator.getSubMatches()call, then returns aTermQueryequivalent to the current match Should only be called afterMatchesIterator.next()has returnedtrueQueryWeight. getQuery()The query that this concerns.QueryIndexOrDocValuesQuery. getRandomAccessQuery()Return the wrapped query that may be slow at identifying all matching documents, but which is cheap to initialize and can efficiently verify that some documents match.QueryBlendedTermQuery.DisjunctionMaxRewrite. rewrite(Query[] subQueries)QueryBlendedTermQuery. rewrite(IndexReader reader)abstract QueryBlendedTermQuery.RewriteMethod. rewrite(Query[] subQueries)Merge the provided sub queries into a singleQueryobject.QueryBooleanQuery. rewrite(IndexReader reader)QueryBoostQuery. rewrite(IndexReader reader)QueryConstantScoreQuery. rewrite(IndexReader reader)QueryDisjunctionMaxQuery. rewrite(IndexReader reader)Optimize our representation and our subqueries representationsQueryDocValuesRewriteMethod. rewrite(IndexReader reader, MultiTermQuery query)QueryIndexOrDocValuesQuery. rewrite(IndexReader reader)QueryIndexSearcher. rewrite(Query original)Expert: called to re-write queries into primitive queries.QueryMultiPhraseQuery. rewrite(IndexReader reader)QueryMultiTermQuery. rewrite(IndexReader reader)To rewrite to a simpler form, instead return a simpler enum fromMultiTermQuery.getTermsEnum(Terms, AttributeSource).abstract QueryMultiTermQuery.RewriteMethod. rewrite(IndexReader reader, MultiTermQuery query)QueryNGramPhraseQuery. rewrite(IndexReader reader)QueryPhraseQuery. rewrite(IndexReader reader)QueryQuery. rewrite(IndexReader reader)Expert: called to re-write queries into primitive queries.QueryScoringRewrite. rewrite(IndexReader reader, MultiTermQuery query)QuerySynonymQuery. rewrite(IndexReader reader)QueryTermInSetQuery. rewrite(IndexReader reader)QueryTopTermsRewrite. rewrite(IndexReader reader, MultiTermQuery query)Methods in org.apache.lucene.search that return types with arguments of type Query Modifier and Type Method Description List<Query>DisjunctionMaxQuery. getDisjuncts()Iterator<Query>DisjunctionMaxQuery. iterator()Methods in org.apache.lucene.search with parameters of type Query Modifier and Type Method Description BooleanQuery.BuilderBooleanQuery.Builder. add(Query query, BooleanClause.Occur occur)Add a new clause to thisBooleanQuery.Builder.voidLRUQueryCache. clearQuery(Query query)Remove all cache entries for the given query.intIndexSearcher. count(Query query)Count how many documents match the given query.WeightIndexSearcher. createNormalizedWeight(Query query, boolean needsScores)Deprecated.Clients should rewrite the query and then callIndexSearcher.createWeight(Query, boolean, float)with a boost value of 1fWeightIndexSearcher. createWeight(Query query, boolean needsScores, float boost)Creates aWeightfor the given query, potentially adding caching if possible and configured.ExplanationIndexSearcher. explain(Query query, int doc)Returns an Explanation that describes howdocscored againstquery.static DoubleValuesSourceDoubleValuesSource. fromQuery(Query query)Create a DoubleValuesSource that returns the score of a particular queryprotected intUsageTrackingQueryCachingPolicy. minFrequencyToCache(Query query)For a given filter, return how many times it should appear in the history before being cached.protected voidLRUQueryCache. onHit(Object readerCoreKey, Query query)Expert: callback when there is a cache hit on a given query.protected voidLRUQueryCache. onMiss(Object readerCoreKey, Query query)Expert: callback when there is a cache miss on a given query.protected voidLRUQueryCache. onQueryCache(Query query, long ramBytesUsed)Expert: callback when a query is added to this cache.protected voidLRUQueryCache. onQueryEviction(Query query, long ramBytesUsed)Expert: callback when a query is evicted from this cache.voidQueryCachingPolicy. onUse(Query query)Callback that is called every time that a cached filter is used.voidUsageTrackingQueryCachingPolicy. onUse(Query query)static TopDocsQueryRescorer. rescore(IndexSearcher searcher, TopDocs topDocs, Query query, double weight, int topN)Sugar API, calling {#rescore} using a simple linear combination of firstPassScore + weight * secondPassScoreQueryBlendedTermQuery.DisjunctionMaxRewrite. rewrite(Query[] subQueries)abstract QueryBlendedTermQuery.RewriteMethod. rewrite(Query[] subQueries)Merge the provided sub queries into a singleQueryobject.QueryIndexSearcher. rewrite(Query original)Expert: called to re-write queries into primitive queries.TopDocsIndexSearcher. search(Query query, int n)Finds the topnhits forquery.TopFieldDocsIndexSearcher. search(Query query, int n, Sort sort)Search implementation with arbitrary sorting.TopFieldDocsIndexSearcher. search(Query query, int n, Sort sort, boolean doDocScores, boolean doMaxScore)Search implementation with arbitrary sorting, plus control over whether hit scores and max score should be computed.voidIndexSearcher. search(Query query, Collector results)Lower-level search API.<C extends Collector,T>
TIndexSearcher. search(Query query, CollectorManager<C,T> collectorManager)Lower-level search API.TopDocsIndexSearcher. searchAfter(ScoreDoc after, Query query, int numHits)Finds the topnhits forquerywhere all results are after a previous result (after).TopDocsIndexSearcher. searchAfter(ScoreDoc after, Query query, int n, Sort sort)Finds the topnhits forquerywhere all results are after a previous result (after).TopFieldDocsIndexSearcher. searchAfter(ScoreDoc after, Query query, int numHits, Sort sort, boolean doDocScores, boolean doMaxScore)Finds the topnhits forquerywhere all results are after a previous result (after), allowing control over whether hit scores and max score should be computed.booleanQueryCachingPolicy. shouldCache(Query query)Whether the givenQueryis worth caching.booleanUsageTrackingQueryCachingPolicy. shouldCache(Query query)Constructors in org.apache.lucene.search with parameters of type Query Constructor Description BooleanClause(Query query, BooleanClause.Occur occur)Constructs a BooleanClause.BoostQuery(Query query, float boost)Sole constructor: wrapqueryin such a way that the produced scores will be boosted byboost.ConstantScoreQuery(Query query)Strips off scores from the passed in Query.ConstantScoreWeight(Query query, float score)FilterWeight(Query query, Weight weight)Alternative constructor.IndexOrDocValuesQuery(Query indexQuery, Query dvQuery)Create anIndexOrDocValuesQuery.QueryRescorer(Query query)Sole constructor, passing the 2nd pass query to assign scores to the 1st pass hits.Weight(Query query)Sole constructor, typically invoked by sub-classes.Constructor parameters in org.apache.lucene.search with type arguments of type Query Constructor Description DisjunctionMaxQuery(Collection<Query> disjuncts, float tieBreakerMultiplier)Creates a new DisjunctionMaxQuery -
Uses of Query in org.apache.lucene.search.spans
Subclasses of Query in org.apache.lucene.search.spans Modifier and Type Class Description classFieldMaskingSpanQueryWrapper to allowSpanQueryobjects participate in composite single-field SpanQueries by 'lying' about their search field.classSpanBoostQueryCounterpart ofBoostQueryfor spans.classSpanContainingQueryKeep matches that contain another SpanScorer.classSpanFirstQueryMatches spans near the beginning of a field.classSpanMultiTermQueryWrapper<Q extends MultiTermQuery>Wraps anyMultiTermQueryas aSpanQuery, so it can be nested within other SpanQuery classes.classSpanNearQueryMatches spans which are near one another.classSpanNotQueryRemoves matches which overlap with another SpanQuery or which are within x tokens before or y tokens after another SpanQuery.classSpanOrQueryMatches the union of its clauses.classSpanPositionCheckQueryBase class for filtering a SpanQuery based on the position of a match.classSpanPositionRangeQueryChecks to see if theSpanPositionCheckQuery.getMatch()lies between a start and end position SeeSpanFirstQueryfor a derivation that is optimized for the case where start position is 0.classSpanQueryBase class for span-based queries.classSpanTermQueryMatches spans containing a term.classSpanWithinQueryKeep matches that are contained within another Spans.Methods in org.apache.lucene.search.spans that return Query Modifier and Type Method Description QuerySpanMultiTermQueryWrapper. getWrappedQuery()Returns the wrapped queryQueryFieldMaskingSpanQuery. rewrite(IndexReader reader)QuerySpanBoostQuery. rewrite(IndexReader reader)QuerySpanMultiTermQueryWrapper. rewrite(IndexReader reader)QuerySpanNearQuery. rewrite(IndexReader reader)QuerySpanNotQuery. rewrite(IndexReader reader)QuerySpanOrQuery. rewrite(IndexReader reader)QuerySpanPositionCheckQuery. rewrite(IndexReader reader) -
Uses of Query in org.apache.lucene.util
Methods in org.apache.lucene.util that return Query Modifier and Type Method Description protected QueryQueryBuilder. analyzeBoolean(String field, TokenStream stream)Creates simple boolean query from the cached tokenstream contentsprotected QueryQueryBuilder. analyzeGraphBoolean(String field, TokenStream source, BooleanClause.Occur operator)Creates a boolean query from a graph token stream.protected QueryQueryBuilder. analyzeGraphPhrase(TokenStream source, String field, int phraseSlop)Creates graph phrase query from the tokenstream contentsprotected QueryQueryBuilder. analyzeMultiBoolean(String field, TokenStream stream, BooleanClause.Occur operator)Creates complex boolean query from the cached tokenstream contentsprotected QueryQueryBuilder. analyzeMultiPhrase(String field, TokenStream stream, int slop)Creates complex phrase query from the cached tokenstream contentsprotected QueryQueryBuilder. analyzePhrase(String field, TokenStream stream, int slop)Creates simple phrase query from the cached tokenstream contentsprotected QueryQueryBuilder. analyzeTerm(String field, TokenStream stream)Creates simple term query from the cached tokenstream contentsQueryQueryBuilder. createBooleanQuery(String field, String queryText)Creates a boolean query from the query text.QueryQueryBuilder. createBooleanQuery(String field, String queryText, BooleanClause.Occur operator)Creates a boolean query from the query text.protected QueryQueryBuilder. createFieldQuery(Analyzer analyzer, BooleanClause.Occur operator, String field, String queryText, boolean quoted, int phraseSlop)Creates a query from the analysis chain.protected QueryQueryBuilder. createFieldQuery(TokenStream source, BooleanClause.Occur operator, String field, boolean quoted, int phraseSlop)Creates a query from a token stream.QueryQueryBuilder. createMinShouldMatchQuery(String field, String queryText, float fraction)Creates a minimum-should-match query from the query text.QueryQueryBuilder. createPhraseQuery(String field, String queryText)Creates a phrase query from the query text.QueryQueryBuilder. createPhraseQuery(String field, String queryText, int phraseSlop)Creates a phrase query from the query text.protected QueryQueryBuilder. newGraphSynonymQuery(Iterator<Query> queries)Builds a new GraphQuery for multi-terms synonyms.protected QueryQueryBuilder. newSynonymQuery(Term[] terms)Builds a new SynonymQuery instance.protected QueryQueryBuilder. newTermQuery(Term term)Builds a new TermQuery instance.Method parameters in org.apache.lucene.util with type arguments of type Query Modifier and Type Method Description protected QueryQueryBuilder. newGraphSynonymQuery(Iterator<Query> queries)Builds a new GraphQuery for multi-terms synonyms.
-