summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/document_value/document_metadata_fields.cpp
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-14 14:26:38 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-14 14:26:38 -0300
commit294bc6ecabf14c09c9bc8644704921dcf97cb44e (patch)
tree279b1e0bab53901a1647ac63c1c724f0f789a663 /src/mongo/db/exec/document_value/document_metadata_fields.cpp
parent70be7c27a251621187a1de533462ae2bb1e3bd39 (diff)
parent1e917fd798aa25b7066d4b414b51184f13d5a092 (diff)
Update upstream source from tag 'upstream/6.0.10'debian/6.0.10-1
Update to upstream version '6.0.10' with Debian dir 2d176fa254eee97b139f712fec5709641335a8c3
Diffstat (limited to 'src/mongo/db/exec/document_value/document_metadata_fields.cpp')
-rw-r--r--src/mongo/db/exec/document_value/document_metadata_fields.cpp39
1 files changed, 36 insertions, 3 deletions
diff --git a/src/mongo/db/exec/document_value/document_metadata_fields.cpp b/src/mongo/db/exec/document_value/document_metadata_fields.cpp
index 90e15ef5c2a..0532ed2e8cb 100644
--- a/src/mongo/db/exec/document_value/document_metadata_fields.cpp
+++ b/src/mongo/db/exec/document_value/document_metadata_fields.cpp
@@ -46,6 +46,7 @@ DocumentMetadataFields::DocumentMetadataFields(const DocumentMetadataFields& oth
DocumentMetadataFields& DocumentMetadataFields::operator=(const DocumentMetadataFields& other) {
_holder = other._holder ? std::make_unique<MetadataHolder>(*other._holder) : nullptr;
+ _modified = true;
return *this;
}
@@ -54,6 +55,7 @@ DocumentMetadataFields::DocumentMetadataFields(DocumentMetadataFields&& other)
DocumentMetadataFields& DocumentMetadataFields::operator=(DocumentMetadataFields&& other) {
_holder = std::move(other._holder);
+ _modified = true;
return *this;
}
@@ -91,6 +93,12 @@ void DocumentMetadataFields::mergeWith(const DocumentMetadataFields& other) {
if (!hasTimeseriesBucketMaxTime() && other.hasTimeseriesBucketMaxTime()) {
setTimeseriesBucketMaxTime(other.getTimeseriesBucketMaxTime());
}
+ if (!hasSearchSortValues() && other.hasSearchSortValues()) {
+ setSearchSortValues(other.getSearchSortValues());
+ }
+ if (!hasVectorSearchScore() && other.hasVectorSearchScore()) {
+ setVectorSearchScore(other.getVectorSearchScore());
+ }
}
void DocumentMetadataFields::copyFrom(const DocumentMetadataFields& other) {
@@ -127,6 +135,12 @@ void DocumentMetadataFields::copyFrom(const DocumentMetadataFields& other) {
if (other.hasTimeseriesBucketMaxTime()) {
setTimeseriesBucketMaxTime(other.getTimeseriesBucketMaxTime());
}
+ if (other.hasSearchSortValues()) {
+ setSearchSortValues(other.getSearchSortValues());
+ }
+ if (other.hasVectorSearchScore()) {
+ setVectorSearchScore(other.getVectorSearchScore());
+ }
}
size_t DocumentMetadataFields::getApproximateSize() const {
@@ -148,7 +162,7 @@ size_t DocumentMetadataFields::getApproximateSize() const {
size -= sizeof(_holder->searchHighlights);
size += _holder->indexKey.objsize();
size += _holder->searchScoreDetails.objsize();
-
+ size += _holder->searchSortValues.objsize();
return size;
}
@@ -204,6 +218,14 @@ void DocumentMetadataFields::serializeForSorter(BufBuilder& buf) const {
buf.appendNum(static_cast<char>(MetaType::kTimeseriesBucketMaxTime + 1));
buf.appendNum(getTimeseriesBucketMaxTime().toMillisSinceEpoch());
}
+ if (hasSearchSortValues()) {
+ buf.appendNum(static_cast<char>(MetaType::kSearchSortValues + 1));
+ getSearchSortValues().appendSelfToBufBuilder(buf);
+ }
+ if (hasVectorSearchScore()) {
+ buf.appendNum(static_cast<char>(MetaType::kVectorSearchScore + 1));
+ buf.appendNum(getVectorSearchScore());
+ }
buf.appendNum(static_cast<char>(0));
}
@@ -236,9 +258,16 @@ void DocumentMetadataFields::deserializeForSorter(BufReader& buf, DocumentMetada
out->setSearchScoreDetails(
BSONObj::deserializeForSorter(buf, BSONObj::SorterDeserializeSettings()));
} else if (marker == static_cast<char>(MetaType::kTimeseriesBucketMinTime) + 1) {
- out->setTimeseriesBucketMinTime(Date_t::fromMillisSinceEpoch(buf.read<long long>()));
+ out->setTimeseriesBucketMinTime(
+ Date_t::fromMillisSinceEpoch(buf.read<LittleEndian<long long>>()));
} else if (marker == static_cast<char>(MetaType::kTimeseriesBucketMaxTime) + 1) {
- out->setTimeseriesBucketMaxTime(Date_t::fromMillisSinceEpoch(buf.read<long long>()));
+ out->setTimeseriesBucketMaxTime(
+ Date_t::fromMillisSinceEpoch(buf.read<LittleEndian<long long>>()));
+ } else if (marker == static_cast<char>(MetaType::kSearchSortValues) + 1) {
+ out->setSearchSortValues(
+ BSONObj::deserializeForSorter(buf, BSONObj::SorterDeserializeSettings()));
+ } else if (marker == static_cast<char>(MetaType::kVectorSearchScore) + 1) {
+ out->setVectorSearchScore(buf.read<LittleEndian<double>>());
} else {
uasserted(28744, "Unrecognized marker, unable to deserialize buffer");
}
@@ -298,6 +327,10 @@ const char* DocumentMetadataFields::typeNameToDebugString(DocumentMetadataFields
return "timeseries bucket min time";
case DocumentMetadataFields::kTimeseriesBucketMaxTime:
return "timeseries bucket max time";
+ case DocumentMetadataFields::kSearchSortValues:
+ return "$search sort values";
+ case DocumentMetadataFields::kVectorSearchScore:
+ return "$vectorSearch distance";
default:
MONGO_UNREACHABLE;
}