Lucene - Core
  1. Lucene - Core
  2. LUCENE-6888

explain of map() Function does not show default value

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.4, 6.0
    • Component/s: core/query/scoring
    • Labels:
    • Lucene Fields:
      New

      Description

      The explain output from the map(x,min,max,target,default) function does not print default.

      1. LUCENE-6888.patch
        4 kB
        Jan Høydahl
      2. LUCENE-6888.patch
        4 kB
        Jan Høydahl

        Activity

        Hide
        Jan Høydahl added a comment -

        Code in RangeMapFloatFunction:

          @Override
          public String description() {
            return "map(" + source.description() + "," + min + "," + max + "," + target.description() + ")";
          }
        
        Show
        Jan Høydahl added a comment - Code in RangeMapFloatFunction : @Override public String description() { return "map(" + source.description() + "," + min + "," + max + "," + target.description() + ")" ; }
        Hide
        Jan Høydahl added a comment -

        Hmm, should this be a Lucene jira perhaps?

        Show
        Jan Høydahl added a comment - Hmm, should this be a Lucene jira perhaps?
        Hide
        Jan Høydahl added a comment -

        Attaching patch which prints default value in explain and description.

        defaultVal is allowed to be null, and in that case it defaults to the x (source) value. In this patch I explicitly print the source value in that case. An alternative could be to omit default value and print only map(x,min,max,target) as today.

        Shalin Shekhar Mangar, you have been involved in this class before, what is your opinion?

        Show
        Jan Høydahl added a comment - Attaching patch which prints default value in explain and description. defaultVal is allowed to be null , and in that case it defaults to the x (source) value. In this patch I explicitly print the source value in that case. An alternative could be to omit default value and print only map(x,min,max,target) as today. Shalin Shekhar Mangar , you have been involved in this class before, what is your opinion?
        Hide
        Adrien Grand added a comment -

        Jan, maybe we should display null instead of source.description() when defaultVal is null? I think the output could be a bit confusing otherwise as it would look like default values were provided even though they were not?

        Show
        Adrien Grand added a comment - Jan, maybe we should display null instead of source.description() when defaultVal is null? I think the output could be a bit confusing otherwise as it would look like default values were provided even though they were not?
        Hide
        Jan Høydahl added a comment -

        Agree, it more precisely shows what the user-function looks like. Attached is new patch.

        Show
        Jan Høydahl added a comment - Agree, it more precisely shows what the user-function looks like. Attached is new patch.
        Hide
        Adrien Grand added a comment -

        +1

        Show
        Adrien Grand added a comment - +1
        Hide
        ASF subversion and git services added a comment -

        Commit 1713729 from janhoy@apache.org in branch 'dev/trunk'
        [ https://svn.apache.org/r1713729 ]

        LUCENE-6888: Explain output of map() function now also prints default value

        Show
        ASF subversion and git services added a comment - Commit 1713729 from janhoy@apache.org in branch 'dev/trunk' [ https://svn.apache.org/r1713729 ] LUCENE-6888 : Explain output of map() function now also prints default value
        Hide
        ASF subversion and git services added a comment -

        Commit 1713738 from janhoy@apache.org in branch 'dev/branches/branch_5x'
        [ https://svn.apache.org/r1713738 ]

        LUCENE-6888: Explain output of map() function now also prints default value (backport)

        Show
        ASF subversion and git services added a comment - Commit 1713738 from janhoy@apache.org in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1713738 ] LUCENE-6888 : Explain output of map() function now also prints default value (backport)

          People

          • Assignee:
            Jan Høydahl
            Reporter:
            Jan Høydahl
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development