lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Busch (JIRA)" <>
Subject [jira] Commented: (LUCENE-1290) Deprecate Hits
Date Tue, 20 May 2008 18:57:55 GMT


Michael Busch commented on LUCENE-1290:

With Hits/HitIterator we have two really simple ways to iterate over a long list of search

I think this is exactly a problem of Hits. If you use an HitIterator to iterate over let's
2000 results, then Hits will run the same query 5 times under the covers with 100, 200, 400,
800, 1600 as values for the heap used in TopDocCollector.

IMO Hits only makes sense if you want to use it for paging or, as Doug pointed out, for 
prefetching of hits in a scrollable pane. But then it's just as easy to implement this using
TopDocCollector/TopDocs as shown in the SearchFiles demo (in this patch). The latter approach
is also much more flexible, as it allows you to control the parameters.

The TopDocs/HitCollector-based approach is basically one level below Hits, and thus, Hits
clearly be regarded a convenience class then.

What are in your opinion the advantages of using an Iterator interface instead of looping
a ScoreDoc[] array?

> Deprecate Hits
> --------------
>                 Key: LUCENE-1290
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Task
>          Components: Search
>            Reporter: Michael Busch
>            Assignee: Michael Busch
>            Priority: Minor
>             Fix For: 2.4
>         Attachments: lucene-1290.patch, lucene-1290.patch
> The Hits class has several drawbacks as pointed out in LUCENE-954.
> The other search APIs that use TopDocCollector and TopDocs should be used instead.
> This patch:
> - deprecates org/apache/lucene/search/Hits, Hit, and HitIterator, as well as
>   the * ) methods which return a Hits Object.
> - removes all references to Hits from the core and uses TopDocs and ScoreDoc
>   instead
> - Changes the demo SearchFiles: adds the two modes 'paging search' and 'streaming search',
>   each of which demonstrating a different way of using the search APIs. The former
>   uses TopDocs and a TopDocCollector, the latter a custom HitCollector implementation.
> - Updates the online tutorial that descibes the demo.
> All tests pass.

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:
For additional commands, e-mail:

View raw message