Solr
  1. Solr
  2. SOLR-5388

Combine def function with "multi" functions (max, min, sum, product)

    Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: master
    • Component/s: None
    • Labels:

      Description

      Ability for expressions like def(min(field1,..,fieldN), defValue) return defValue if document doesn't have value for any of this fields.
      Implement exists(int doc) method for FunctionValues created in MultiFloatFunction. Extract method to get ability other MultiFloatFunction implementation to override it.

      Example:
      Doc1: Field1: "10", Field2: "20"
      Doc2: Field3: "30", FIeld4: "40"
      We want to call user function "def(min(Field1,Field2),5)" for this documents :
      Now we've got: Doc1 = 10, Doc2 = Float.POSITIVE_INFINITY
      With this patch: Doc1 = 10, Doc2 = 5 ( Doc2 doesn't have values for this documents, so he gets defValue)

      1. SOLR-5388.patch
        6 kB
        Andrey Kudryavtsev
      2. SOLR-5388.patch
        1 kB
        Andrey Kudryavtsev

        Activity

        Andrey Kudryavtsev created issue -
        Andrey Kudryavtsev made changes -
        Field Original Value New Value
        Attachment SOLR-5388.patch [ 12610151 ]
        Andrey Kudryavtsev made changes -
        Description Ability for expressions like _def(min(field1,..,fieldN), defValue)_ return _defValue_ if document doesn't have value for any of this fields.
        Implement exists(int doc) method for FunctionValues created in MultiFloatFunction. Extract method to get ability other MultiFloatFunction implementation to override it.
        Ability for expressions like _def(min(field1,..,fieldN), defValue)_ return _defValue_ if document doesn't have value for any of this fields.
        Implement _exists(int doc)_ method for FunctionValues created in MultiFloatFunction. Extract method to get ability other MultiFloatFunction implementation to override it.
        Hide
        Andrey Kudryavtsev added a comment -

        Couple of test cases added

        Show
        Andrey Kudryavtsev added a comment - Couple of test cases added
        Andrey Kudryavtsev made changes -
        Attachment SOLR-5388.patch [ 12614255 ]
        Andrey Kudryavtsev made changes -
        Description Ability for expressions like _def(min(field1,..,fieldN), defValue)_ return _defValue_ if document doesn't have value for any of this fields.
        Implement _exists(int doc)_ method for FunctionValues created in MultiFloatFunction. Extract method to get ability other MultiFloatFunction implementation to override it.
        Ability for expressions like _def(min(field1,..,fieldN), defValue)_ return _defValue_ if document doesn't have value for any of this fields.
        Implement _exists(int doc)_ method for FunctionValues created in MultiFloatFunction. Extract method to get ability other MultiFloatFunction implementation to override it.
        Example:

        Doc1: Field1: "1", Field2: "2"
        Doc2: Field3: "3", FIeld4: "4"

        Now if we call user function "def(min(Field1,Field2),5)" we've got : Doc1 = 1, Doc2 = +
         
        Andrey Kudryavtsev made changes -
        Description Ability for expressions like _def(min(field1,..,fieldN), defValue)_ return _defValue_ if document doesn't have value for any of this fields.
        Implement _exists(int doc)_ method for FunctionValues created in MultiFloatFunction. Extract method to get ability other MultiFloatFunction implementation to override it.
        Example:

        Doc1: Field1: "1", Field2: "2"
        Doc2: Field3: "3", FIeld4: "4"

        Now if we call user function "def(min(Field1,Field2),5)" we've got : Doc1 = 1, Doc2 = +
         
        Ability for expressions like _def(min(field1,..,fieldN), defValue)_ return _defValue_ if document doesn't have value for any of this fields.
        Implement _exists(int doc)_ method for FunctionValues created in MultiFloatFunction. Extract method to get ability other MultiFloatFunction implementation to override it.
        Example:

        Doc1: Field1: "10", Field2: "20"
        Doc2: Field3: "30", FIeld4: "40"

        We want to call user function "def(min(Field1,Field2),5)" for this documents :
        Now we've got: Doc1 = 1, Doc2 = Float.POSITIVE_INFINITY
        With this patch: Doc1 = 10, Doc2 = 5 ( Doc2 doesn't have values for this documents, so he gets defValue)
        Andrey Kudryavtsev made changes -
        Description Ability for expressions like _def(min(field1,..,fieldN), defValue)_ return _defValue_ if document doesn't have value for any of this fields.
        Implement _exists(int doc)_ method for FunctionValues created in MultiFloatFunction. Extract method to get ability other MultiFloatFunction implementation to override it.
        Example:

        Doc1: Field1: "10", Field2: "20"
        Doc2: Field3: "30", FIeld4: "40"

        We want to call user function "def(min(Field1,Field2),5)" for this documents :
        Now we've got: Doc1 = 1, Doc2 = Float.POSITIVE_INFINITY
        With this patch: Doc1 = 10, Doc2 = 5 ( Doc2 doesn't have values for this documents, so he gets defValue)
        Ability for expressions like _def(min(field1,..,fieldN), defValue)_ return _defValue_ if document doesn't have value for any of this fields.
        Implement _exists(int doc)_ method for FunctionValues created in MultiFloatFunction. Extract method to get ability other MultiFloatFunction implementation to override it.

        Example:
        Doc1: Field1: "10", Field2: "20"
        Doc2: Field3: "30", FIeld4: "40"
        We want to call user function "def(min(Field1,Field2),5)" for this documents :
        Now we've got: Doc1 = 1, Doc2 = Float.POSITIVE_INFINITY
        With this patch: Doc1 = 10, Doc2 = 5 ( Doc2 doesn't have values for this documents, so he gets defValue)
        Andrey Kudryavtsev made changes -
        Description Ability for expressions like _def(min(field1,..,fieldN), defValue)_ return _defValue_ if document doesn't have value for any of this fields.
        Implement _exists(int doc)_ method for FunctionValues created in MultiFloatFunction. Extract method to get ability other MultiFloatFunction implementation to override it.

        Example:
        Doc1: Field1: "10", Field2: "20"
        Doc2: Field3: "30", FIeld4: "40"
        We want to call user function "def(min(Field1,Field2),5)" for this documents :
        Now we've got: Doc1 = 1, Doc2 = Float.POSITIVE_INFINITY
        With this patch: Doc1 = 10, Doc2 = 5 ( Doc2 doesn't have values for this documents, so he gets defValue)
        Ability for expressions like _def(min(field1,..,fieldN), defValue)_ return _defValue_ if document doesn't have value for any of this fields.
        Implement _exists(int doc)_ method for FunctionValues created in MultiFloatFunction. Extract method to get ability other MultiFloatFunction implementation to override it.

        Example:
        Doc1: Field1: "10", Field2: "20"
        Doc2: Field3: "30", FIeld4: "40"
        We want to call user function "def(min(Field1,Field2),5)" for this documents :
        Now we've got: Doc1 = 10, Doc2 = Float.POSITIVE_INFINITY
        With this patch: Doc1 = 10, Doc2 = 5 ( Doc2 doesn't have values for this documents, so he gets defValue)

          People

          • Assignee:
            Unassigned
            Reporter:
            Andrey Kudryavtsev
          • Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development