Github user rmuir commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/129#discussion_r25448647
--- Diff:
lucene/expressions/src/java/org/apache/lucene/expressions/js/JavascriptCompiler.java
---
@@ -565,11 +566,16 @@ private static int findSingleQuoteStringEnd(String
text, int start) {
checkFunction(method, JavascriptCompiler.class.getClassLoader());
map.put(call, method);
}
+ map.put("now", JavascriptCompiler.class.getMethod("getNow"));
} catch (ReflectiveOperationException | IOException e) {
throw new Error("Cannot resolve function", e);
}
DEFAULT_FUNCTIONS = Collections.unmodifiableMap(map);
}
+
--- End diff --
I am not sure we should add this function, for example it will not work in
a distributed setup (where now needs to be 'set' to a value). Also these
functions need to be idempotent, and return the same thing for the same inputs.
If someone wants this functionality they can currently expose with
bindings, a ConstantValueSource named "_now" or "now" that they initialize to
the time up front that they want, and its consistent across the entire
expression, and that allows it to work in a distributed case as well.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]