[
https://issues.apache.org/jira/browse/LUCENE-1290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12598594#action_12598594
]
Michael Busch commented on LUCENE-1290:
---------------------------------------
{quote}
The HitCollerctor and Iterator approach only supports forward displaying of
results.
{quote}
Even if you want to show results 100-200, then you still need to sort at least
200 results, also Hits needs to, it doesn't do any magic. Then you can as well
keep the ScoreDoc[] array to page back.
Please take a look at the patch and the new demo code, that will help you
understand how Hits and TopDocCollector/TopDocs (which is called from Hits)
work.
{quote}
The HitCollector callback is called in index order (or in any other,
non-deterministic order), whereas the results in Hits are sorted (by relevance
or any given Sort order).
{quote}
Hits uses TopDocCollector/TopDocs for sorting. The same can be achieved using
those APIs, which Searcher offers, directly. Please take a look at the patch. I
replaced a lot of usages of Hits in the test cases with the TopDocs APIs. In
most cases this was a one line change.
> Deprecate Hits
> --------------
>
> Key: LUCENE-1290
> URL: https://issues.apache.org/jira/browse/LUCENE-1290
> 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 Searcher.search( * ) 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]