lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmuir <>
Subject [GitHub] lucene-solr pull request: Adding now() support to expressions
Date Thu, 26 Feb 2015 17:59:29 GMT
Github user rmuir commented on a diff in the pull request:
    --- Diff: lucene/expressions/src/java/org/apache/lucene/expressions/js/
    @@ -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 or file a JIRA ticket
with INFRA.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message