You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by "Noble Paul (JIRA)" <ji...@apache.org> on 2009/01/17 12:53:59 UTC

[jira] Created: (SOLR-966) Enhance the map() function to take in multiple tuples

Enhance the map() function to take in multiple tuples
-----------------------------------------------------

                 Key: SOLR-966
                 URL: https://issues.apache.org/jira/browse/SOLR-966
             Project: Solr
          Issue Type: Improvement
            Reporter: Noble Paul
             Fix For: 1.4


The map function currently takes in only one min,max target. This makes it impossible to map it to multiple values . 

It should be possible to pass on multiple sets of values

example
{code}
map(x,0,0,10,1,1,20,2,2,50)
{code}

it should allow an n number of float values (where n%3 = 0)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-966) Enhance the map() function to take in multiple tuples

Posted by "Noble Paul (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-966?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Noble Paul updated SOLR-966:
----------------------------

    Attachment: SOLR-966.patch

decided to go w/ shalin's suggestion . added just a default value. The last value is optional. if not present ,the field value is used as default.

> Enhance the map() function to take in multiple tuples
> -----------------------------------------------------
>
>                 Key: SOLR-966
>                 URL: https://issues.apache.org/jira/browse/SOLR-966
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Noble Paul
>             Fix For: 1.4
>
>         Attachments: SOLR-966.patch
>
>
> The map function currently takes in only one min,max target. This makes it impossible to map it to multiple values . 
> It should be possible to pass on multiple sets of values
> example
> {code}
> map(x,0,0,10,1,1,20,2,2,50)
> {code}
> it should allow an n number of float values (where n%3 = 0)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-966) Enhance the map() function to take in multiple tuples

Posted by "Noble Paul (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-966?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12665037#action_12665037 ] 

Noble Paul commented on SOLR-966:
---------------------------------

bq.However, both these approaches are mutually exclusive.

It is still possible to have both these working together.

For the no:of arguments 'n' if (n%3) == 0 then no default is used. if ((n%3)-1) =0 , then the last value can be used as default. Although it is more complex (to explain) it hopefully will meet most of the requirements of a switch - case - default 

Thoughts?

> Enhance the map() function to take in multiple tuples
> -----------------------------------------------------
>
>                 Key: SOLR-966
>                 URL: https://issues.apache.org/jira/browse/SOLR-966
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Noble Paul
>             Fix For: 1.4
>
>
> The map function currently takes in only one min,max target. This makes it impossible to map it to multiple values . 
> It should be possible to pass on multiple sets of values
> example
> {code}
> map(x,0,0,10,1,1,20,2,2,50)
> {code}
> it should allow an n number of float values (where n%3 = 0)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-966) Enhance the map() function to take in a default value

Posted by "Shalin Shekhar Mangar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-966?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shalin Shekhar Mangar updated SOLR-966:
---------------------------------------

          Description: 
The map function currently takes in only one min,max target and returns the field's value if it is not between min and max. This makes it very difficult to use it for scoring. 

This issue aims to add an optional fifth parameter to the map function query which will be a default value that is used if the field's value does not fall between min and max. If this parameter is not specified, the behavior is the same as before for back-compatibility.

  was:
The map function currently takes in only one min,max target. This makes it impossible to map it to multiple values . 

It should be possible to pass on multiple sets of values

example
{code}
map(x,0,0,10,1,1,20,2,2,50)
{code}

it should allow an n number of float values (where n%3 = 0)

    Affects Version/s: 1.3
              Summary: Enhance the map() function to take in a default value  (was: Enhance the map() function to take in multiple tuples)

> Enhance the map() function to take in a default value
> -----------------------------------------------------
>
>                 Key: SOLR-966
>                 URL: https://issues.apache.org/jira/browse/SOLR-966
>             Project: Solr
>          Issue Type: Improvement
>    Affects Versions: 1.3
>            Reporter: Noble Paul
>            Assignee: Shalin Shekhar Mangar
>             Fix For: 1.4
>
>         Attachments: SOLR-966.patch, SOLR-966.patch
>
>
> The map function currently takes in only one min,max target and returns the field's value if it is not between min and max. This makes it very difficult to use it for scoring. 
> This issue aims to add an optional fifth parameter to the map function query which will be a default value that is used if the field's value does not fall between min and max. If this parameter is not specified, the behavior is the same as before for back-compatibility.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-966) Enhance the map() function to take in multiple tuples

Posted by "Shalin Shekhar Mangar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-966?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12664851#action_12664851 ] 

Shalin Shekhar Mangar commented on SOLR-966:
--------------------------------------------

I'm using the map function (FunctionQuery).

Consider the following (hypothetical) use-case:
I want to boost up listings of a certain category over listings of another category. Say for example, "SUV" and "Sedan". For each category, I've indexed a integer field, say "SUV" = 1 and "Sedan" = 2. Now I'm trying to boost SUVs over Sedans through function queries. This is just one of the many different boosts I need to apply.

So I use q=_val_:map(category, 1, 1, 3) _val_:map(category, 2, 2, 1). The priorities of the categories are not fixed i.e. they change at runtime. I cannot use a sort because of the many different boosting criteria I have. I cannot use the normal boosts because I don't want TF/IDF influencing the scores.

I hope the description makes sense.

> Enhance the map() function to take in multiple tuples
> -----------------------------------------------------
>
>                 Key: SOLR-966
>                 URL: https://issues.apache.org/jira/browse/SOLR-966
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Noble Paul
>             Fix For: 1.4
>
>
> The map function currently takes in only one min,max target. This makes it impossible to map it to multiple values . 
> It should be possible to pass on multiple sets of values
> example
> {code}
> map(x,0,0,10,1,1,20,2,2,50)
> {code}
> it should allow an n number of float values (where n%3 = 0)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-966) Enhance the map() function to take in multiple tuples

Posted by "Shalin Shekhar Mangar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-966?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12664823#action_12664823 ] 

Shalin Shekhar Mangar commented on SOLR-966:
--------------------------------------------

I guess the problem (feature?) of map is that if the field value is not between min and max, it outputs the value of the field. That makes it difficult to use map for scoring on numeric field values.

An alternative to Noble's approach can be to add an optional fifth argument for a default value. If value does not fall between min and max, map can output the default value. However, both these approaches are mutually exclusive.

Thoughts?

> Enhance the map() function to take in multiple tuples
> -----------------------------------------------------
>
>                 Key: SOLR-966
>                 URL: https://issues.apache.org/jira/browse/SOLR-966
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Noble Paul
>             Fix For: 1.4
>
>
> The map function currently takes in only one min,max target. This makes it impossible to map it to multiple values . 
> It should be possible to pass on multiple sets of values
> example
> {code}
> map(x,0,0,10,1,1,20,2,2,50)
> {code}
> it should allow an n number of float values (where n%3 = 0)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (SOLR-966) Enhance the map() function to take in a default value

Posted by "Shalin Shekhar Mangar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-966?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shalin Shekhar Mangar resolved SOLR-966.
----------------------------------------

    Resolution: Fixed

Committed revision 740445.

Thanks Noble!

> Enhance the map() function to take in a default value
> -----------------------------------------------------
>
>                 Key: SOLR-966
>                 URL: https://issues.apache.org/jira/browse/SOLR-966
>             Project: Solr
>          Issue Type: Improvement
>    Affects Versions: 1.3
>            Reporter: Noble Paul
>            Assignee: Shalin Shekhar Mangar
>             Fix For: 1.4
>
>         Attachments: SOLR-966.patch, SOLR-966.patch
>
>
> The map function currently takes in only one min,max target and returns the field's value if it is not between min and max. This makes it very difficult to use it for scoring. 
> This issue aims to add an optional fifth parameter to the map function query which will be a default value that is used if the field's value does not fall between min and max. If this parameter is not specified, the behavior is the same as before for back-compatibility.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (SOLR-966) Enhance the map() function to take in multiple tuples

Posted by "Shalin Shekhar Mangar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-966?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shalin Shekhar Mangar reassigned SOLR-966:
------------------------------------------

    Assignee: Shalin Shekhar Mangar

> Enhance the map() function to take in multiple tuples
> -----------------------------------------------------
>
>                 Key: SOLR-966
>                 URL: https://issues.apache.org/jira/browse/SOLR-966
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Noble Paul
>            Assignee: Shalin Shekhar Mangar
>             Fix For: 1.4
>
>         Attachments: SOLR-966.patch
>
>
> The map function currently takes in only one min,max target. This makes it impossible to map it to multiple values . 
> It should be possible to pass on multiple sets of values
> example
> {code}
> map(x,0,0,10,1,1,20,2,2,50)
> {code}
> it should allow an n number of float values (where n%3 = 0)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-966) Enhance the map() function to take in multiple tuples

Posted by "Shalin Shekhar Mangar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-966?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shalin Shekhar Mangar updated SOLR-966:
---------------------------------------

    Attachment: SOLR-966.patch

Changed equals and hashcode method to take the default value into consideration.

I found a bug in the hashcode function:
{code}Float.floatToIntBits(min);{code}
which should have been
{code}h += Float.floatToIntBits(min);{code}

Since my knowledge of hashing is limited, it would be nice if someone can review this.

> Enhance the map() function to take in multiple tuples
> -----------------------------------------------------
>
>                 Key: SOLR-966
>                 URL: https://issues.apache.org/jira/browse/SOLR-966
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Noble Paul
>            Assignee: Shalin Shekhar Mangar
>             Fix For: 1.4
>
>         Attachments: SOLR-966.patch, SOLR-966.patch
>
>
> The map function currently takes in only one min,max target. This makes it impossible to map it to multiple values . 
> It should be possible to pass on multiple sets of values
> example
> {code}
> map(x,0,0,10,1,1,20,2,2,50)
> {code}
> it should allow an n number of float values (where n%3 = 0)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-966) Enhance the map() function to take in multiple tuples

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-966?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12664848#action_12664848 ] 

Ryan McKinley commented on SOLR-966:
------------------------------------

For context, what class/component are you looking at?

What use case are you trying to solve?

> Enhance the map() function to take in multiple tuples
> -----------------------------------------------------
>
>                 Key: SOLR-966
>                 URL: https://issues.apache.org/jira/browse/SOLR-966
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Noble Paul
>             Fix For: 1.4
>
>
> The map function currently takes in only one min,max target. This makes it impossible to map it to multiple values . 
> It should be possible to pass on multiple sets of values
> example
> {code}
> map(x,0,0,10,1,1,20,2,2,50)
> {code}
> it should allow an n number of float values (where n%3 = 0)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.