diff options
| author | Alyssa Wagenmaker <alyssa.wagenmaker@mongodb.com> | 2023-09-01 18:02:11 +0000 |
|---|---|---|
| committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-09-01 18:43:21 +0000 |
| commit | 8e4b5670df9b9fe814e57cb5f3f8ee9407237b5a (patch) | |
| tree | 2c2f75187377c70d9772c5fac171470fc2b8f7b0 /src/mongo/db/exec/document_value/document.cpp | |
| parent | 69353845c8a545dc5a763ee199d9002e7cb95e6c (diff) | |
SERVER-79498 Introduce vectorSearch aggregation stager6.0.10-rc0r6.0.10
Co-authored-by: Chi-I Huang <chii.huang@mongodb.com>
Co-authored-by: Hima Sheth <hima.sheth@mongodb.com>
Diffstat (limited to 'src/mongo/db/exec/document_value/document.cpp')
| -rw-r--r-- | src/mongo/db/exec/document_value/document.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mongo/db/exec/document_value/document.cpp b/src/mongo/db/exec/document_value/document.cpp index fd50895c9a1..4488af81f3b 100644 --- a/src/mongo/db/exec/document_value/document.cpp +++ b/src/mongo/db/exec/document_value/document.cpp @@ -90,7 +90,8 @@ const StringDataSet Document::allMetadataFieldNames{Document::metaFieldTextScore Document::metaFieldSearchHighlights, Document::metaFieldSearchSortValues, Document::metaFieldIndexKey, - Document::metaFieldSearchScoreDetails}; + Document::metaFieldSearchScoreDetails, + Document::metaFieldVectorSearchScore}; DocumentStorageIterator::DocumentStorageIterator(DocumentStorage* storage, BSONObjIterator bsonIt) : _bsonIt(std::move(bsonIt)), @@ -467,6 +468,8 @@ void DocumentStorage::loadLazyMetadata() const { _metadataFields.setSearchScoreDetails(elem.Obj()); } else if (fieldName == Document::metaFieldSearchSortValues) { _metadataFields.setSearchSortValues(elem.Obj()); + } else if (fieldName == Document::metaFieldVectorSearchScore) { + _metadataFields.setVectorSearchScore(elem.Double()); } } } @@ -537,6 +540,7 @@ constexpr StringData Document::metaFieldSearchScore; constexpr StringData Document::metaFieldSearchHighlights; constexpr StringData Document::metaFieldSearchScoreDetails; constexpr StringData Document::metaFieldSearchSortValues; +constexpr StringData Document::metaFieldVectorSearchScore; void Document::toBsonWithMetaData(BSONObjBuilder* builder) const { toBson(builder); @@ -567,6 +571,9 @@ void Document::toBsonWithMetaData(BSONObjBuilder* builder) const { if (metadata().hasSearchSortValues()) { builder->append(metaFieldSearchSortValues, metadata().getSearchSortValues()); } + if (metadata().hasVectorSearchScore()) { + builder->append(metaFieldVectorSearchScore, metadata().getVectorSearchScore()); + } } Document Document::fromBsonWithMetaData(const BSONObj& bson) { |
