Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-8574

ExpressionFunctionValues should cache per-hit value

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 7.5, 8.0
    • Fix Version/s: master (9.0), 8.7
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      The original version of ExpressionFunctionValues had a simple per-hit cache, so that nested expressions that reference the same common variable would compute the value for that variable the first time it was referenced and then use that cached value for all subsequent invocations, within one hit.  I think it was accidentally removed in LUCENE-7609?

      This is quite important if you have non-trivial expressions that reference the same variable multiple times.

      E.g. if I have these expressions:

      x = c + d
      c = b + 2 
      d = b * 2

      Then evaluating x should only cause b's value to be computed once (for a given hit), but today it's computed twice.  The problem is combinatoric if b then references another variable multiple times, etc.

      I think to fix this we just need to restore the per-hit cache?

       

        Attachments

        1. LUCENE-8574.patch
          1 kB
          Robert Muir
        2. unit_test.patch
          3 kB
          Haoyu Zhai

          Issue Links

            Activity

              People

              • Assignee:
                rcmuir Robert Muir
                Reporter:
                mikemccand Michael McCandless
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 3h 20m
                  3h 20m