Uses of Class
org.apache.lucene.search.Query
-
Packages that use Query Package Description org.apache.lucene.document The logical representation of aDocument
for indexing and searching.org.apache.lucene.index Code to maintain and access indices.org.apache.lucene.search Code to search indices.org.apache.lucene.util Some utility classes.org.apache.lucene.util.automaton Finite-state automaton for regular expressions. -
-
Uses of Query in org.apache.lucene.document
Subclasses of Query in org.apache.lucene.document Modifier and Type Class Description class
RangeFieldQuery
Query class for searchingRangeField
types by a definedPointValues.Relation
.class
XYDocValuesPointInGeometryQuery
XYGeometry query forXYDocValuesField
.Methods in org.apache.lucene.document that return Query Modifier and Type Method Description static Query
LatLonPoint. newBoxQuery(String field, double minLatitude, double maxLatitude, double minLongitude, double maxLongitude)
Create a query for matching a bounding box.static Query
LatLonShape. newBoxQuery(String field, ShapeField.QueryRelation queryRelation, double minLatitude, double maxLatitude, double minLongitude, double maxLongitude)
create a query to find all indexed geo shapes that intersect a defined bounding box *static Query
XYPointField. newBoxQuery(String field, float minX, float maxX, float minY, float maxY)
Create a query for matching a bounding box.static Query
XYShape. newBoxQuery(String field, ShapeField.QueryRelation queryRelation, float minX, float maxX, float minY, float maxY)
create a query to find all cartesian shapes that intersect a defined bounding box *static Query
DoubleRange. newContainsQuery(String field, double[] min, double[] max)
Create a query for matching indexed ranges that contain the defined range.static Query
FloatRange. newContainsQuery(String field, float[] min, float[] max)
Create a query for matching indexed float ranges that contain the defined range.static Query
InetAddressRange. newContainsQuery(String field, InetAddress min, InetAddress max)
Create a query for matching indexed ip ranges thatCONTAINS
the defined range.static Query
IntRange. newContainsQuery(String field, int[] min, int[] max)
Create a query for matching indexed ranges that contain the defined range.static Query
LongRange. newContainsQuery(String field, long[] min, long[] max)
Create a query for matching indexed ranges that contain the defined range.static Query
DoubleRange. newCrossesQuery(String field, double[] min, double[] max)
Create a query for matching indexed ranges that cross the defined range.static Query
FloatRange. newCrossesQuery(String field, float[] min, float[] max)
Create a query for matching indexed ranges that cross the defined range.static Query
InetAddressRange. newCrossesQuery(String field, InetAddress min, InetAddress max)
Create a query for matching indexed ip ranges thatCROSS
the defined range.static Query
IntRange. newCrossesQuery(String field, int[] min, int[] max)
Create a query for matching indexed ranges that cross the defined range.static Query
LongRange. newCrossesQuery(String field, long[] min, long[] max)
Create a query for matching indexed ranges that cross the defined range.static Query
LatLonPoint. newDistanceFeatureQuery(String field, float weight, double originLat, double originLon, double pivotDistanceMeters)
Given a field that indexes point values into aLatLonPoint
and doc values intoLatLonDocValuesField
, this returns a query that scores documents based on their haversine distance in meters to(originLat, originLon)
:score = weight * pivotDistanceMeters / (pivotDistanceMeters + distance)
, ie.static Query
LongField. newDistanceFeatureQuery(String field, float weight, long origin, long pivotDistance)
Returns a query that scores documents based on their distance toorigin
:score = weight * pivotDistance / (pivotDistance + distance)
, ie.static Query
LongPoint. newDistanceFeatureQuery(String field, float weight, long origin, long pivotDistance)
Deprecated.static Query
LatLonPoint. newDistanceQuery(String field, double latitude, double longitude, double radiusMeters)
Create a query for matching points within the specified distance of the supplied location.static Query
LatLonShape. newDistanceQuery(String field, ShapeField.QueryRelation queryRelation, Circle... circle)
create a query to find all polygons that intersect a provided circle.static Query
XYPointField. newDistanceQuery(String field, float x, float y, float radius)
Create a query for matching points within the specified distance of the supplied location.static Query
XYShape. newDistanceQuery(String field, ShapeField.QueryRelation queryRelation, XYCircle... circle)
create a query to find all cartesian shapes that intersect a provided circle (or arrays of circles) *static Query
BinaryPoint. newExactQuery(String field, byte[] value)
Create a query for matching an exact binary value.static Query
DoubleField. newExactQuery(String field, double value)
Create a query for matching an exact double value.static Query
DoublePoint. newExactQuery(String field, double value)
Create a query for matching an exact double value.static Query
FloatField. newExactQuery(String field, float value)
Create a query for matching an exact float value.static Query
FloatPoint. newExactQuery(String field, float value)
Create a query for matching an exact float value.static Query
InetAddressPoint. newExactQuery(String field, InetAddress value)
Create a query for matching a network address.static Query
IntField. newExactQuery(String field, int value)
Create a query for matching an exact integer value.static Query
IntPoint. newExactQuery(String field, int value)
Create a query for matching an exact integer value.static Query
KeywordField. newExactQuery(String field, String value)
Create a query for matching an exactString
value.static Query
KeywordField. newExactQuery(String field, BytesRef value)
Create a query for matching an exactBytesRef
value.static Query
LongField. newExactQuery(String field, long value)
Create a query for matching an exact long value.static Query
LongPoint. newExactQuery(String field, long value)
Create a query for matching an exact long value.static Query
LatLonPoint. newGeometryQuery(String field, ShapeField.QueryRelation queryRelation, LatLonGeometry... latLonGeometries)
Create a query for matching one or more geometries against the providedShapeField.QueryRelation
.static Query
LatLonShape. newGeometryQuery(String field, ShapeField.QueryRelation queryRelation, LatLonGeometry... latLonGeometries)
create a query to find all indexed geo shapes that intersect a provided geometry (or array of geometries).static Query
ShapeDocValuesField. newGeometryQuery(String field, ShapeField.QueryRelation relation, Object... geometries)
Creates a geometry query for shape docvaluesstatic Query
XYPointField. newGeometryQuery(String field, XYGeometry... xyGeometries)
create a query to find all indexed shapes that intersect a provided geometry collection.static Query
XYShape. newGeometryQuery(String field, ShapeField.QueryRelation queryRelation, XYGeometry... xyGeometries)
create a query to find all indexed geo shapes that intersect a provided geometry collection note: Components do not support dateline crossingstatic Query
DoubleRange. newIntersectsQuery(String field, double[] min, double[] max)
Create a query for matching indexed ranges that intersect the defined range.static Query
FloatRange. newIntersectsQuery(String field, float[] min, float[] max)
Create a query for matching indexed ranges that intersect the defined range.static Query
InetAddressRange. newIntersectsQuery(String field, InetAddress min, InetAddress max)
Create a query for matching indexed ip ranges thatINTERSECT
the defined range.static Query
IntRange. newIntersectsQuery(String field, int[] min, int[] max)
Create a query for matching indexed ranges that intersect the defined range.static Query
LongRange. newIntersectsQuery(String field, long[] min, long[] max)
Create a query for matching indexed ranges that intersect the defined range.static Query
FeatureField. newLinearQuery(String fieldName, String featureName, float weight)
Return a newQuery
that will score documents asweight * S
where S is the value of the static feature.static Query
LatLonShape. newLineQuery(String field, ShapeField.QueryRelation queryRelation, Line... lines)
create a query to find all indexed geo shapes that intersect a provided linestring (or array of linestrings) note: does not support dateline crossingstatic Query
XYShape. newLineQuery(String field, ShapeField.QueryRelation queryRelation, XYLine... lines)
create a query to find all cartesian shapes that intersect a provided linestring (or array of linestrings) *static Query
FeatureField. newLogQuery(String fieldName, String featureName, float weight, float scalingFactor)
Return a newQuery
that will score documents asweight * Math.log(scalingFactor + S)
where S is the value of the static feature.static Query
LatLonShape. newPointQuery(String field, ShapeField.QueryRelation queryRelation, double[]... points)
create a query to find all indexed shapes that comply theShapeField.QueryRelation
with the provided pointsstatic Query
XYShape. newPointQuery(String field, ShapeField.QueryRelation queryRelation, float[]... points)
create a query to find all indexed shapes that comply theShapeField.QueryRelation
with the provided pointstatic Query
LatLonPoint. newPolygonQuery(String field, Polygon... polygons)
Create a query for matching one or more polygons.static Query
LatLonShape. newPolygonQuery(String field, ShapeField.QueryRelation queryRelation, Polygon... polygons)
create a query to find all indexed geo shapes that intersect a provided polygon (or array of polygons) note: does not support dateline crossingstatic Query
XYPointField. newPolygonQuery(String field, XYPolygon... polygons)
Create a query for matching one or more polygons.static Query
XYShape. newPolygonQuery(String field, ShapeField.QueryRelation queryRelation, XYPolygon... polygons)
create a query to find all cartesian shapes that intersect a provided polygon (or array of polygons) *static Query
InetAddressPoint. newPrefixQuery(String field, InetAddress value, int prefixLength)
Create a prefix query for matching a CIDR network range.static Query
BinaryPoint. newRangeQuery(String field, byte[][] lowerValue, byte[][] upperValue)
Create a range query for n-dimensional binary values.static Query
BinaryPoint. newRangeQuery(String field, byte[] lowerValue, byte[] upperValue)
Create a range query for binary values.static Query
DoubleField. newRangeQuery(String field, double lowerValue, double upperValue)
Create a range query for double values.static Query
DoublePoint. newRangeQuery(String field, double[] lowerValue, double[] upperValue)
Create a range query for n-dimensional double values.static Query
DoublePoint. newRangeQuery(String field, double lowerValue, double upperValue)
Create a range query for double values.static Query
FloatField. newRangeQuery(String field, float lowerValue, float upperValue)
Create a range query for float values.static Query
FloatPoint. newRangeQuery(String field, float[] lowerValue, float[] upperValue)
Create a range query for n-dimensional float values.static Query
FloatPoint. newRangeQuery(String field, float lowerValue, float upperValue)
Create a range query for float values.static Query
InetAddressPoint. newRangeQuery(String field, InetAddress lowerValue, InetAddress upperValue)
Create a range query for network addresses.static Query
IntField. newRangeQuery(String field, int lowerValue, int upperValue)
Create a range query for integer values.static Query
IntPoint. newRangeQuery(String field, int[] lowerValue, int[] upperValue)
Create a range query for n-dimensional integer values.static Query
IntPoint. newRangeQuery(String field, int lowerValue, int upperValue)
Create a range query for integer values.static Query
LongField. newRangeQuery(String field, long lowerValue, long upperValue)
Create a range query for long values.static Query
LongPoint. newRangeQuery(String field, long[] lowerValue, long[] upperValue)
Create a range query for n-dimensional long values.static Query
LongPoint. newRangeQuery(String field, long lowerValue, long upperValue)
Create a range query for long values.static Query
FeatureField. newSaturationQuery(String fieldName, String featureName)
Same asFeatureField.newSaturationQuery(String, String, float, float)
but1f
is 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 Query
FeatureField. newSaturationQuery(String fieldName, String featureName, float weight, float pivot)
Return a newQuery
that will score documents asweight * S / (S + pivot)
where S is the value of the static feature.static Query
BinaryPoint. newSetQuery(String field, byte[]... values)
Create a query matching any of the specified 1D values.static Query
DoubleField. newSetQuery(String field, double... values)
Create a query matching values in a supplied setstatic Query
DoublePoint. newSetQuery(String field, double... values)
Create a query matching any of the specified 1D values.static Query
DoublePoint. newSetQuery(String field, Collection<Double> values)
Create a query matching any of the specified 1D values.static Query
FloatField. newSetQuery(String field, float... values)
Create a query matching values in a supplied setstatic Query
FloatPoint. newSetQuery(String field, float... values)
Create a query matching any of the specified 1D values.static Query
FloatPoint. newSetQuery(String field, Collection<Float> values)
Create a query matching any of the specified 1D values.static Query
InetAddressPoint. newSetQuery(String field, InetAddress... values)
Create a query matching any of the specified 1D values.static Query
IntField. newSetQuery(String field, int... values)
Create a query matching values in a supplied setstatic Query
IntPoint. newSetQuery(String field, int... values)
Create a query matching any of the specified 1D values.static Query
IntPoint. newSetQuery(String field, Collection<Integer> values)
Create a query matching any of the specified 1D values.static Query
KeywordField. newSetQuery(String field, Collection<BytesRef> values)
Create a query for matching any of a set of providedBytesRef
values.static Query
KeywordField. newSetQuery(String field, BytesRef... values)
Deprecated, for removal: This API element is subject to removal in a future version.UseKeywordField.newSetQuery(String, Collection)
instead.static Query
LongField. newSetQuery(String field, long... values)
Create a query matching values in a supplied setstatic Query
LongPoint. newSetQuery(String field, long... values)
Create a query matching any of the specified 1D values.static Query
LongPoint. newSetQuery(String field, Collection<Long> values)
Create a query matching any of the specified 1D values.static Query
FeatureField. newSigmoidQuery(String fieldName, String featureName, float weight, float pivot, float exp)
Return a newQuery
that will score documents asweight * S^a / (S^a + pivot^a)
where S is the value of the static feature.static Query
LatLonDocValuesField. newSlowBoxQuery(String field, double minLatitude, double maxLatitude, double minLongitude, double maxLongitude)
Create a query for matching a bounding box using doc values.static Query
XYDocValuesField. newSlowBoxQuery(String field, float minX, float maxX, float minY, float maxY)
Create a query for matching a bounding box using doc values.static Query
LatLonDocValuesField. newSlowDistanceQuery(String field, double latitude, double longitude, double radiusMeters)
Create a query for matching points within the specified distance of the supplied location.static Query
XYDocValuesField. newSlowDistanceQuery(String field, float x, float y, float radius)
Create a query for matching points within the specified distance of the supplied location.static Query
LatLonShape. newSlowDocValuesBoxQuery(String field, ShapeField.QueryRelation queryRelation, double minLatitude, double maxLatitude, double minLongitude, double maxLongitude)
create a docvalue query to find all geo shapes that intersect a defined bounding box *static Query
XYShape. newSlowDocValuesBoxQuery(String field, ShapeField.QueryRelation queryRelation, float minX, float maxX, float minY, float maxY)
create a docvalue query to find all cartesian shapes that intersect a defined bounding box *static Query
NumericDocValuesField. newSlowExactQuery(String field, long value)
Create a query for matching an exact long value.static Query
SortedDocValuesField. newSlowExactQuery(String field, BytesRef value)
Create a query for matching an exactBytesRef
value.static Query
SortedNumericDocValuesField. newSlowExactQuery(String field, long value)
Create a query for matching an exact long value.static Query
SortedSetDocValuesField. newSlowExactQuery(String field, BytesRef value)
Create a query for matching an exactBytesRef
value.static Query
LatLonDocValuesField. newSlowGeometryQuery(String field, ShapeField.QueryRelation queryRelation, LatLonGeometry... latLonGeometries)
Create a query for matching one or more geometries against the providedShapeField.QueryRelation
.static Query
XYDocValuesField. newSlowGeometryQuery(String field, XYGeometry... geometries)
Create a query for matching points within the supplied geometries.static Query
DoubleRangeDocValuesField. newSlowIntersectsQuery(String field, double[] min, double[] max)
Create a new range query that finds all ranges that intersect using doc values.static Query
FloatRangeDocValuesField. newSlowIntersectsQuery(String field, float[] min, float[] max)
Create a new range query that finds all ranges that intersect using doc values.static Query
IntRangeDocValuesField. newSlowIntersectsQuery(String field, int[] min, int[] max)
Create a new range query that finds all ranges that intersect using doc values.static Query
LongRangeDocValuesField. newSlowIntersectsQuery(String field, long[] min, long[] max)
Create a new range query that finds all ranges that intersect using doc values.static Query
LatLonDocValuesField. newSlowPolygonQuery(String field, Polygon... polygons)
Create a query for matching points within the supplied polygons.static Query
XYDocValuesField. newSlowPolygonQuery(String field, XYPolygon... polygons)
Create a query for matching points within the supplied polygons.static Query
NumericDocValuesField. newSlowRangeQuery(String field, long lowerValue, long upperValue)
Create a range query that matches all documents whose value is betweenlowerValue
andupperValue
included.static Query
SortedDocValuesField. newSlowRangeQuery(String field, BytesRef lowerValue, BytesRef upperValue, boolean lowerInclusive, boolean upperInclusive)
Create a range query that matches all documents whose value is betweenlowerValue
andupperValue
included.static Query
SortedNumericDocValuesField. newSlowRangeQuery(String field, long lowerValue, long upperValue)
Create a range query that matches all documents whose value is betweenlowerValue
andupperValue
included.static Query
SortedSetDocValuesField. newSlowRangeQuery(String field, BytesRef lowerValue, BytesRef upperValue, boolean lowerInclusive, boolean upperInclusive)
Create a range query that matches all documents whose value is betweenlowerValue
andupperValue
.static Query
NumericDocValuesField. newSlowSetQuery(String field, long... values)
Create a query matching any of the specified values.static Query
SortedDocValuesField. newSlowSetQuery(String field, Collection<BytesRef> values)
Create a query matching any of the specified values.static Query
SortedDocValuesField. newSlowSetQuery(String field, BytesRef... values)
Deprecated, for removal: This API element is subject to removal in a future version.static Query
SortedNumericDocValuesField. newSlowSetQuery(String field, long... values)
Create a query matching any of the specified values.static Query
SortedSetDocValuesField. newSlowSetQuery(String field, Collection<BytesRef> values)
Create a query matching any of the specified values.static Query
SortedSetDocValuesField. newSlowSetQuery(String field, BytesRef... values)
Deprecated, for removal: This API element is subject to removal in a future version.static Query
KnnByteVectorField. newVectorQuery(String field, byte[] queryVector, int k)
Create a new vector query for the provided field targeting the byte vectorstatic Query
KnnFloatVectorField. newVectorQuery(String field, float[] queryVector, int k)
Create a new vector query for the provided field targeting the float vectorstatic Query
DoubleRange. newWithinQuery(String field, double[] min, double[] max)
Create a query for matching indexed ranges that are within the defined range.static Query
FloatRange. newWithinQuery(String field, float[] min, float[] max)
Create a query for matching indexed ranges that are within the defined range.static Query
InetAddressRange. newWithinQuery(String field, InetAddress min, InetAddress max)
Create a query for matching indexed ip ranges that areWITHIN
the defined range.static Query
IntRange. newWithinQuery(String field, int[] min, int[] max)
Create a query for matching indexed ranges that are within the defined range.static Query
LongRange. 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 long
IndexWriter. deleteDocuments(Query... queries)
Deletes the document(s) matching any of the provided queries.long
IndexWriter. updateDocuments(Query delQuery, Iterable<? extends Iterable<? extends IndexableField>> docs)
Similar toIndexWriter.updateDocuments(Term, Iterable)
, but take a query instead of a term to identify the documents to be updatedConstructor 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 class
AutomatonQuery
AQuery
that will match terms against a finite-state machine.class
BlendedTermQuery
AQuery
that blends index statistics across multiple terms.class
BooleanQuery
A Query that matches documents matching boolean combinations of other queries, e.g.class
BoostQuery
AQuery
wrapper that allows to give a boost to the wrapped query.class
ByteVectorSimilarityQuery
Search for all (approximate) byte vectors above a similarity threshold.class
ConstantScoreQuery
A query that wraps another query and simply returns a constant score equal to 1 for every document that matches the query.class
DisjunctionMaxQuery
A 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.class
DocValuesFieldExistsQuery
Deprecated.UseFieldExistsQuery
instead.class
FieldExistsQuery
AQuery
that matches documents that contain either aKnnFloatVectorField
,KnnByteVectorField
or a field that indexes norms or doc values.class
FloatVectorSimilarityQuery
Search for all (approximate) float vectors above a similarity threshold.class
FuzzyQuery
Implements the fuzzy search query.class
IndexOrDocValuesQuery
A 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.class
IndexSortSortedNumericDocValuesRangeQuery
A range query that can take advantage of the fact that the index is sorted to speed up execution.class
IndriAndQuery
A Query that matches documents matching combinations of subqueries.class
IndriQuery
A Basic abstract query that all IndriQueries can extend to implement toString, equals, getClauses, and iterator.class
KnnByteVectorQuery
UsesKnnVectorsReader.search(String, byte[], KnnCollector, Bits)
to perform nearest neighbour search.class
KnnFloatVectorQuery
UsesKnnVectorsReader.search(String, float[], KnnCollector, Bits)
to perform nearest neighbour search.class
KnnVectorFieldExistsQuery
Deprecated.UseFieldExistsQuery
instead.class
KnnVectorQuery
Deprecated.useKnnFloatVectorQuery
insteadclass
MatchAllDocsQuery
A query that matches all documents.class
MatchNoDocsQuery
A query that matches no documents.class
MultiPhraseQuery
A generalized version ofPhraseQuery
, with the possibility of adding more than one term at the same position that are treated as a disjunction (OR).class
MultiTermQuery
An abstractQuery
that matches documents containing a subset of terms provided by aFilteredTermsEnum
enumeration.class
NGramPhraseQuery
This is aPhraseQuery
which is optimized for n-gram phrase query.class
NormsFieldExistsQuery
Deprecated.UseFieldExistsQuery
instead.class
PhraseQuery
A Query that matches documents containing a particular sequence of terms.class
PointInSetQuery
Abstract query class to find all documents whose single or multi-dimensional point values, previously indexed with e.g.class
PointRangeQuery
Abstract class for range queries against single or multidimensional points such asIntPoint
.class
PrefixQuery
A Query that matches documents containing terms with a specified prefix.class
RegexpQuery
A fast regular expression query based on theorg.apache.lucene.util.automaton
package.class
SynonymQuery
A query that treats multiple terms as synonyms.class
TermInSetQuery
Specialization for a disjunction over many terms that, by default, behaves like aConstantScoreQuery
over aBooleanQuery
containing onlyBooleanClause.Occur.SHOULD
clauses.class
TermQuery
A Query that matches documents containing a term.class
TermRangeQuery
A Query that matches documents within an range of terms.class
WildcardQuery
Implements the wildcard search query.Fields in org.apache.lucene.search declared as Query Modifier and Type Field Description protected Query
AbstractVectorSimilarityQuery. filter
protected Query
AbstractVectorSimilarityQuery. filter
protected Query
Weight. parentQuery
Methods in org.apache.lucene.search that return Query Modifier and Type Method Description protected Query
MultiTermQuery.TopTermsBlendedFreqScoringRewrite. build(BlendedTermQuery.Builder builder)
protected Query
MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite. build(BooleanQuery.Builder builder)
protected Query
MultiTermQuery.TopTermsScoringBooleanQueryRewrite. build(BooleanQuery.Builder builder)
Query
IndexSortSortedNumericDocValuesRangeQuery. getFallbackQuery()
Query
IndexOrDocValuesQuery. getIndexQuery()
Return the wrapped query that may be costly to initialize but has a good iterator.Query
BooleanClause. getQuery()
Query
BoostQuery. getQuery()
Return the wrappedQuery
.Query
ConstantScoreQuery. getQuery()
Returns the encapsulated query.Query
FilterMatchesIterator. getQuery()
Query
MatchesIterator. getQuery()
Returns the Query causing the current matchQuery
Weight. getQuery()
The query that this concerns.Query
IndexOrDocValuesQuery. 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.Query
BlendedTermQuery.DisjunctionMaxRewrite. rewrite(Query[] subQueries)
Query
BlendedTermQuery. rewrite(IndexSearcher indexSearcher)
abstract Query
BlendedTermQuery.RewriteMethod. rewrite(Query[] subQueries)
Merge the provided sub queries into a singleQuery
object.Query
BooleanQuery. rewrite(IndexSearcher indexSearcher)
Query
BoostQuery. rewrite(IndexSearcher indexSearcher)
Query
ConstantScoreQuery. rewrite(IndexSearcher indexSearcher)
Query
DisjunctionMaxQuery. rewrite(IndexSearcher indexSearcher)
Optimize our representation and our subqueries representationsQuery
DocValuesRewriteMethod. rewrite(IndexReader reader, MultiTermQuery query)
Query
FieldExistsQuery. rewrite(IndexSearcher indexSearcher)
Query
IndexOrDocValuesQuery. rewrite(IndexSearcher indexSearcher)
Query
IndexSearcher. rewrite(Query original)
Expert: called to re-write queries into primitive queries.Query
IndexSortSortedNumericDocValuesRangeQuery. rewrite(IndexSearcher indexSearcher)
Query
MultiPhraseQuery. rewrite(IndexSearcher indexSearcher)
Query
MultiTermQuery. rewrite(IndexSearcher indexSearcher)
To rewrite to a simpler form, instead return a simpler enum fromMultiTermQuery.getTermsEnum(Terms, AttributeSource)
.abstract Query
MultiTermQuery.RewriteMethod. rewrite(IndexReader reader, MultiTermQuery query)
Query
NGramPhraseQuery. rewrite(IndexSearcher indexSearcher)
Query
PhraseQuery. rewrite(IndexSearcher indexSearcher)
Query
Query. rewrite(IndexReader reader)
Deprecated.Query
Query. rewrite(IndexSearcher indexSearcher)
Expert: called to re-write queries into primitive queries.Query
ScoringRewrite. rewrite(IndexReader reader, MultiTermQuery query)
Query
SynonymQuery. rewrite(IndexSearcher indexSearcher)
Query
TopTermsRewrite. rewrite(IndexReader reader, MultiTermQuery query)
static Query
NamedMatches. wrapQuery(String name, Query in)
Wrap a Query so that it associates a name with itsMatches
Methods in org.apache.lucene.search that return types with arguments of type Query Modifier and Type Method Description Collection<Query>
DisjunctionMaxQuery. getDisjuncts()
Iterator<Query>
DisjunctionMaxQuery. iterator()
Methods in org.apache.lucene.search with parameters of type Query Modifier and Type Method Description BooleanQuery.Builder
BooleanQuery.Builder. add(Query query, BooleanClause.Occur occur)
Add a new clause to thisBooleanQuery.Builder
.void
LRUQueryCache. clearQuery(Query query)
Remove all cache entries for the given query.void
QueryVisitor. consumeTerms(Query query, Term... terms)
Called by leaf queries that match on specific termsvoid
QueryVisitor. consumeTermsMatching(Query query, String field, Supplier<ByteRunAutomaton> automaton)
Called by leaf queries that match on a class of termsint
IndexSearcher. count(Query query)
Count how many documents match the given query.Weight
IndexSearcher. createWeight(Query query, ScoreMode scoreMode, float boost)
Creates aWeight
for the given query, potentially adding caching if possible and configured.static MatchesIterator
MatchesUtils. disjunction(LeafReaderContext context, int doc, Query query, String field, BytesRefIterator terms)
Create a MatchesIterator that is a disjunction over a list of terms extracted from aBytesRefIterator
.Explanation
IndexSearcher. explain(Query query, int doc)
Returns an Explanation that describes howdoc
scored againstquery
.static DoubleValuesSource
DoubleValuesSource. fromQuery(Query query)
Create a DoubleValuesSource that returns the score of a particular queryQueryVisitor
QueryVisitor. getSubVisitor(BooleanClause.Occur occur, Query parent)
Pulls a visitor instance for visiting child clauses of a queryprotected int
UsageTrackingQueryCachingPolicy. minFrequencyToCache(Query query)
For a given filter, return how many times it should appear in the history before being cached.protected void
LRUQueryCache. onHit(Object readerCoreKey, Query query)
Expert: callback when there is a cache hit on a given query.protected void
LRUQueryCache. onMiss(Object readerCoreKey, Query query)
Expert: callback when there is a cache miss on a given query.protected void
LRUQueryCache. onQueryCache(Query query, long ramBytesUsed)
Expert: callback when a query is added to this cache.protected void
LRUQueryCache. onQueryEviction(Query query, long ramBytesUsed)
Expert: callback when a query is evicted from this cache.void
QueryCachingPolicy. onUse(Query query)
Callback that is called every time that a cached filter is used.void
UsageTrackingQueryCachingPolicy. onUse(Query query)
static void
TopFieldCollector. populateScores(ScoreDoc[] topDocs, IndexSearcher searcher, Query query)
Populatescores
of the giventopDocs
.static TopDocs
QueryRescorer. rescore(IndexSearcher searcher, TopDocs topDocs, Query query, double weight, int topN)
Sugar API, calling {#rescore} using a simple linear combination of firstPassScore + weight * secondPassScoreQuery
BlendedTermQuery.DisjunctionMaxRewrite. rewrite(Query[] subQueries)
abstract Query
BlendedTermQuery.RewriteMethod. rewrite(Query[] subQueries)
Merge the provided sub queries into a singleQuery
object.Query
IndexSearcher. rewrite(Query original)
Expert: called to re-write queries into primitive queries.TopDocs
IndexSearcher. search(Query query, int n)
Finds the topn
hits forquery
.TopFieldDocs
IndexSearcher. search(Query query, int n, Sort sort)
Search implementation with arbitrary sorting.TopFieldDocs
IndexSearcher. search(Query query, int n, Sort sort, boolean doDocScores)
Search implementation with arbitrary sorting, plus control over whether hit scores and max score should be computed.void
IndexSearcher. search(Query query, Collector results)
Deprecated.This method is being deprecated in favor ofIndexSearcher.search(Query, CollectorManager)
due to its support for concurrency in IndexSearcher<C extends Collector,T>
TIndexSearcher. search(Query query, CollectorManager<C,T> collectorManager)
Lower-level search API.TopDocs
IndexSearcher. searchAfter(ScoreDoc after, Query query, int numHits)
Finds the topn
hits forquery
where all results are after a previous result (after
).TopDocs
IndexSearcher. searchAfter(ScoreDoc after, Query query, int n, Sort sort)
Finds the topn
hits forquery
where all results are after a previous result (after
).TopFieldDocs
IndexSearcher. searchAfter(ScoreDoc after, Query query, int numHits, Sort sort, boolean doDocScores)
Finds the topn
hits forquery
where all results are after a previous result (after
), allowing control over whether hit scores and max score should be computed.boolean
QueryCachingPolicy. shouldCache(Query query)
Whether the givenQuery
is worth caching.boolean
UsageTrackingQueryCachingPolicy. shouldCache(Query query)
void
QueryVisitor. visitLeaf(Query query)
Called by leaf queries that do not match on termsstatic Query
NamedMatches. wrapQuery(String name, Query in)
Wrap a Query so that it associates a name with itsMatches
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: wrapquery
in such a way that the produced scores will be boosted byboost
.ByteVectorSimilarityQuery(String field, byte[] target, float traversalSimilarity, float resultSimilarity, Query filter)
Search for all (approximate) byte vectors above a similarity threshold usingVectorSimilarityCollector
.ByteVectorSimilarityQuery(String field, byte[] target, float resultSimilarity, Query filter)
Search for all (approximate) byte vectors above a similarity threshold usingVectorSimilarityCollector
.ConstantScoreQuery(Query query)
Strips off scores from the passed in Query.ConstantScoreWeight(Query query, float score)
FilterWeight(Query query, Weight weight)
Alternative constructor.FloatVectorSimilarityQuery(String field, float[] target, float traversalSimilarity, float resultSimilarity, Query filter)
Search for all (approximate) float vectors above a similarity threshold usingVectorSimilarityCollector
.FloatVectorSimilarityQuery(String field, float[] target, float resultSimilarity, Query filter)
Search for all (approximate) float vectors above a similarity threshold usingVectorSimilarityCollector
.IndexOrDocValuesQuery(Query indexQuery, Query dvQuery)
Create anIndexOrDocValuesQuery
.IndexSortSortedNumericDocValuesRangeQuery(String field, long lowerValue, long upperValue, Query fallbackQuery)
Creates a newIndexSortSortedNumericDocValuesRangeQuery
.KnnByteVectorQuery(String field, byte[] target, int k, Query filter)
Find thek
nearest documents to the target vector according to the vectors in the given field.KnnFloatVectorQuery(String field, float[] target, int k, Query filter)
Find thek
nearest documents to the target vector according to the vectors in the given field.KnnVectorQuery(String field, float[] target, int k, Query filter)
Deprecated.PhraseWeight(Query query, String field, IndexSearcher searcher, ScoreMode scoreMode)
Expert: Creates PhraseWeight instanceQueryRescorer(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.util
Methods in org.apache.lucene.util that return Query Modifier and Type Method Description protected Query
QueryBuilder. analyzeBoolean(String field, TokenStream stream)
Creates simple boolean query from the cached tokenstream contentsprotected Query
QueryBuilder. analyzeGraphBoolean(String field, TokenStream source, BooleanClause.Occur operator)
Creates a boolean query from a graph token stream.protected Query
QueryBuilder. analyzeGraphPhrase(TokenStream source, String field, int phraseSlop)
Creates graph phrase query from the tokenstream contentsprotected Query
QueryBuilder. analyzeMultiBoolean(String field, TokenStream stream, BooleanClause.Occur operator)
Creates complex boolean query from the cached tokenstream contentsprotected Query
QueryBuilder. analyzeMultiPhrase(String field, TokenStream stream, int slop)
Creates complex phrase query from the cached tokenstream contentsprotected Query
QueryBuilder. analyzePhrase(String field, TokenStream stream, int slop)
Creates simple phrase query from the cached tokenstream contentsprotected Query
QueryBuilder. analyzeTerm(String field, TokenStream stream)
Creates simple term query from the cached tokenstream contentsQuery
QueryBuilder. createBooleanQuery(String field, String queryText)
Creates a boolean query from the query text.Query
QueryBuilder. createBooleanQuery(String field, String queryText, BooleanClause.Occur operator)
Creates a boolean query from the query text.protected Query
QueryBuilder. createFieldQuery(Analyzer analyzer, BooleanClause.Occur operator, String field, String queryText, boolean quoted, int phraseSlop)
Creates a query from the analysis chain.protected Query
QueryBuilder. createFieldQuery(TokenStream source, BooleanClause.Occur operator, String field, boolean quoted, int phraseSlop)
Creates a query from a token stream.Query
QueryBuilder. createMinShouldMatchQuery(String field, String queryText, float fraction)
Creates a minimum-should-match query from the query text.Query
QueryBuilder. createPhraseQuery(String field, String queryText)
Creates a phrase query from the query text.Query
QueryBuilder. createPhraseQuery(String field, String queryText, int phraseSlop)
Creates a phrase query from the query text.protected Query
QueryBuilder. newGraphSynonymQuery(Iterator<Query> queries)
Builds a new GraphQuery for multi-terms synonyms.protected Query
QueryBuilder. newSynonymQuery(String field, QueryBuilder.TermAndBoost[] terms)
Builds a new SynonymQuery instance.protected Query
QueryBuilder. newTermQuery(Term term, float boost)
Builds a new TermQuery instance.Methods in org.apache.lucene.util with parameters of type Query Modifier and Type Method Description static long
RamUsageEstimator. sizeOf(Query q)
Returns the size in bytes of a Query object.static long
RamUsageEstimator. sizeOf(Query q, long defSize)
Returns the size in bytes of a Query object.Method parameters in org.apache.lucene.util with type arguments of type Query Modifier and Type Method Description protected Query
QueryBuilder. newGraphSynonymQuery(Iterator<Query> queries)
Builds a new GraphQuery for multi-terms synonyms. -
Uses of Query in org.apache.lucene.util.automaton
Methods in org.apache.lucene.util.automaton with parameters of type Query Modifier and Type Method Description void
CompiledAutomaton. visit(QueryVisitor visitor, Query parent, String field)
Report back to a QueryVisitor how this automaton matches terms
-