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

explain of map() Function does not show default value

    Details

    • Type: Bug
    • Status: Closed
    • Priority: 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
        janhoy Jan Høydahl added a comment -

        Code in RangeMapFloatFunction:

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

        Hmm, should this be a Lucene jira perhaps?

        Show
        janhoy Jan Høydahl added a comment - Hmm, should this be a Lucene jira perhaps?
        Hide
        janhoy 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
        janhoy 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
        jpountz 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
        jpountz 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
        janhoy Jan Høydahl added a comment -

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

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

        +1

        Show
        jpountz Adrien Grand added a comment - +1
        Hide
        jira-bot 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
        jira-bot 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
        jira-bot 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
        jira-bot 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:
            janhoy Jan Høydahl
            Reporter:
            janhoy Jan Høydahl
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development