Class ExpressionValueSource

    • Method Detail

      • zeroWhenUnpositioned

        static DoubleValues zeroWhenUnpositioned​(DoubleValues in)
        Create a wrapper around all the expression arguments to do two things:
        1. Default to 0 for any argument that doesn't have a value for a given doc (i.e., #advanceExact returns false)
        2. Be as lazy as possible about actually advancing to the given doc until the argument value is actually needed by the expression. For a given doc, some arguments may not actually be needed, e.g., because of condition short-circuiting ((true || X) doesn't need to evaluate X) or ternary branching (true ? X : Y doesn't need to evaluate Y).
      • isCacheable

        public boolean isCacheable​(LeafReaderContext ctx)
        Returns:
        true if the object can be cached against a given leaf
      • explain

        public Explanation explain​(LeafReaderContext ctx,
                                   int docId,
                                   Explanation scoreExplanation)
                            throws java.io.IOException
        Description copied from class: DoubleValuesSource
        An explanation of the value for the named document.
        Overrides:
        explain in class DoubleValuesSource
        Parameters:
        ctx - the readers context to create the Explanation for.
        docId - the document's id relative to the given context's reader
        Returns:
        an Explanation for the value
        Throws:
        java.io.IOException - if an IOException occurs