Package com.mongodb.client.model
Class RerankQuery
java.lang.Object
com.mongodb.client.model.RerankQuery
- All Implemented Interfaces:
Bson
Represents a query for the
$rerank aggregation pipeline stage.
The $rerank stage is available only in MongoDB Atlas.
Use rerankQuery(String) for a simple text query, or
rerankQuery(Bson) to specify the full query document directly
(e.g., for future modalities like imageURL or videoURL).
- Since:
- 5.8
- Since server release
- 8.3
-
Field Summary
Fields inherited from interface org.bson.conversions.Bson
DEFAULT_CODEC_REGISTRY -
Method Summary
Modifier and TypeMethodDescriptionstatic RerankQueryrerankQuery(String text) Creates a rerank query with the specified text.static RerankQueryrerankQuery(Bson query) Creates a rerank query from a full query document.<TDocument>
BsonDocumenttoBsonDocument(Class<TDocument> documentClass, CodecRegistry codecRegistry) toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.bson.conversions.Bson
toBsonDocument
-
Method Details
-
rerankQuery
Creates a rerank query with the specified text.This is a convenience for
rerankQuery(new Document("text", text)).- Parameters:
text- the query text to rerank against.- Returns:
- a new
RerankQuery
-
rerankQuery
Creates a rerank query from a full query document.Use this overload for future query modalities (e.g., imageURL, videoURL) or to pass additional fields alongside text.
- Parameters:
query- the query document.- Returns:
- a new
RerankQuery
-
toBsonDocument
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> documentClass, CodecRegistry codecRegistry) - Specified by:
toBsonDocumentin interfaceBson
-
toString
-