You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Simon Willnauer (JIRA)" <ji...@apache.org> on 2011/01/13 14:34:45 UTC

[jira] Created: (LUCENE-2865) Pass a context struct to Weight#scorer instead of naked booleans

Pass a context struct to Weight#scorer instead of naked booleans
----------------------------------------------------------------

                 Key: LUCENE-2865
                 URL: https://issues.apache.org/jira/browse/LUCENE-2865
             Project: Lucene - Java
          Issue Type: Improvement
          Components: Search
    Affects Versions: 4.0
            Reporter: Simon Willnauer
            Assignee: Simon Willnauer
             Fix For: 4.0


Weight#scorer(AtomicReaderContext, boolean, boolean) is hard to extend if another boolean like "needsScoring" or similar flags / information need to be passed to Scorers. An immutable struct would make such an extension trivial / way easier. 

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] Resolved: (LUCENE-2865) Pass a context struct to Weight#scorer instead of naked booleans

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

Simon Willnauer resolved LUCENE-2865.
-------------------------------------

       Resolution: Fixed
    Lucene Fields: [New, Patch Available]  (was: [New])

Committed revision 1058592.

thanks uwe for the review

> Pass a context struct to Weight#scorer instead of naked booleans
> ----------------------------------------------------------------
>
>                 Key: LUCENE-2865
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2865
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Search
>    Affects Versions: 4.0
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 4.0
>
>         Attachments: LUCENE-2865.patch, LUCENE-2865.patch
>
>
> Weight#scorer(AtomicReaderContext, boolean, boolean) is hard to extend if another boolean like "needsScoring" or similar flags / information need to be passed to Scorers. An immutable struct would make such an extension trivial / way easier. 

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] Commented: (LUCENE-2865) Pass a context struct to Weight#scorer instead of naked booleans

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12981259#action_12981259 ] 

Uwe Schindler commented on LUCENE-2865:
---------------------------------------

Looks good!

I would make the ctor private and then use ScorerContext.default().x().y() as pattern (default returns the template). I like this design more :-)

> Pass a context struct to Weight#scorer instead of naked booleans
> ----------------------------------------------------------------
>
>                 Key: LUCENE-2865
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2865
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Search
>    Affects Versions: 4.0
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 4.0
>
>         Attachments: LUCENE-2865.patch
>
>
> Weight#scorer(AtomicReaderContext, boolean, boolean) is hard to extend if another boolean like "needsScoring" or similar flags / information need to be passed to Scorers. An immutable struct would make such an extension trivial / way easier. 

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] Updated: (LUCENE-2865) Pass a context struct to Weight#scorer instead of naked booleans

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

Simon Willnauer updated LUCENE-2865:
------------------------------------

    Attachment: LUCENE-2865.patch

bq. I would make the ctor private and then use ScorerContext.default().x().y() as pattern (default returns the template). I like this design more 
Jawohl! :) - Since default is a keyword in java I used ScorerContext#def() instead. I fixed some JDoc issues, made all ScorerContext ctors private and added a changes.txt entry

seems like we are good to go

> Pass a context struct to Weight#scorer instead of naked booleans
> ----------------------------------------------------------------
>
>                 Key: LUCENE-2865
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2865
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Search
>    Affects Versions: 4.0
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 4.0
>
>         Attachments: LUCENE-2865.patch, LUCENE-2865.patch
>
>
> Weight#scorer(AtomicReaderContext, boolean, boolean) is hard to extend if another boolean like "needsScoring" or similar flags / information need to be passed to Scorers. An immutable struct would make such an extension trivial / way easier. 

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] Updated: (LUCENE-2865) Pass a context struct to Weight#scorer instead of naked booleans

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

Simon Willnauer updated LUCENE-2865:
------------------------------------

    Attachment: LUCENE-2865.patch

here is a patch that adds a ScorerContext to replace those two booleans. ScorerContext follows a "copy on write" pattern similar to a builder pattern that only modifies the context if the values actually change. Seems pretty straight forward so far.

> Pass a context struct to Weight#scorer instead of naked booleans
> ----------------------------------------------------------------
>
>                 Key: LUCENE-2865
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2865
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Search
>    Affects Versions: 4.0
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 4.0
>
>         Attachments: LUCENE-2865.patch
>
>
> Weight#scorer(AtomicReaderContext, boolean, boolean) is hard to extend if another boolean like "needsScoring" or similar flags / information need to be passed to Scorers. An immutable struct would make such an extension trivial / way easier. 

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] Commented: (LUCENE-2865) Pass a context struct to Weight#scorer instead of naked booleans

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12981273#action_12981273 ] 

Uwe Schindler commented on LUCENE-2865:
---------------------------------------

+1 to commit, looks good.

For later we should fix BooleanQuery.explain() to use default context, too. topScorer=true is wrong for explain (but has no effect here).

> Pass a context struct to Weight#scorer instead of naked booleans
> ----------------------------------------------------------------
>
>                 Key: LUCENE-2865
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2865
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Search
>    Affects Versions: 4.0
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 4.0
>
>         Attachments: LUCENE-2865.patch, LUCENE-2865.patch
>
>
> Weight#scorer(AtomicReaderContext, boolean, boolean) is hard to extend if another boolean like "needsScoring" or similar flags / information need to be passed to Scorers. An immutable struct would make such an extension trivial / way easier. 

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org