-
Type:
Task
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Integration
-
Fully Compatible
-
None
-
3
-
TBD
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Multiple places in the $scoreFusion and $rankFusion implementation we iterate over a list of document source to append them to a list of other document sources. Like:
for (auto&& stage : someStages) {
otherStages.emplace_back(stage);
}
- here is an existing standard library function std::list::splice
- that does this type of operation succinctly in a single call. The example above can be written like:
otherStages.splice(otherStages.begin(), someStages);
This function generalizes to be able to insert stages to the back of another list, or in the middle.
Here are some places I've found were were doing this:
- here
- here
- here - this one is a std::vector (which doesn't have splice) as well as adding fields from a BSONObj so the most efficient implementation is probably the one written
- here - ditto
- here
- here
Its possible that by the time this ticket is addressed some of these example may not apply, or that there are other examples I did not identify. Regardless, when doing this ticket, the final state is that all of the for loop style stitchings are replaced with splice.