summaryrefslogtreecommitdiff
path: root/databases/mongodb70/files/patch-src_mongo_db_exec_near.cpp
blob: 0bbdb149268d7d94339187fbeca2be72182a1534 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--- src/mongo/db/exec/near.cpp.orig	2023-06-15 22:07:57 UTC
+++ src/mongo/db/exec/near.cpp
@@ -42,6 +42,21 @@ using std::vector;
 using std::unique_ptr;
 using std::vector;
 
+/**
+ * Holds a generic search result with a distance computed in some fashion.
+ */
+struct NearStage::SearchResult {
+    SearchResult(WorkingSetID resultID, double distance) : resultID(resultID), distance(distance) {}
+
+    bool operator<(const SearchResult& other) const {
+        // We want increasing distance, not decreasing, so we reverse the <
+        return distance > other.distance;
+    }
+
+    WorkingSetID resultID;
+    double distance;
+};
+
 NearStage::NearStage(ExpressionContext* expCtx,
                      const char* typeName,
                      StageType type,
@@ -113,21 +128,6 @@ PlanStage::StageState NearStage::doWork(WorkingSetID* 
 
     return nextState;
 }
-
-/**
- * Holds a generic search result with a distance computed in some fashion.
- */
-struct NearStage::SearchResult {
-    SearchResult(WorkingSetID resultID, double distance) : resultID(resultID), distance(distance) {}
-
-    bool operator<(const SearchResult& other) const {
-        // We want increasing distance, not decreasing, so we reverse the <
-        return distance > other.distance;
-    }
-
-    WorkingSetID resultID;
-    double distance;
-};
 
 // Set "toReturn" when NEED_YIELD.
 PlanStage::StageState NearStage::bufferNext(WorkingSetID* toReturn) {