Index: .classpath =================================================================== RCS file: .classpath diff -N .classpath --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ .classpath 8 Oct 2003 14:05:47 -0000 @@ -0,0 +1,9 @@ + + + + + + + + + Index: src/java/org/apache/lucene/search/Hits.java =================================================================== RCS file: /home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/search/Hits.java,v retrieving revision 1.8 diff -u -r1.8 Hits.java --- src/java/org/apache/lucene/search/Hits.java 13 Sep 2003 23:40:29 -0000 1.8 +++ src/java/org/apache/lucene/search/Hits.java 8 Oct 2003 14:05:47 -0000 @@ -55,12 +55,13 @@ */ import java.io.IOException; +import java.util.AbstractList; import java.util.Vector; import org.apache.lucene.document.Document; /** A ranked list of documents, used to hold search results. */ -public final class Hits { +public final class Hits extends AbstractList { private Query query; private Searcher searcher; private Filter filter = null; @@ -189,6 +190,29 @@ numDocs--; } + + /* (non-Javadoc) + * @see java.util.List#get(int) + */ + public final Object get(int index) { + Document doc; + try { + doc = doc(index); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e.getMessage()); + // TODO can we do something better here or is this the right thing to do? + } + return doc; + } + + /* (non-Javadoc) + * @see java.util.Collection#size() + */ + public final int size() { + return length(); + } + } final class HitDoc {