You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Uwe Schindler (JIRA)" <ji...@apache.org> on 2008/05/21 09:22:55 UTC

[jira] Issue Comment Edited: (LUCENE-1290) Deprecate Hits

    [ https://issues.apache.org/jira/browse/LUCENE-1290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12598569#action_12598569 ] 

thetaphi edited comment on LUCENE-1290 at 5/21/08 12:21 AM:
-----------------------------------------------------------------

Christian:
For my project "panFMP", I created a List-based wrapper on top of current "Hits", which also uses some special assumptions on the index structure behind (which is used by panFMP): http://panfmp.svn.sourceforge.net/viewvc/panfmp/main/trunk/src/de/pangaea/metadataportal/search/SearchResultList.java?view=markup
On my plan is to change this to use TopDocCollector and only cache the ScoreDoc instances (id and score). My example just shows, how AbstractList may be used. The problem with AbstractList is, that get() cannot throw Exceptions, but you get the Iterator for free. For better performance, your could also overwrite iterator() and use a sequential TopDocs-based approach for fetching results.

With the Java Collections List you could also do this syntactical sugar :-) for displaying Google-Like search results (based on the implementation above):

 int start=0,count=10;
 List<SearchResultItem> page=list.subList(
   Math.min(start, list.size()),
   Math.min(start+count, list.size())
 );
 for (SearchResultItem item : page) {
   System.out.println(item.getIdentifier());
 }


      was (Author: thetaphi):
    Christian:
For my project "panFMP", I created a List-based wrapper on top of current "Hits", which also uses some special assumptions on the index structure behind (which is used by panFMP): http://panfmp.svn.sourceforge.net/viewvc/panfmp/main/trunk/src/de/pangaea/metadataportal/search/SearchResultList.java?view=markup
On my plan is to change this to use TopDocCollector and only cache the ScoreDoc instances (id and score). My example just shows, how AbstractList may be used. The problem with AbstractList is, that get() cannot throw Exceptions, but you get the Iterator for free. For better performance, your could also overwrite iterator() and use a sequential TopDocs-based approach for fetching results.
  
> 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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org