You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Chris Male (JIRA)" <ji...@apache.org> on 2011/09/25 10:49:26 UTC

[jira] [Created] (LUCENE-3456) Analysis Consumers should end and close any TokenStreams

Analysis Consumers should end and close any TokenStreams
--------------------------------------------------------

                 Key: LUCENE-3456
                 URL: https://issues.apache.org/jira/browse/LUCENE-3456
             Project: Lucene - Java
          Issue Type: Sub-task
            Reporter: Chris Male


While converting consumers over to using reusableTokenStream, I notice many don't call end() or close() on TokenStreams.

Even if they are test TSs only created once, we should follow the defined usage pattern.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Updated] (LUCENE-3456) Analysis Consumers should end and close any TokenStreams

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

Robert Muir updated LUCENE-3456:
--------------------------------

    Attachment: LUCENE-3456.patch

attached is a patch cutting over all uses of whitespace->mocktokenizer in solr test configs, and fixing the errors this found.

i'd like to commit shortly, we can improve the coverage more by looking at other configs and cutting over things like keywordtokenizer

> Analysis Consumers should end and close any TokenStreams
> --------------------------------------------------------
>
>                 Key: LUCENE-3456
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3456
>             Project: Lucene - Java
>          Issue Type: Sub-task
>            Reporter: Chris Male
>         Attachments: LUCENE-3456.patch, LUCENE-3456.patch
>
>
> While converting consumers over to using reusableTokenStream, I notice many don't call end() or close() on TokenStreams.
> Even if they are test TSs only created once, we should follow the defined usage pattern.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (LUCENE-3456) Analysis Consumers should end and close any TokenStreams

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

Robert Muir commented on LUCENE-3456:
-------------------------------------

ok, i committed my stuff, just test bugs (ill backport though)... go ahead!

> Analysis Consumers should end and close any TokenStreams
> --------------------------------------------------------
>
>                 Key: LUCENE-3456
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3456
>             Project: Lucene - Java
>          Issue Type: Sub-task
>            Reporter: Chris Male
>         Attachments: LUCENE-3456.patch, LUCENE-3456.patch
>
>
> While converting consumers over to using reusableTokenStream, I notice many don't call end() or close() on TokenStreams.
> Even if they are test TSs only created once, we should follow the defined usage pattern.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Issue Comment Edited] (LUCENE-3456) Analysis Consumers should end and close any TokenStreams

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

Uwe Schindler edited comment on LUCENE-3456 at 9/25/11 9:21 AM:
----------------------------------------------------------------

I have some idea how to assert this is tests (now that Analyzer.(reuseable)tokenStream is final everywhere):
We can wrap the TokenStream reaturned by those two methods in Analyzer using a AssertingTokenFilter that simply tracks in its methods the correct usage of reset() [throw AssertionFailed if missing], increment(), end(), close() [this last one is hard to track].

The idea is:
If assertions are enabled, the tokenstream-returning methods in Analyzer.java should check the desiredAssertionStatus of this' class and wrap the TokenStream using that TokenFilter described before. If a consumer then forgets to call any of these methods oir does this in wrong order, an AssertionError is thrown.

I could hack something together (yes, it is a hack).

      was (Author: thetaphi):
    I have some idea how to assert this is tests (now that Analyzer.(reuseable)tokenStream is final everywhere):
We can wrap the TokenStream reaturned by those two methods in TokenStream using a AssertingTokenFilter that simply tracks in its methods the correct usage of reset() [throw AssertionFailed if missing], increment(), end(), close() [this last one is hard to track].

The idea is:
If assertions are enabled, the tokenstream-returning methods in Analyzer.java should check the desiredAssertionStatus of this' class and wrap the TokenStream using that TokenFilter described before. If a consumer then forgets to call any of these methods oir does this in wrong order, an AssertionError is thrown.

I could hack something together (yes, it is a hack).
  
> Analysis Consumers should end and close any TokenStreams
> --------------------------------------------------------
>
>                 Key: LUCENE-3456
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3456
>             Project: Lucene - Java
>          Issue Type: Sub-task
>            Reporter: Chris Male
>
> While converting consumers over to using reusableTokenStream, I notice many don't call end() or close() on TokenStreams.
> Even if they are test TSs only created once, we should follow the defined usage pattern.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (LUCENE-3456) Analysis Consumers should end and close any TokenStreams

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

Chris Male commented on LUCENE-3456:
------------------------------------

How would you track the end and close invocations? (or lack thereof)?

> Analysis Consumers should end and close any TokenStreams
> --------------------------------------------------------
>
>                 Key: LUCENE-3456
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3456
>             Project: Lucene - Java
>          Issue Type: Sub-task
>            Reporter: Chris Male
>
> While converting consumers over to using reusableTokenStream, I notice many don't call end() or close() on TokenStreams.
> Even if they are test TSs only created once, we should follow the defined usage pattern.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (LUCENE-3456) Analysis Consumers should end and close any TokenStreams

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

Uwe Schindler commented on LUCENE-3456:
---------------------------------------

Yes it's down low, my idea was to do it top-level. But you are right, it's not really needed. And we cannot 100% handle end/close unless we reuse.

The problem my approach would solve is that Solr would be asserted all the time, not only if it uses Mock*, which is rarely does?

> Analysis Consumers should end and close any TokenStreams
> --------------------------------------------------------
>
>                 Key: LUCENE-3456
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3456
>             Project: Lucene - Java
>          Issue Type: Sub-task
>            Reporter: Chris Male
>
> While converting consumers over to using reusableTokenStream, I notice many don't call end() or close() on TokenStreams.
> Even if they are test TSs only created once, we should follow the defined usage pattern.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (LUCENE-3456) Analysis Consumers should end and close any TokenStreams

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

Robert Muir commented on LUCENE-3456:
-------------------------------------

I'm iterating on this patch a bit, so we don't do duplicate work.

it probably won't find all the problems, but it will fix some.

> Analysis Consumers should end and close any TokenStreams
> --------------------------------------------------------
>
>                 Key: LUCENE-3456
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3456
>             Project: Lucene - Java
>          Issue Type: Sub-task
>            Reporter: Chris Male
>         Attachments: LUCENE-3456.patch
>
>
> While converting consumers over to using reusableTokenStream, I notice many don't call end() or close() on TokenStreams.
> Even if they are test TSs only created once, we should follow the defined usage pattern.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (LUCENE-3456) Analysis Consumers should end and close any TokenStreams

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

Chris Male commented on LUCENE-3456:
------------------------------------

Where are we at with this Robert? I'm about to complete converting over to reusableTokenStream() in Solr.  Should I work on that or wait for you to finish here?

> Analysis Consumers should end and close any TokenStreams
> --------------------------------------------------------
>
>                 Key: LUCENE-3456
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3456
>             Project: Lucene - Java
>          Issue Type: Sub-task
>            Reporter: Chris Male
>         Attachments: LUCENE-3456.patch, LUCENE-3456.patch
>
>
> While converting consumers over to using reusableTokenStream, I notice many don't call end() or close() on TokenStreams.
> Even if they are test TSs only created once, we should follow the defined usage pattern.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (LUCENE-3456) Analysis Consumers should end and close any TokenStreams

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

Chris Male commented on LUCENE-3456:
------------------------------------

Alright I'll stick to Lucene and modules for a bit.

> Analysis Consumers should end and close any TokenStreams
> --------------------------------------------------------
>
>                 Key: LUCENE-3456
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3456
>             Project: Lucene - Java
>          Issue Type: Sub-task
>            Reporter: Chris Male
>         Attachments: LUCENE-3456.patch, LUCENE-3456.patch
>
>
> While converting consumers over to using reusableTokenStream, I notice many don't call end() or close() on TokenStreams.
> Even if they are test TSs only created once, we should follow the defined usage pattern.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (LUCENE-3456) Analysis Consumers should end and close any TokenStreams

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

Robert Muir commented on LUCENE-3456:
-------------------------------------

{quote}
The problem my approach would solve is that Solr would be asserted all the time, not only if it uses Mock*, which is rarely does?
{quote}

But perhaps a better solution to this problem would be to use MockTokenizer etc in Solr test configs (there are already enough tests testing the example config)

> Analysis Consumers should end and close any TokenStreams
> --------------------------------------------------------
>
>                 Key: LUCENE-3456
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3456
>             Project: Lucene - Java
>          Issue Type: Sub-task
>            Reporter: Chris Male
>
> While converting consumers over to using reusableTokenStream, I notice many don't call end() or close() on TokenStreams.
> Even if they are test TSs only created once, we should follow the defined usage pattern.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (LUCENE-3456) Analysis Consumers should end and close any TokenStreams

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

Robert Muir commented on LUCENE-3456:
-------------------------------------

{quote}
I could hack something together (yes, it is a hack).
{quote}

We already do this in MockTokenizer?

The problem is that many disable the assertions (MockTokenizer.setEnableChecks)

So, I dont think we need a new tokenstream to test this...

> Analysis Consumers should end and close any TokenStreams
> --------------------------------------------------------
>
>                 Key: LUCENE-3456
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3456
>             Project: Lucene - Java
>          Issue Type: Sub-task
>            Reporter: Chris Male
>
> While converting consumers over to using reusableTokenStream, I notice many don't call end() or close() on TokenStreams.
> Even if they are test TSs only created once, we should follow the defined usage pattern.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (LUCENE-3456) Analysis Consumers should end and close any TokenStreams

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

Uwe Schindler commented on LUCENE-3456:
---------------------------------------

I have some idea how to assert this is tests (now that Analyzer.(reuseable)tokenStream is final everywhere):
We can wrap the TokenStream reaturned by those two methods in TokenStream using a AssertingTokenFilter that simply tracks in its methods the correct usage of reset() [throw AssertionFailed if missing], increment(), end(), close() [this last one is hard to track].

The idea is:
If assertions are enabled, the tokenstream-returning methods in Analyzer.java should check the desiredAssertionStatus of this' class and wrap the TokenStream using that TokenFilter described before. If a consumer then forgets to call any of these methods oir does this in wrong order, an AssertionError is thrown.

I could hack something together (yes, it is a hack).

> Analysis Consumers should end and close any TokenStreams
> --------------------------------------------------------
>
>                 Key: LUCENE-3456
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3456
>             Project: Lucene - Java
>          Issue Type: Sub-task
>            Reporter: Chris Male
>
> While converting consumers over to using reusableTokenStream, I notice many don't call end() or close() on TokenStreams.
> Even if they are test TSs only created once, we should follow the defined usage pattern.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (LUCENE-3456) Analysis Consumers should end and close any TokenStreams

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

Chris Male commented on LUCENE-3456:
------------------------------------

Sorting this out for the current codebase isn't a huge challenge.  I work from incrementToken() / reuseable/TokenStream() calls, and see whats being called in their vicinity.  But going forward, I agree using Mock* in Solr more makes sense.

> Analysis Consumers should end and close any TokenStreams
> --------------------------------------------------------
>
>                 Key: LUCENE-3456
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3456
>             Project: Lucene - Java
>          Issue Type: Sub-task
>            Reporter: Chris Male
>
> While converting consumers over to using reusableTokenStream, I notice many don't call end() or close() on TokenStreams.
> Even if they are test TSs only created once, we should follow the defined usage pattern.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Updated] (LUCENE-3456) Analysis Consumers should end and close any TokenStreams

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

Chris Male updated LUCENE-3456:
-------------------------------

    Component/s:     (was: modules/analysis)

> Analysis Consumers should end and close any TokenStreams
> --------------------------------------------------------
>
>                 Key: LUCENE-3456
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3456
>             Project: Lucene - Java
>          Issue Type: Sub-task
>            Reporter: Chris Male
>
> While converting consumers over to using reusableTokenStream, I notice many don't call end() or close() on TokenStreams.
> Even if they are test TSs only created once, we should follow the defined usage pattern.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (LUCENE-3456) Analysis Consumers should end and close any TokenStreams

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

Robert Muir commented on LUCENE-3456:
-------------------------------------

i have a new patch i made on the airplane, but it found more bugs... ill fix them tonight and commit!

> Analysis Consumers should end and close any TokenStreams
> --------------------------------------------------------
>
>                 Key: LUCENE-3456
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3456
>             Project: Lucene - Java
>          Issue Type: Sub-task
>            Reporter: Chris Male
>         Attachments: LUCENE-3456.patch, LUCENE-3456.patch
>
>
> While converting consumers over to using reusableTokenStream, I notice many don't call end() or close() on TokenStreams.
> Even if they are test TSs only created once, we should follow the defined usage pattern.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Updated] (LUCENE-3456) Analysis Consumers should end and close any TokenStreams

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

Robert Muir updated LUCENE-3456:
--------------------------------

    Attachment: LUCENE-3456.patch

here is a patch cutting over solr/core... 

this looks to have uncovered some bugs, i didnt fix any of them.

additionally i think we should do the same thing for solrj, contrib/*, etc.

> Analysis Consumers should end and close any TokenStreams
> --------------------------------------------------------
>
>                 Key: LUCENE-3456
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3456
>             Project: Lucene - Java
>          Issue Type: Sub-task
>            Reporter: Chris Male
>         Attachments: LUCENE-3456.patch
>
>
> While converting consumers over to using reusableTokenStream, I notice many don't call end() or close() on TokenStreams.
> Even if they are test TSs only created once, we should follow the defined usage pattern.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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