|
|
@@ -19,31 +19,20 @@ klass.parse = function parse(expr, vpsIn) {
|
|
|
|
|
|
//PROTOTYPE MEMBERS
|
|
|
proto.serialize = function serialize(explain) {
|
|
|
-
|
|
|
+ var doc = {};
|
|
|
+ doc[META] = this.textScore;
|
|
|
+ return doc;
|
|
|
+ //NOTE: Mongo does this: return Value(DOC("$meta" << "textScore"));
|
|
|
};
|
|
|
|
|
|
proto.evaluateInternal = function evaluateInternal(vars) {
|
|
|
-
|
|
|
+ var doc = vars.getRoot();
|
|
|
+ return root.hasTextScore() ? root.getTextScore : undefined;
|
|
|
};
|
|
|
|
|
|
proto.addDependencies = function addDependencies(deps, path) {
|
|
|
-
|
|
|
+ deps.needTextScore = true;
|
|
|
};
|
|
|
|
|
|
/** Register Expression */
|
|
|
-Expression.registerExpression(klass.opName, base.parse(klass));
|
|
|
-
|
|
|
- Value ExpressionMeta::serialize(bool explain) const {
|
|
|
- return Value(DOC("$meta" << "textScore"));
|
|
|
- }
|
|
|
-
|
|
|
- Value ExpressionMeta::evaluateInternal(Variables* vars) const {
|
|
|
- const Document& root = vars->getRoot();
|
|
|
- return root.hasTextScore()
|
|
|
- ? Value(root.getTextScore())
|
|
|
- : Value();
|
|
|
- }
|
|
|
-
|
|
|
- void ExpressionMeta::addDependencies(DepsTracker* deps, vector<string>* path) const {
|
|
|
- deps->needTextScore = true;
|
|
|
- }
|
|
|
+Expression.registerExpression(klass.opName, base.parse(klass));
|