summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/sort_key_generator.h
diff options
context:
space:
mode:
authorYunhe (John) Wang <yunhe.wang@mongodb.com>2015-09-24 15:27:24 -0400
committerYunhe (John) Wang <yunhe.wang@mongodb.com>2015-10-12 13:50:30 -0400
commit28a2d6fa3f7fb6659f578d69e6d772ae9be8c25e (patch)
tree8e5fd9aff1cf072d171f634fd819fdc5a69b09f9 /src/mongo/db/exec/sort_key_generator.h
parent2039dd73fba411967b2b1ead07f3ab2e542e65a1 (diff)
downloadmongo-28a2d6fa3f7fb6659f578d69e6d772ae9be8c25e.tar.gz
SERVER-20117 Allow queries with meta sortkey to be covered in mongos
Diffstat (limited to 'src/mongo/db/exec/sort_key_generator.h')
-rw-r--r--src/mongo/db/exec/sort_key_generator.h19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/mongo/db/exec/sort_key_generator.h b/src/mongo/db/exec/sort_key_generator.h
index 15bf709fc56..555d6b8ce6b 100644
--- a/src/mongo/db/exec/sort_key_generator.h
+++ b/src/mongo/db/exec/sort_key_generator.h
@@ -53,17 +53,20 @@ public:
* ensure that the value we select to sort by is within bounds generated by
* executing 'queryObj' using the virtual index with key pattern 'sortSpec'.
*/
- SortKeyGenerator(const Collection* collection,
- const BSONObj& sortSpec,
- const BSONObj& queryObj);
+ SortKeyGenerator(const BSONObj& sortSpec, const BSONObj& queryObj);
/**
- * Returns the key used to sort 'member'.
+ * Returns the key used to sort 'member'. If the member is in LOC_AND_IDX state, it must not
+ * contain a $meta textScore in its sort spec, and this function will use the index key data
+ * stored in 'member' to extract the sort key. Otherwise, if the member is in LOC_AND_OBJ or
+ * OWNED_OBJ state, this function will use the object data stored in 'member' to extract the
+ * sort key.
*/
Status getSortKey(const WorkingSetMember& member, BSONObj* objOut) const;
private:
- Status getBtreeKey(const BSONObj& memberObj, BSONObj* objOut) const;
+ StatusWith<BSONObj> getSortKeyFromIndexKey(const WorkingSetMember& member) const;
+ StatusWith<BSONObj> getSortKeyFromObject(const WorkingSetMember& member) const;
/**
* In order to emulate the existing sort behavior we must make unindexed sort behavior as
@@ -75,9 +78,6 @@ private:
*/
void getBoundsForSort(const BSONObj& queryObj, const BSONObj& sortObj);
- // Not owned by us
- const Collection* _collection;
-
// The raw object in .sort()
BSONObj _rawSortSpec;
@@ -109,7 +109,6 @@ public:
SortKeyGeneratorStage(OperationContext* opCtx,
PlanStage* child,
WorkingSet* ws,
- const Collection* collection,
const BSONObj& sortSpecObj,
const BSONObj& queryObj);
@@ -130,8 +129,6 @@ public:
private:
WorkingSet* const _ws;
- const Collection* const _collection;
-
// The raw sort pattern as expressed by the user.
const BSONObj _sortSpec;