You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Otis Gospodnetic (JIRA)" <ji...@apache.org> on 2007/04/05 22:30:32 UTC

[jira] Created: (LUCENE-857) Remove BitSet caching from QueryFilter

Remove BitSet caching from QueryFilter
--------------------------------------

                 Key: LUCENE-857
                 URL: https://issues.apache.org/jira/browse/LUCENE-857
             Project: Lucene - Java
          Issue Type: Improvement
            Reporter: Otis Gospodnetic
         Assigned To: Otis Gospodnetic
            Priority: Minor


Since caching is built into the public BitSet bits(IndexReader reader)  method, I don't see a way to deprecate that, which means I'll just cut it out and document it in CHANGES.txt.  Anyone who wants QueryFilter caching will be able to get the caching back by wrapping the QueryFilter in the CachingWrapperFilter.

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Resolved: (LUCENE-857) Remove BitSet caching from QueryFilter

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

Otis Gospodnetic resolved LUCENE-857.
-------------------------------------

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

But of course.  Thanks for the catch!


> Remove BitSet caching from QueryFilter
> --------------------------------------
>
>                 Key: LUCENE-857
>                 URL: https://issues.apache.org/jira/browse/LUCENE-857
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Otis Gospodnetic
>         Assigned To: Otis Gospodnetic
>            Priority: Minor
>         Attachments: LUCENE-857.patch, LUCENE-857.refactoring-approach.diff
>
>
> Since caching is built into the public BitSet bits(IndexReader reader)  method, I don't see a way to deprecate that, which means I'll just cut it out and document it in CHANGES.txt.  Anyone who wants QueryFilter caching will be able to get the caching back by wrapping the QueryFilter in the CachingWrapperFilter.

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Reopened: (LUCENE-857) Remove BitSet caching from QueryFilter

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

Hoss Man reopened LUCENE-857:
-----------------------------

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

Actually Otis: for the backwards compatibility to work, QueryFilter needs to extend CachingWrapperFilter with a constructor like...

   public QueryFilter(Query query) {
     super(new QueryWrapperFilter(query));
   }

...what you've committed eliminates the caching from QueryFilter 

> Remove BitSet caching from QueryFilter
> --------------------------------------
>
>                 Key: LUCENE-857
>                 URL: https://issues.apache.org/jira/browse/LUCENE-857
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Otis Gospodnetic
>         Assigned To: Otis Gospodnetic
>            Priority: Minor
>         Attachments: LUCENE-857.patch, LUCENE-857.refactoring-approach.diff
>
>
> Since caching is built into the public BitSet bits(IndexReader reader)  method, I don't see a way to deprecate that, which means I'll just cut it out and document it in CHANGES.txt.  Anyone who wants QueryFilter caching will be able to get the caching back by wrapping the QueryFilter in the CachingWrapperFilter.

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Resolved: (LUCENE-857) Remove BitSet caching from QueryFilter

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

Otis Gospodnetic resolved LUCENE-857.
-------------------------------------

    Resolution: Fixed

Thanks for the persistence and patience, Hoss.  I see the light now!  The patch wouldn't apply to QueryFilter, so I made changes manually.
Committed.


> Remove BitSet caching from QueryFilter
> --------------------------------------
>
>                 Key: LUCENE-857
>                 URL: https://issues.apache.org/jira/browse/LUCENE-857
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Otis Gospodnetic
>         Assigned To: Otis Gospodnetic
>            Priority: Minor
>         Attachments: LUCENE-857.patch, LUCENE-857.refactoring-approach.diff
>
>
> Since caching is built into the public BitSet bits(IndexReader reader)  method, I don't see a way to deprecate that, which means I'll just cut it out and document it in CHANGES.txt.  Anyone who wants QueryFilter caching will be able to get the caching back by wrapping the QueryFilter in the CachingWrapperFilter.

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-857) Remove BitSet caching from QueryFilter

Posted by "Otis Gospodnetic (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-857?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12487433 ] 

Otis Gospodnetic commented on LUCENE-857:
-----------------------------------------

I think this is where a javadoc and CHANGES.txt come in.  People with serious production environments don't just throw new Lucene version on top of the old one without carefully reading CHANGES.txt.  I do this every time I upgrade.  If one is careless and doesn't read that, then, well...

What you suggested is okay, but I didn't want to deprecate the whole class, just remove the caching concern from it, as that's what the CWF is concerned with already.  With your suggestion one can't get a raw QueryFilter without getting it automatically cached.  Isn't this inflexibility uncool?


> Remove BitSet caching from QueryFilter
> --------------------------------------
>
>                 Key: LUCENE-857
>                 URL: https://issues.apache.org/jira/browse/LUCENE-857
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Otis Gospodnetic
>         Assigned To: Otis Gospodnetic
>            Priority: Minor
>         Attachments: LUCENE-857.patch
>
>
> Since caching is built into the public BitSet bits(IndexReader reader)  method, I don't see a way to deprecate that, which means I'll just cut it out and document it in CHANGES.txt.  Anyone who wants QueryFilter caching will be able to get the caching back by wrapping the QueryFilter in the CachingWrapperFilter.

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-857) Remove BitSet caching from QueryFilter

Posted by "Hoss Man (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-857?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12487116 ] 

Hoss Man commented on LUCENE-857:
---------------------------------

>From email since i didn't notice Otis opened this issue already...

Date: Thu, 5 Apr 2007 14:24:31 -0700 (PDT)
To: java-dev@lucene.apache.org
Subject: Re: Caching in QueryFilter - why?

: Since caching is built into the public BitSet bits(IndexReader reader)
: method, I don't see a way to deprecate that, which means I'll just cut
: it out and document it in CHANGES.txt.  Anyone who wants QueryFilter
: caching will be able to get the caching back by wrapping the QueryFilter
: in your CachingWrapperFilter.

this seems like a potentially big surprise for people when upgrading ...
old code will continue to work fine without warning, just get a lot less
efficient.

If the concern is duplicated code, perhaps QueryFilter should be
deprecated and changed to be a subclass of CachingWrapperFilter, with a
constructor that takes in the Query and wraps it in some new class
(QueryWrapperFilter perhaps?)  that does the meaty part (collecting the
matches) ...

@deprecated use CachingWrapperFilter and QueryWrapperFilter directly
public class QueryFilter extends CachingWrapperFilter {
  public QueryFilter(Query query) {
    super(new QueryWrapperFilter(query));
  }
}

public class QueryWrapperFilter extends Filter {
  private Query query;
  public QueryWrapperFilter(Query query) {
    this.query = query;
  }
  public BitSet bits(IndexReader reader) throws IOException {
    final BitSet bits = new BitSet(reader.maxDoc());
    new IndexSearcher(reader).search(query, new HitCollector() {
      public final void collect(int doc, float score) {
        bits.set(doc);  // set bit for hit
      }
    });
    return bits;
  }
}


(obviously we need some toString, equals, and hashCode methods in here as well)


> Remove BitSet caching from QueryFilter
> --------------------------------------
>
>                 Key: LUCENE-857
>                 URL: https://issues.apache.org/jira/browse/LUCENE-857
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Otis Gospodnetic
>         Assigned To: Otis Gospodnetic
>            Priority: Minor
>         Attachments: LUCENE-857.patch
>
>
> Since caching is built into the public BitSet bits(IndexReader reader)  method, I don't see a way to deprecate that, which means I'll just cut it out and document it in CHANGES.txt.  Anyone who wants QueryFilter caching will be able to get the caching back by wrapping the QueryFilter in the CachingWrapperFilter.

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Updated: (LUCENE-857) Remove BitSet caching from QueryFilter

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

Hoss Man updated LUCENE-857:
----------------------------

    Attachment: LUCENE-857.refactoring-approach.diff

An example of what I'm thinking would make sense from a backwards compatibility standpoint ... javadocs could still use some improvement.

> Remove BitSet caching from QueryFilter
> --------------------------------------
>
>                 Key: LUCENE-857
>                 URL: https://issues.apache.org/jira/browse/LUCENE-857
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Otis Gospodnetic
>         Assigned To: Otis Gospodnetic
>            Priority: Minor
>         Attachments: LUCENE-857.patch, LUCENE-857.refactoring-approach.diff
>
>
> Since caching is built into the public BitSet bits(IndexReader reader)  method, I don't see a way to deprecate that, which means I'll just cut it out and document it in CHANGES.txt.  Anyone who wants QueryFilter caching will be able to get the caching back by wrapping the QueryFilter in the CachingWrapperFilter.

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-857) Remove BitSet caching from QueryFilter

Posted by "Hoss Man (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-857?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12487679 ] 

Hoss Man commented on LUCENE-857:
---------------------------------

I don't think it's a question of being careless about reading the Changelog -- I just think that when dealing with a point release, we shouldn't require people to make code changes just to get the same behavior as before ... if this was necessary to fix a bug it would be one thing, but really what we're talking about here is refactoring out a piece of functionality (using a Query as a Filter) so that it can be used independently from another piece of functionality (filter caching) ... since that can be done in a backwards compatible way, why not make it easy for people.

> With your suggestion one can't get a raw QueryFilter without getting it 
> automatically cached. Isn't this inflexibility uncool? 

...not quite, I'm suggesting that the "raw" QueryFilter behavior be extracted into a new class (QueryWrapperFilter) and the existing QueryFilter class continue to do exactly what it currently does - but refactored so that there is no duplicate code.

> Remove BitSet caching from QueryFilter
> --------------------------------------
>
>                 Key: LUCENE-857
>                 URL: https://issues.apache.org/jira/browse/LUCENE-857
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Otis Gospodnetic
>         Assigned To: Otis Gospodnetic
>            Priority: Minor
>         Attachments: LUCENE-857.patch
>
>
> Since caching is built into the public BitSet bits(IndexReader reader)  method, I don't see a way to deprecate that, which means I'll just cut it out and document it in CHANGES.txt.  Anyone who wants QueryFilter caching will be able to get the caching back by wrapping the QueryFilter in the CachingWrapperFilter.

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Updated: (LUCENE-857) Remove BitSet caching from QueryFilter

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

Otis Gospodnetic updated LUCENE-857:
------------------------------------

    Attachment: LUCENE-857.patch

QueryFilter without caching.
I'll commit it tomorrow (Friday) if nobody complains.


> Remove BitSet caching from QueryFilter
> --------------------------------------
>
>                 Key: LUCENE-857
>                 URL: https://issues.apache.org/jira/browse/LUCENE-857
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Otis Gospodnetic
>         Assigned To: Otis Gospodnetic
>            Priority: Minor
>         Attachments: LUCENE-857.patch
>
>
> Since caching is built into the public BitSet bits(IndexReader reader)  method, I don't see a way to deprecate that, which means I'll just cut it out and document it in CHANGES.txt.  Anyone who wants QueryFilter caching will be able to get the caching back by wrapping the QueryFilter in the CachingWrapperFilter.

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org