lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 21189] - Hits.length() returns to large value
Date Mon, 30 Jun 2003 18:12:28 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21189>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21189

Hits.length() returns to large value

cutting@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |WONTFIX



------- Additional Comments From cutting@apache.org  2003-06-30 18:12 -------
The problem is that, by deleting documents, you're changing the set of documents
that the Hits has cached.  It's trying to fetch the 101st hit, which, now that
100 hits have been deleted, is now the first hit.

There are several ways to do this which won't run into this problem.  The
simplest is to replace the deleting loop with:

  reader.delete(new Term("k", "v"));

If you really need to delete the results of a query, then do something like:

  searcher.search(q, new HitCollector() {
    public void collect(int d, float s) {
      reader.delete(d);
    }
  };

Hits is designed for read-only browsing of results.

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


Mime
View raw message