lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From busc...@apache.org
Subject svn commit: r659626 [1/3] - in /lucene/java/trunk: ./ docs/ src/demo/org/apache/lucene/demo/ src/java/org/apache/lucene/document/ src/java/org/apache/lucene/search/ src/site/src/documentation/content/xdocs/ src/test/org/apache/lucene/ src/test/org/apac...
Date Fri, 23 May 2008 18:58:02 GMT
Author: buschmi
Date: Fri May 23 11:57:55 2008
New Revision: 659626

URL: http://svn.apache.org/viewvc?rev=659626&view=rev
Log:
LUCENE-1290: Deprecate org.apache.lucene.search.Hits, Hit and HitIterator.

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/docs/demo2.html
    lucene/java/trunk/docs/demo2.pdf
    lucene/java/trunk/docs/scoring.html
    lucene/java/trunk/docs/scoring.pdf
    lucene/java/trunk/src/demo/org/apache/lucene/demo/SearchFiles.java
    lucene/java/trunk/src/java/org/apache/lucene/document/Document.java
    lucene/java/trunk/src/java/org/apache/lucene/search/Hit.java
    lucene/java/trunk/src/java/org/apache/lucene/search/HitIterator.java
    lucene/java/trunk/src/java/org/apache/lucene/search/Hits.java
    lucene/java/trunk/src/java/org/apache/lucene/search/Searcher.java
    lucene/java/trunk/src/site/src/documentation/content/xdocs/demo2.xml
    lucene/java/trunk/src/site/src/documentation/content/xdocs/scoring.xml
    lucene/java/trunk/src/test/org/apache/lucene/SearchTest.java
    lucene/java/trunk/src/test/org/apache/lucene/SearchTestForDuplicates.java
    lucene/java/trunk/src/test/org/apache/lucene/TestDemo.java
    lucene/java/trunk/src/test/org/apache/lucene/TestHitIterator.java
    lucene/java/trunk/src/test/org/apache/lucene/TestSearch.java
    lucene/java/trunk/src/test/org/apache/lucene/TestSearchForDuplicates.java
    lucene/java/trunk/src/test/org/apache/lucene/ThreadSafetyTest.java
    lucene/java/trunk/src/test/org/apache/lucene/analysis/TestKeywordAnalyzer.java
    lucene/java/trunk/src/test/org/apache/lucene/document/TestDocument.java
    lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
    lucene/java/trunk/src/test/org/apache/lucene/index/TestDeletionPolicy.java
    lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReader.java
    lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReaderReopen.java
    lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java
    lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterDelete.java
    lucene/java/trunk/src/test/org/apache/lucene/index/TestLazyProxSkipping.java
    lucene/java/trunk/src/test/org/apache/lucene/index/TestParallelReader.java
    lucene/java/trunk/src/test/org/apache/lucene/queryParser/TestMultiFieldQueryParser.java
    lucene/java/trunk/src/test/org/apache/lucene/queryParser/TestQueryParser.java
    lucene/java/trunk/src/test/org/apache/lucene/search/CheckHits.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestBoolean2.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestBooleanOr.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestBooleanScorer.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestConstantScoreRangeQuery.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestCustomSearcherSort.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestDateFilter.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestDateSort.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestFilteredQuery.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestFilteredSearch.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestFuzzyQuery.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestMultiSearcher.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestMultiSearcherRanking.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestNot.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestPhrasePrefixQuery.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestPhraseQuery.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestPositionIncrement.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestPrefixFilter.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestPrefixQuery.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestRangeFilter.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestRangeQuery.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestRemoteSearchable.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestSearchHitsWithDeletions.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestSort.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestTermVectors.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestTimeLimitedCollector.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestWildcard.java
    lucene/java/trunk/src/test/org/apache/lucene/search/function/TestFieldScoreQuery.java
    lucene/java/trunk/src/test/org/apache/lucene/search/function/TestOrdValues.java
    lucene/java/trunk/src/test/org/apache/lucene/store/TestBufferedIndexInput.java
    lucene/java/trunk/src/test/org/apache/lucene/store/TestLockFactory.java

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Fri May 23 11:57:55 2008
@@ -66,6 +66,10 @@
 
  8. LUCENE-852: Let the SpellChecker caller specify IndexWriter mergeFactor
     and RAM buffer size.  (Otis Gospodnetic)
+	
+ 9. LUCENE-1290: Deprecate org.apache.lucene.search.Hits, Hit and HitIterator
+    and remove all references to these classes from the core. Also update demos
+    and tutorials. (Michael Busch)
 
 Bug fixes
     

Modified: lucene/java/trunk/docs/demo2.html
URL: http://svn.apache.org/viewvc/lucene/java/trunk/docs/demo2.html?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/docs/demo2.html (original)
+++ lucene/java/trunk/docs/demo2.html Fri May 23 11:57:55 2008
@@ -339,14 +339,23 @@
 the results from the <span class="codefrag">QueryParser</span> which is passed to
 the searcher.  Note that it's also possible to programmatically construct a rich <span class="codefrag">Query</span> object without using the query
 parser.  The query parser just enables decoding the <a href="queryparsersyntax.html">Lucene query
-syntax</a> into the corresponding <span class="codefrag">Query</span> object.  The searcher results are
-returned in a collection of Documents called <span class="codefrag">Hits</span> which is then iterated through and
-displayed to the user.
+syntax</a> into the corresponding <span class="codefrag">Query</span> object. Search can be executed in 
+two different ways: 
+<ul>
+
+<li>Streaming: A <span class="codefrag">HitCollector</span> subclass
+simply prints out the document ID and score for each matching document.</li>
+
+<li>Paging: Using a <span class="codefrag">TopDocCollector</span> 
+the search results are printed in pages, sorted by score (i. e. relevance).</li>
+
+</ul>  
+
 </p>
 </div>
 
 
-<a name="N100ED"></a><a name="The Web example..."></a>
+<a name="N100FB"></a><a name="The Web example..."></a>
 <h2 class="boxed">The Web example...</h2>
 <div class="section">
 <p>

Modified: lucene/java/trunk/docs/demo2.pdf
URL: http://svn.apache.org/viewvc/lucene/java/trunk/docs/demo2.pdf?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/docs/demo2.pdf (original)
+++ lucene/java/trunk/docs/demo2.pdf Fri May 23 11:57:55 2008
@@ -95,10 +95,10 @@
 >>
 endobj
 20 0 obj
-<< /Length 2152 /Filter [ /ASCII85Decode /FlateDecode ]
+<< /Length 2312 /Filter [ /ASCII85Decode /FlateDecode ]
  >>
 stream
-Gatm=hf%7-&:X@\Tsl:4.n^TLCC^U&F_NdV6b=0`L1Ln&`7Sm;d3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=X\pe\a>*inV;riZ>%a7MoQ0,$1TSNT3#&>jH&1fjBMW;DRX:5<320Yj&%5o!4H[-GH*:<j_'M,0cMK9ebV9\AnpDr,U36EJ8*-fUic_9``80;7[G]i5pN,fX7X0T^L>DN*+-VF=rV\HSjC4LbV3I(W\NSpb,%O.0UZA@^A30a3onMRh9f^45bZ5eCA`A)02`*Ao1@JC$ejTF=Q&4lcq$Bfl\n!Q"EUhlC#>\)Y95+pr4-S#tPjrNd-+D%/mA<$s3dh0qd4-g4XP/8,g?V=j[kY)C3&baKo'Z@iOk]:V9E24*@JU-;eV22=s*=C6cjNr'@#b^c#~>
 endstream
 endobj
 21 0 obj
@@ -233,7 +233,7 @@
 17 0 obj
 <<
 /S /GoTo
-/D [21 0 R /XYZ 85.0 335.866 null]
+/D [21 0 R /XYZ 85.0 290.266 null]
 >>
 endobj
 22 0 obj
@@ -244,39 +244,39 @@
 xref
 0 34
 0000000000 65535 f 
-0000008534 00000 n 
-0000008606 00000 n 
-0000008698 00000 n 
+0000008694 00000 n 
+0000008766 00000 n 
+0000008858 00000 n 
 0000000015 00000 n 
 0000000071 00000 n 
 0000000777 00000 n 
 0000000897 00000 n 
 0000000950 00000 n 
-0000008832 00000 n 
+0000008992 00000 n 
 0000001085 00000 n 
-0000008895 00000 n 
+0000009055 00000 n 
 0000001221 00000 n 
-0000008961 00000 n 
+0000009121 00000 n 
 0000001358 00000 n 
-0000009027 00000 n 
+0000009187 00000 n 
 0000001495 00000 n 
-0000009091 00000 n 
+0000009251 00000 n 
 0000001632 00000 n 
 0000004447 00000 n 
 0000004555 00000 n 
-0000006800 00000 n 
-0000009157 00000 n 
-0000006908 00000 n 
-0000007081 00000 n 
-0000007316 00000 n 
-0000007482 00000 n 
-0000007677 00000 n 
-0000007872 00000 n 
-0000007985 00000 n 
-0000008095 00000 n 
-0000008203 00000 n 
-0000008309 00000 n 
-0000008425 00000 n 
+0000006960 00000 n 
+0000009317 00000 n 
+0000007068 00000 n 
+0000007241 00000 n 
+0000007476 00000 n 
+0000007642 00000 n 
+0000007837 00000 n 
+0000008032 00000 n 
+0000008145 00000 n 
+0000008255 00000 n 
+0000008363 00000 n 
+0000008469 00000 n 
+0000008585 00000 n 
 trailer
 <<
 /Size 34
@@ -284,5 +284,5 @@
 /Info 4 0 R
 >>
 startxref
-9208
+9368
 %%EOF

Modified: lucene/java/trunk/docs/scoring.html
URL: http://svn.apache.org/viewvc/lucene/java/trunk/docs/scoring.html?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/docs/scoring.html (original)
+++ lucene/java/trunk/docs/scoring.html Fri May 23 11:57:55 2008
@@ -494,9 +494,9 @@
                     , beginning the scoring process.
                 </p>
 <p>Once inside the Searcher, a
-                    <a href="api/org/apache/lucene/search/Hits.html">Hits</a>
-                    object is constructed, which handles the scoring and caching of the search results.
-                    The Hits constructor stores references to three or four important objects:
+                    <a href="api/org/apache/lucene/search/HitCollector.html">HitCollector</a>
+                    is used for the scoring and sorting of the search results.
+                    These important objects are involved in a search:
                     <ol>
                         
 <li>The
@@ -521,12 +521,11 @@
 </ol>
                 
 </p>
-<p>Now that the Hits object has been initialized, it begins the process of identifying documents that
-                    match the query by calling getMoreDocs method. Assuming we are not sorting (since sorting doesn't
+<p> Assuming we are not sorting (since sorting doesn't
                     effect the raw Lucene score),
-                    we call on the "expert" search method of the Searcher, passing in our
+                    we call one of the search method of the Searcher, passing in the
                     <a href="api/org/apache/lucene/search/Weight.html">Weight</a>
-                    object,
+                    object created by Searcher.createWeight(Query),
                     <a href="api/org/apache/lucene/search/Filter.html">Filter</a>
                     and the number of results we want. This method
                     returns a

Modified: lucene/java/trunk/docs/scoring.pdf
URL: http://svn.apache.org/viewvc/lucene/java/trunk/docs/scoring.pdf?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/docs/scoring.pdf (original)
+++ lucene/java/trunk/docs/scoring.pdf Fri May 23 11:57:55 2008
@@ -213,10 +213,10 @@
 >>
 endobj
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")i/QG'DW#Z65-9E93/@mQN2qZ:MU9$d23"CrMcLBfAYUh#oI(Uql_g8_W^e+95Miq3iteh/4&L5.TaVSo;5)Lqp<)mM^
 ab[feJRYEAN7W<VcTqQ]$F~>
 endstream
 endobj
 41 0 obj
@@ -484,39 +484,39 @@
 xref
 0 63
 0000000000 65535 f 
-0000017942 00000 n 
-0000018035 00000 n 
-0000018127 00000 n 
+0000017815 00000 n 
+0000017908 00000 n 
+0000018000 00000 n 
 0000000015 00000 n 
 0000000071 00000 n 
 0000001068 00000 n 
 0000001188 00000 n 
 0000001297 00000 n 
-0000018250 00000 n 
+0000018123 00000 n 
 0000001432 00000 n 
-0000018313 00000 n 
+0000018186 00000 n 
 0000001569 00000 n 
-0000018379 00000 n 
+0000018252 00000 n 
 0000001706 00000 n 
-0000018445 00000 n 
+0000018318 00000 n 
 0000001843 00000 n 
-0000018509 00000 n 
+0000018382 00000 n 
 0000001979 00000 n 
-0000018575 00000 n 
+0000018448 00000 n 
 0000002116 00000 n 
-0000018641 00000 n 
+0000018514 00000 n 
 0000002253 00000 n 
-0000018705 00000 n 
+0000018578 00000 n 
 0000002389 00000 n 
-0000018771 00000 n 
+0000018644 00000 n 
 0000002526 00000 n 
-0000018837 00000 n 
+0000018710 00000 n 
 0000002663 00000 n 
-0000018901 00000 n 
+0000018774 00000 n 
 0000002799 00000 n 
-0000018967 00000 n 
+0000018840 00000 n 
 0000002935 00000 n 
-0000019033 00000 n 
+0000018906 00000 n 
 0000003072 00000 n 
 0000005698 00000 n 
 0000005806 00000 n 
@@ -524,28 +524,28 @@
 0000008243 00000 n 
 0000010669 00000 n 
 0000010777 00000 n 
-0000013000 00000 n 
-0000013108 00000 n 
-0000014526 00000 n 
-0000019098 00000 n 
-0000014634 00000 n 
-0000014797 00000 n 
-0000014985 00000 n 
-0000015205 00000 n 
-0000015404 00000 n 
-0000015715 00000 n 
-0000015919 00000 n 
-0000016112 00000 n 
-0000016327 00000 n 
-0000016648 00000 n 
-0000016828 00000 n 
-0000017013 00000 n 
-0000017230 00000 n 
-0000017386 00000 n 
-0000017499 00000 n 
-0000017609 00000 n 
-0000017717 00000 n 
-0000017833 00000 n 
+0000012873 00000 n 
+0000012981 00000 n 
+0000014399 00000 n 
+0000018971 00000 n 
+0000014507 00000 n 
+0000014670 00000 n 
+0000014858 00000 n 
+0000015078 00000 n 
+0000015277 00000 n 
+0000015588 00000 n 
+0000015792 00000 n 
+0000015985 00000 n 
+0000016200 00000 n 
+0000016521 00000 n 
+0000016701 00000 n 
+0000016886 00000 n 
+0000017103 00000 n 
+0000017259 00000 n 
+0000017372 00000 n 
+0000017482 00000 n 
+0000017590 00000 n 
+0000017706 00000 n 
 trailer
 <<
 /Size 63
@@ -553,5 +553,5 @@
 /Info 4 0 R
 >>
 startxref
-19149
+19022
 %%EOF

Modified: lucene/java/trunk/src/demo/org/apache/lucene/demo/SearchFiles.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/demo/org/apache/lucene/demo/SearchFiles.java?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/src/demo/org/apache/lucene/demo/SearchFiles.java (original)
+++ lucene/java/trunk/src/demo/org/apache/lucene/demo/SearchFiles.java Fri May 23 11:57:55 2008
@@ -17,22 +17,24 @@
  * limitations under the License.
  */
 
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.Date;
+
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.index.FilterIndexReader;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.queryParser.QueryParser;
-import org.apache.lucene.search.Hits;
+import org.apache.lucene.search.HitCollector;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Query;
+import org.apache.lucene.search.ScoreDoc;
 import org.apache.lucene.search.Searcher;
-
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.Date;
+import org.apache.lucene.search.TopDocCollector;
 
 /** Simple command-line based search demo. */
 public class SearchFiles {
@@ -60,7 +62,8 @@
   /** Simple command-line based search demo. */
   public static void main(String[] args) throws Exception {
     String usage =
-      "Usage: java org.apache.lucene.demo.SearchFiles [-index dir] [-field f] [-repeat n] [-queries file] [-raw] [-norms field]";
+      "Usage:\tjava org.apache.lucene.demo.SearchFiles [-index dir] [-field f] [-repeat n] [-queries file] [-raw] [-norms field] [-paging hitsPerPage]";
+    usage += "\n\tSpecify 'false' for hitsPerPage to use streaming instead of paging search.";
     if (args.length > 0 && ("-h".equals(args[0]) || "-help".equals(args[0]))) {
       System.out.println(usage);
       System.exit(0);
@@ -72,6 +75,8 @@
     int repeat = 0;
     boolean raw = false;
     String normsField = null;
+    boolean paging = true;
+    int hitsPerPage = 10;
     
     for (int i = 0; i < args.length; i++) {
       if ("-index".equals(args[i])) {
@@ -91,6 +96,16 @@
       } else if ("-norms".equals(args[i])) {
         normsField = args[i+1];
         i++;
+      } else if ("-paging".equals(args[i])) {
+        if (args[i+1].equals("false")) {
+          paging = false;
+        } else {
+          hitsPerPage = Integer.parseInt(args[i+1]);
+          if (hitsPerPage == 0) {
+            paging = false;
+          }
+        }
+        i++;
       }
     }
     
@@ -125,53 +140,149 @@
       Query query = parser.parse(line);
       System.out.println("Searching for: " + query.toString(field));
 
-      Hits hits = searcher.search(query);
-      
+            
       if (repeat > 0) {                           // repeat & time as benchmark
         Date start = new Date();
         for (int i = 0; i < repeat; i++) {
-          hits = searcher.search(query);
+          searcher.search(query, null, 100);
         }
         Date end = new Date();
         System.out.println("Time: "+(end.getTime()-start.getTime())+"ms");
       }
 
-      System.out.println(hits.length() + " total matching documents");
+      if (paging) {
+        doPagingSearch(in, searcher, query, hitsPerPage, raw, queries == null);
+      } else {
+        doStreamingSearch(searcher, query);
+      }
+    }
+    reader.close();
+  }
+  
+  /**
+   * This method uses a custom HitCollector implementation which simply prints out
+   * the docId and score of every matching document. 
+   * 
+   *  This simulates the streaming search use case, where all hits are supposed to
+   *  be processed, regardless of their relevance.
+   */
+  public static void doStreamingSearch(final Searcher searcher, Query query) throws IOException {
+    HitCollector streamingHitCollector = new HitCollector() {
+      
+      // simply print docId and score of every matching document
+      public void collect(int doc, float score) {
+        System.out.println("doc="+doc+" score="+score);
+      }
+      
+    };
+    
+    searcher.search(query, streamingHitCollector);
+  }
+
+  /**
+   * This demonstrates a typical paging search scenario, where the search engine presents 
+   * pages of size n to the user. The user can then go to the next page if interested in
+   * the next hits.
+   * 
+   * When the query is executed for the first time, then only enough results are collected
+   * to fill 5 result pages. If the user wants to page beyond this limit, then the query
+   * is executed another time and all hits are collected.
+   * 
+   */
+  public static void doPagingSearch(BufferedReader in, Searcher searcher, Query query, 
+                                     int hitsPerPage, boolean raw, boolean interactive) throws IOException {
+ 
+    // Collect enough docs to show 5 pages
+    TopDocCollector collector = new TopDocCollector(5 * hitsPerPage);
+    searcher.search(query, collector);
+    ScoreDoc[] hits = collector.topDocs().scoreDocs;
+    
+    int numTotalHits = collector.getTotalHits();
+    System.out.println(numTotalHits + " total matching documents");
 
-      final int HITS_PER_PAGE = 10;
-      for (int start = 0; start < hits.length(); start += HITS_PER_PAGE) {
-        int end = Math.min(hits.length(), start + HITS_PER_PAGE);
-        for (int i = start; i < end; i++) {
-
-          if (raw) {                              // output raw format
-            System.out.println("doc="+hits.id(i)+" score="+hits.score(i));
-            continue;
-          }
-
-          Document doc = hits.doc(i);
-          String path = doc.get("path");
-          if (path != null) {
-            System.out.println((i+1) + ". " + path);
-            String title = doc.get("title");
-            if (title != null) {
-              System.out.println("   Title: " + doc.get("title"));
-            }
-          } else {
-            System.out.println((i+1) + ". " + "No path for this document");
+    int start = 0;
+    int end = Math.min(numTotalHits, hitsPerPage);
+        
+    while (true) {
+      if (end > hits.length) {
+        System.out.println("Only results 1 - " + hits.length +" of " + numTotalHits + " total matching documents collected.");
+        System.out.println("Collect more (y/n) ?");
+        String line = in.readLine();
+        if (line.length() == 0 || line.charAt(0) == 'n') {
+          break;
+        }
+
+        collector = new TopDocCollector(numTotalHits);
+        searcher.search(query, collector);
+        hits = collector.topDocs().scoreDocs;
+      }
+      
+      end = Math.min(hits.length, start + hitsPerPage);
+      
+      for (int i = start; i < end; i++) {
+        if (raw) {                              // output raw format
+          System.out.println("doc="+hits[i].doc+" score="+hits[i].score);
+          continue;
+        }
+
+        Document doc = searcher.doc(hits[i].doc);
+        String path = doc.get("path");
+        if (path != null) {
+          System.out.println((i+1) + ". " + path);
+          String title = doc.get("title");
+          if (title != null) {
+            System.out.println("   Title: " + doc.get("title"));
           }
+        } else {
+          System.out.println((i+1) + ". " + "No path for this document");
         }
+                  
+      }
 
-        if (queries != null)                      // non-interactive
-          break;
-        
-        if (hits.length() > end) {
-          System.out.println("more (y/n) ? ");
-          line = in.readLine();
-          if (line.length() == 0 || line.charAt(0) == 'n')
+      if (!interactive) {
+        break;
+      }
+
+      if (numTotalHits >= end) {
+        boolean quit = false;
+        while (true) {
+          System.out.print("Press ");
+          if (start - hitsPerPage >= 0) {
+            System.out.print("(p)revious page, ");  
+          }
+          if (start + hitsPerPage < numTotalHits) {
+            System.out.print("(n)ext page, ");
+          }
+          System.out.println("(q)uit or enter number to jump to a page.");
+          
+          String line = in.readLine();
+          if (line.length() == 0 || line.charAt(0)=='q') {
+            quit = true;
+            break;
+          }
+          if (line.charAt(0) == 'p') {
+            start = Math.max(0, start - hitsPerPage);
+            break;
+          } else if (line.charAt(0) == 'n') {
+            if (start + hitsPerPage < numTotalHits) {
+              start+=hitsPerPage;
+            }
             break;
+          } else {
+            int page = Integer.parseInt(line);
+            if ((page - 1) * hitsPerPage < numTotalHits) {
+              start = (page - 1) * hitsPerPage;
+              break;
+            } else {
+              System.out.println("No such page");
+            }
+          }
         }
+        if (quit) break;
+        end = Math.min(numTotalHits, start + hitsPerPage);
       }
+      
     }
-    reader.close();
+
   }
 }

Modified: lucene/java/trunk/src/java/org/apache/lucene/document/Document.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/document/Document.java?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/document/Document.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/document/Document.java Fri May 23 11:57:55 2008
@@ -18,7 +18,7 @@
  */
 
 import java.util.*;             // for javadoc
-import org.apache.lucene.search.Hits;  // for javadoc
+import org.apache.lucene.search.ScoreDoc; // for javadoc
 import org.apache.lucene.search.Searcher;  // for javadoc
 import org.apache.lucene.index.IndexReader;  // for javadoc
 
@@ -32,7 +32,7 @@
  *
  * <p>Note that fields which are <i>not</i> {@link Fieldable#isStored() stored} are
  * <i>not</i> available in documents retrieved from the index, e.g. with {@link
- * Hits#doc(int)}, {@link Searcher#doc(int)} or {@link
+ * ScoreDoc#doc}, {@link Searcher#doc(int)} or {@link
  * IndexReader#document(int)}.
  */
 

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/Hit.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/Hit.java?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/Hit.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/Hit.java Fri May 23 11:57:55 2008
@@ -26,6 +26,7 @@
  * Wrapper used by {@link HitIterator} to provide a lazily loaded hit
  * from {@link Hits}.
  *
+ * @deprecated Hits will be removed in Lucene 3.0. Use {@link TopDocCollector} and {@link TopDocs} instead. 
  * @author Jeremy Rayner
  */
 public class Hit implements java.io.Serializable {

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/HitIterator.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/HitIterator.java?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/HitIterator.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/HitIterator.java Fri May 23 11:57:55 2008
@@ -25,6 +25,7 @@
  * {@link Hits#iterator()} returns an instance of this class.  Calls to {@link #next()}
  * return a {@link Hit} instance.
  *
+ * @deprecated Hits will be removed in Lucene 3.0. Use {@link TopDocCollector} and {@link TopDocs} instead.
  * @author Jeremy Rayner
  */
 public class HitIterator implements Iterator {
@@ -76,3 +77,4 @@
   }
 }
 
+

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/Hits.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/Hits.java?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/Hits.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/Hits.java Fri May 23 11:57:55 2008
@@ -38,6 +38,19 @@
  * {@link java.util.ConcurrentModificationException ConcurrentModificationException}
  * is thrown when accessing hit <code>n</code> &ge; current_{@link #length()} 
  * (but <code>n</code> &lt; {@link #length()}_at_start). 
+ * 
+ * @deprecated Hits will be removed in Lucene 3.0. <p>
+ * Instead e. g. {@link TopDocCollector} and {@link TopDocs} can be used:<br>
+ * <pre>
+ *   TopDocCollector collector = new TopDocCollector(hitsPerPage);
+ *   searcher.search(query, collector);
+ *   ScoreDoc[] hits = collector.topDocs().scoreDocs;
+ *   for (int i = 0; i < hits.length; i++) {
+ *     int docId = hits[i].doc;
+ *     Document d = searcher.doc(docId);
+ *     // do something with current hit
+ *     ...
+ * </pre>
  */
 public final class Hits {
   private Weight weight;

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/Searcher.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/Searcher.java?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/Searcher.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/Searcher.java Fri May 23 11:57:55 2008
@@ -33,6 +33,8 @@
 
   /** Returns the documents matching <code>query</code>. 
    * @throws BooleanQuery.TooManyClauses
+   * @deprecated Hits will be removed in Lucene 3.0. Use
+   * {@link #search(Query, Filter, int))} instead.
    */
   public final Hits search(Query query) throws IOException {
     return search(query, (Filter)null);
@@ -41,6 +43,8 @@
   /** Returns the documents matching <code>query</code> and
    * <code>filter</code>.
    * @throws BooleanQuery.TooManyClauses
+   * @deprecated Hits will be removed in Lucene 3.0. Use
+   * {@link #search(Query, Filter, int))} instead.
    */
   public Hits search(Query query, Filter filter) throws IOException {
     return new Hits(this, query, filter);
@@ -49,6 +53,8 @@
   /** Returns documents matching <code>query</code> sorted by
    * <code>sort</code>.
    * @throws BooleanQuery.TooManyClauses
+   * @deprecated Hits will be removed in Lucene 3.0. Use 
+   * {@link #search(Query, Filter, int, Sort))} instead.
    */
   public Hits search(Query query, Sort sort)
     throws IOException {
@@ -58,13 +64,15 @@
   /** Returns documents matching <code>query</code> and <code>filter</code>,
    * sorted by <code>sort</code>.
    * @throws BooleanQuery.TooManyClauses
+   * @deprecated Hits will be removed in Lucene 3.0. Use 
+   * {@link #search(Query, Filter, int, Sort))} instead.
    */
   public Hits search(Query query, Filter filter, Sort sort)
     throws IOException {
     return new Hits(this, query, filter, sort);
   }
 
-  /** Expert: Low-level search implementation with arbitrary sorting.  Finds
+  /** Search implementation with arbitrary sorting.  Finds
    * the top <code>n</code> hits for <code>query</code>, applying
    * <code>filter</code> if non-null, and sorting the hits by the criteria in
    * <code>sort</code>.
@@ -105,7 +113,7 @@
    *
    * <p>Applications should only use this if they need <i>all</i> of the
    * matching documents.  The high-level search API ({@link
-   * Searcher#search(Query)}) is usually more efficient, as it skips
+   * Searcher#search(Query, Filter, int))}) is usually more efficient, as it skips
    * non-high-scoring hits.
    *
    * @param query to match documents
@@ -118,13 +126,9 @@
     search(createWeight(query), filter, results);
   }
 
-  /** Expert: Low-level search implementation.  Finds the top <code>n</code>
+  /** Finds the top <code>n</code>
    * hits for <code>query</code>, applying <code>filter</code> if non-null.
    *
-   * <p>Called by {@link Hits}.
-   *
-   * <p>Applications should usually call {@link Searcher#search(Query)} or
-   * {@link Searcher#search(Query,Filter)} instead.
    * @throws BooleanQuery.TooManyClauses
    */
   public TopDocs search(Query query, Filter filter, int n)

Modified: lucene/java/trunk/src/site/src/documentation/content/xdocs/demo2.xml
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/site/src/documentation/content/xdocs/demo2.xml?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/src/site/src/documentation/content/xdocs/demo2.xml (original)
+++ lucene/java/trunk/src/site/src/documentation/content/xdocs/demo2.xml Fri May 23 11:57:55 2008
@@ -118,10 +118,14 @@
 href="api/org/apache/lucene/search/Query.html">Query</a></code> object without using the query
 parser.  The query parser just enables decoding the <a href="queryparsersyntax.html">Lucene query
 syntax</a> into the corresponding <code><a
-href="api/org/apache/lucene/search/Query.html">Query</a></code> object.  The searcher results are
-returned in a collection of Documents called <code><a
-href="api/org/apache/lucene/search/Hits.html">Hits</a></code> which is then iterated through and
-displayed to the user.
+href="api/org/apache/lucene/search/Query.html">Query</a></code> object. Search can be executed in 
+two different ways: 
+<ul>
+<li>Streaming: A <code><a href="api/org/apache/lucene/search/HitCollector.html">HitCollector</a></code> subclass
+simply prints out the document ID and score for each matching document.</li>
+<li>Paging: Using a <code><a href="api/org/apache/lucene/search/TopDocCollector.html">TopDocCollector</a></code> 
+the search results are printed in pages, sorted by score (i. e. relevance).</li>
+</ul>  
 </p>
 
 </section>
@@ -137,3 +141,4 @@
 </body>
 </document>
 
+

Modified: lucene/java/trunk/src/site/src/documentation/content/xdocs/scoring.xml
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/site/src/documentation/content/xdocs/scoring.xml?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/src/site/src/documentation/content/xdocs/scoring.xml (original)
+++ lucene/java/trunk/src/site/src/documentation/content/xdocs/scoring.xml Fri May 23 11:57:55 2008
@@ -207,9 +207,9 @@
                     , beginning the scoring process.
                 </p>
                 <p>Once inside the Searcher, a
-                    <a href="api/org/apache/lucene/search/Hits.html">Hits</a>
-                    object is constructed, which handles the scoring and caching of the search results.
-                    The Hits constructor stores references to three or four important objects:
+                    <a href="api/org/apache/lucene/search/HitCollector.html">HitCollector</a>
+                    is used for the scoring and sorting of the search results.
+                    These important objects are involved in a search:
                     <ol>
                         <li>The
                             <a href="api/org/apache/lucene/search/Weight.html">Weight</a>
@@ -228,12 +228,11 @@
                         </li>
                     </ol>
                 </p>
-                <p>Now that the Hits object has been initialized, it begins the process of identifying documents that
-                    match the query by calling getMoreDocs method. Assuming we are not sorting (since sorting doesn't
+                <p> Assuming we are not sorting (since sorting doesn't
                     effect the raw Lucene score),
-                    we call on the "expert" search method of the Searcher, passing in our
+                    we call one of the search method of the Searcher, passing in the
                     <a href="api/org/apache/lucene/search/Weight.html">Weight</a>
-                    object,
+                    object created by Searcher.createWeight(Query),
                     <a href="api/org/apache/lucene/search/Filter.html">Filter</a>
                     and the number of results we want. This method
                     returns a
@@ -288,4 +287,4 @@
             </section>
         </section>
     </body>
-</document>
\ No newline at end of file
+</document>

Modified: lucene/java/trunk/src/test/org/apache/lucene/SearchTest.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/SearchTest.java?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/SearchTest.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/SearchTest.java Fri May 23 11:57:55 2008
@@ -59,7 +59,6 @@
 // 	"\"a c\"",
 	    "\"a c e\"",
       };
-      Hits hits = null;
 
       QueryParser parser = new QueryParser("contents", analyzer);
       parser.setPhraseSlop(4);
@@ -72,12 +71,12 @@
       //DateFilter filter = DateFilter.Before("modified", Time(1997,00,01));
       //System.out.println(filter);
 
-        hits = searcher.search(query);
+        ScoreDoc[] hits = searcher.search(query, null, docs.length).scoreDocs;
 
-        System.out.println(hits.length() + " total results");
-        for (int i = 0 ; i < hits.length() && i < 10; i++) {
-          Document d = hits.doc(i);
-          System.out.println(i + " " + hits.score(i)
+        System.out.println(hits.length + " total results");
+        for (int i = 0 ; i < hits.length && i < 10; i++) {
+          Document d = searcher.doc(hits[i].doc);
+          System.out.println(i + " " + hits[i].score
 // 			   + " " + DateField.stringToDate(d.get("modified"))
             + " " + d.get("contents"));
         }

Modified: lucene/java/trunk/src/test/org/apache/lucene/SearchTestForDuplicates.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/SearchTestForDuplicates.java?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/SearchTestForDuplicates.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/SearchTestForDuplicates.java Fri May 23 11:57:55 2008
@@ -19,12 +19,18 @@
 
 import java.io.IOException;
 
-import org.apache.lucene.store.*;
-import org.apache.lucene.document.*;
-import org.apache.lucene.analysis.*;
-import org.apache.lucene.index.*;
-import org.apache.lucene.search.*;
-import org.apache.lucene.queryParser.*;
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.SimpleAnalyzer;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.ScoreDoc;
+import org.apache.lucene.search.Searcher;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.RAMDirectory;
 
 class SearchTestForDuplicates {
 
@@ -52,15 +58,15 @@
 
       // try a search without OR
       Searcher searcher = new IndexSearcher(directory);
-      Hits hits = null;
+      ScoreDoc[] hits = null;
 
       QueryParser parser = new QueryParser(PRIORITY_FIELD, analyzer);
 
       Query query = parser.parse(HIGH_PRIORITY);
       System.out.println("Query: " + query.toString(PRIORITY_FIELD));
 
-      hits = searcher.search(query);
-      printHits(hits);
+      hits = searcher.search(query, null, 1000).scoreDocs;
+      printHits(hits, searcher);
 
       searcher.close();
 
@@ -73,8 +79,8 @@
       query = parser.parse(HIGH_PRIORITY + " OR " + MED_PRIORITY);
       System.out.println("Query: " + query.toString(PRIORITY_FIELD));
 
-      hits = searcher.search(query);
-      printHits(hits);
+      hits = searcher.search(query, null, 1000).scoreDocs;
+      printHits(hits, searcher);
 
       searcher.close();
 
@@ -84,11 +90,11 @@
     }
   }
 
-  private static void printHits( Hits hits ) throws IOException {
-    System.out.println(hits.length() + " total results\n");
-    for (int i = 0 ; i < hits.length(); i++) {
+  private static void printHits( ScoreDoc[] hits, Searcher searcher) throws IOException {
+    System.out.println(hits.length + " total results\n");
+    for (int i = 0 ; i < hits.length; i++) {
       if ( i < 10 || (i > 94 && i < 105) ) {
-        Document d = hits.doc(i);
+        Document d = searcher.doc(hits[i].doc);
         System.out.println(i + " " + d.get(ID_FIELD));
       }
     }

Modified: lucene/java/trunk/src/test/org/apache/lucene/TestDemo.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/TestDemo.java?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/TestDemo.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/TestDemo.java Fri May 23 11:57:55 2008
@@ -17,7 +17,8 @@
  * limitations under the License.
  */
 
-import org.apache.lucene.util.LuceneTestCase;
+import java.io.IOException;
+
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.apache.lucene.document.Document;
@@ -25,13 +26,12 @@
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.queryParser.ParseException;
 import org.apache.lucene.queryParser.QueryParser;
-import org.apache.lucene.search.Hits;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Query;
+import org.apache.lucene.search.ScoreDoc;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.RAMDirectory;
-
-import java.io.IOException;
+import org.apache.lucene.util.LuceneTestCase;
 
 /**
  * A very simple demo used in the API documentation (src/java/overview.html).
@@ -64,11 +64,11 @@
     // Parse a simple query that searches for "text":
     QueryParser parser = new QueryParser("fieldname", analyzer);
     Query query = parser.parse("text");
-    Hits hits = isearcher.search(query);
-    assertEquals(1, hits.length());
+    ScoreDoc[] hits = isearcher.search(query, null, 1000).scoreDocs;
+    assertEquals(1, hits.length);
     // Iterate through the results:
-    for (int i = 0; i < hits.length(); i++) {
-      Document hitDoc = hits.doc(i);
+    for (int i = 0; i < hits.length; i++) {
+      Document hitDoc = isearcher.doc(hits[i].doc);
       assertEquals("This is the text to be indexed.", hitDoc.get("fieldname"));
     }
     isearcher.close();

Modified: lucene/java/trunk/src/test/org/apache/lucene/TestHitIterator.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/TestHitIterator.java?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/TestHitIterator.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/TestHitIterator.java Fri May 23 11:57:55 2008
@@ -35,6 +35,8 @@
 /**
  * This test intentionally not put in the search package in order
  * to test HitIterator and Hit package protection.
+ * 
+ * @deprecated Hits will be removed in Lucene 3.0 
  */
 public class TestHitIterator extends LuceneTestCase {
   public void testIterator() throws Exception {

Modified: lucene/java/trunk/src/test/org/apache/lucene/TestSearch.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/TestSearch.java?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/TestSearch.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/TestSearch.java Fri May 23 11:57:55 2008
@@ -108,7 +108,7 @@
         "\"a c\"",
         "\"a c e\"",
       };
-      Hits hits = null;
+      ScoreDoc[] hits = null;
 
       QueryParser parser = new QueryParser("contents", analyzer);
       parser.setPhraseSlop(4);
@@ -121,12 +121,12 @@
       //DateFilter filter = DateFilter.Before("modified", Time(1997,00,01));
       //System.out.println(filter);
 
-        hits = searcher.search(query);
+        hits = searcher.search(query, null, 1000).scoreDocs;
 
-        out.println(hits.length() + " total results");
-        for (int i = 0 ; i < hits.length() && i < 10; i++) {
-          Document d = hits.doc(i);
-          out.println(i + " " + hits.score(i)
+        out.println(hits.length + " total results");
+        for (int i = 0 ; i < hits.length && i < 10; i++) {
+          Document d = searcher.doc(hits[i].doc);
+          out.println(i + " " + hits[i].score
 // 			   + " " + DateField.stringToDate(d.get("modified"))
                              + " " + d.get("contents"));
         }

Modified: lucene/java/trunk/src/test/org/apache/lucene/TestSearchForDuplicates.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/TestSearchForDuplicates.java?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/TestSearchForDuplicates.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/TestSearchForDuplicates.java Fri May 23 11:57:55 2008
@@ -101,16 +101,15 @@
 
       // try a search without OR
       Searcher searcher = new IndexSearcher(directory);
-      Hits hits = null;
 
       QueryParser parser = new QueryParser(PRIORITY_FIELD, analyzer);
 
       Query query = parser.parse(HIGH_PRIORITY);
       out.println("Query: " + query.toString(PRIORITY_FIELD));
 
-      hits = searcher.search(query);
-      printHits(out, hits);
-      checkHits(hits, MAX_DOCS);
+      ScoreDoc[] hits = searcher.search(query, null, MAX_DOCS).scoreDocs;
+      printHits(out, hits, searcher);
+      checkHits(hits, MAX_DOCS, searcher);
 
       searcher.close();
 
@@ -123,29 +122,29 @@
       query = parser.parse(HIGH_PRIORITY + " OR " + MED_PRIORITY);
       out.println("Query: " + query.toString(PRIORITY_FIELD));
 
-      hits = searcher.search(query);
-      printHits(out, hits);
-      checkHits(hits, MAX_DOCS);
+      hits = searcher.search(query, null, MAX_DOCS).scoreDocs;
+      printHits(out, hits, searcher);
+      checkHits(hits, MAX_DOCS, searcher);
 
       searcher.close();
   }
 
 
-  private void printHits(PrintWriter out, Hits hits ) throws IOException {
-    out.println(hits.length() + " total results\n");
-    for (int i = 0 ; i < hits.length(); i++) {
+  private void printHits(PrintWriter out, ScoreDoc[] hits, Searcher searcher ) throws IOException {
+    out.println(hits.length + " total results\n");
+    for (int i = 0 ; i < hits.length; i++) {
       if ( i < 10 || (i > 94 && i < 105) ) {
-        Document d = hits.doc(i);
+        Document d = searcher.doc(hits[i].doc);
         out.println(i + " " + d.get(ID_FIELD));
       }
     }
   }
 
-  private void checkHits(Hits hits, int expectedCount) throws IOException {
-    assertEquals("total results", expectedCount, hits.length());
-    for (int i = 0 ; i < hits.length(); i++) {
+  private void checkHits(ScoreDoc[] hits, int expectedCount, Searcher searcher) throws IOException {
+    assertEquals("total results", expectedCount, hits.length);
+    for (int i = 0 ; i < hits.length; i++) {
       if ( i < 10 || (i > 94 && i < 105) ) {
-        Document d = hits.doc(i);
+      Document d = searcher.doc(hits[i].doc);
         assertEquals("check " + i, String.valueOf(i), d.get(ID_FIELD));
       }
     }

Modified: lucene/java/trunk/src/test/org/apache/lucene/ThreadSafetyTest.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/ThreadSafetyTest.java?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/ThreadSafetyTest.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/ThreadSafetyTest.java Fri May 23 11:57:55 2008
@@ -115,11 +115,11 @@
       throws Exception {
       System.out.println("Searching for " + n);
         QueryParser parser = new QueryParser("contents", ANALYZER);
-      Hits hits =
-        searcher.search(parser.parse(English.intToEnglish(n)));
-      System.out.println("Search for " + n + ": total=" + hits.length());
-      for (int j = 0; j < Math.min(3, hits.length()); j++) {
-        System.out.println("Hit for " + n + ": " + hits.doc(j).get("id"));
+      ScoreDoc[] hits =
+        searcher.search(parser.parse(English.intToEnglish(n)), null, 1000).scoreDocs;
+      System.out.println("Search for " + n + ": total=" + hits.length);
+      for (int j = 0; j < Math.min(3, hits.length); j++) {
+        System.out.println("Hit for " + n + ": " + searcher.doc(hits[j].doc).get("id"));
       }
     }
   }

Modified: lucene/java/trunk/src/test/org/apache/lucene/analysis/TestKeywordAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/analysis/TestKeywordAnalyzer.java?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/analysis/TestKeywordAnalyzer.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/analysis/TestKeywordAnalyzer.java Fri May 23 11:57:55 2008
@@ -17,18 +17,18 @@
  * limitations under the License.
  */
 
-import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.TermDocs;
-import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
+import org.apache.lucene.queryParser.QueryParser;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Query;
-import org.apache.lucene.search.Hits;
-import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.search.ScoreDoc;
+import org.apache.lucene.store.RAMDirectory;
+import org.apache.lucene.util.LuceneTestCase;
 
 public class TestKeywordAnalyzer extends LuceneTestCase {
   
@@ -59,10 +59,10 @@
     QueryParser queryParser = new QueryParser("description", analyzer);
     Query query = queryParser.parse("partnum:Q36 AND SPACE");
 
-    Hits hits = searcher.search(query);
+    ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs;
     assertEquals("Q36 kept as-is",
               "+partnum:Q36 +space", query.toString("description"));
-    assertEquals("doc found!", 1, hits.length());
+    assertEquals("doc found!", 1, hits.length);
   }
 
   public void testMutipleDocument() throws Exception {

Modified: lucene/java/trunk/src/test/org/apache/lucene/document/TestDocument.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/document/TestDocument.java?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/document/TestDocument.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/document/TestDocument.java Fri May 23 11:57:55 2008
@@ -1,18 +1,15 @@
 package org.apache.lucene.document;
 
-import org.apache.lucene.util.LuceneTestCase;
-
-import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.Term;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.ScoreDoc;
 import org.apache.lucene.search.Searcher;
-import org.apache.lucene.search.Hits;
+import org.apache.lucene.search.TermQuery;
+import org.apache.lucene.store.RAMDirectory;
+import org.apache.lucene.util.LuceneTestCase;
 
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -170,10 +167,10 @@
 	Query query = new TermQuery(new Term("keyword", "test1"));
 
 	// ensure that queries return expected results without DateFilter first
-        Hits hits = searcher.search(query);
-	assertEquals(1, hits.length());
+        ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs;
+  assertEquals(1, hits.length);
 
-         doAssert(hits.doc(0), true);
+         doAssert(searcher.doc(hits[0].doc), true);
          searcher.close();
     }
 
@@ -244,11 +241,11 @@
       Query query = new TermQuery(new Term("keyword", "test"));
 
       // ensure that queries return expected results without DateFilter first
-      Hits hits = searcher.search(query);
-      assertEquals(3, hits.length());
+      ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs;
+      assertEquals(3, hits.length);
       int result = 0;
       for(int i=0;i<3;i++) {
-        Document doc2 = hits.doc(i);
+        Document doc2 = searcher.doc(hits[i].doc);
         Field f = doc2.getField("id");
         if (f.stringValue().equals("id1"))
           result |= 1;

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java Fri May 23 11:57:55 2008
@@ -17,29 +17,27 @@
  * limitations under the License.
  */
 
-import org.apache.lucene.util.LuceneTestCase;
-
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.util.Arrays;
-import java.util.List;
 import java.util.Enumeration;
-import java.util.zip.ZipFile;
+import java.util.List;
 import java.util.zip.ZipEntry;
-
-import java.io.OutputStream;
-import java.io.InputStream;
-import java.io.FileOutputStream;
-import java.io.BufferedOutputStream;
-import java.io.IOException;
-import java.io.File;
+import java.util.zip.ZipFile;
 
 import org.apache.lucene.analysis.WhitespaceAnalyzer;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
 import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.ScoreDoc;
 import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.search.Hits;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.FSDirectory;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
+import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util._TestUtil;
 
 /*
@@ -180,12 +178,12 @@
     }
   }
 
-  private void testHits(Hits hits, int expectedCount, IndexReader reader) throws IOException {
-    final int hitCount = hits.length();
+  private void testHits(ScoreDoc[] hits, int expectedCount, IndexReader reader) throws IOException {
+    final int hitCount = hits.length;
     assertEquals("wrong number of hits", expectedCount, hitCount);
     for(int i=0;i<hitCount;i++) {
-      hits.doc(i);
-      reader.getTermFreqVectors(hits.id(i));
+      reader.document(hits[i].doc);
+      reader.getTermFreqVectors(hits[i].doc);
     }
   }
 
@@ -224,11 +222,11 @@
         assertEquals(7, i);
     }
     
-    Hits hits = searcher.search(new TermQuery(new Term("content", "aaa")));
+    ScoreDoc[] hits = searcher.search(new TermQuery(new Term("content", "aaa")), null, 1000).scoreDocs;
 
     // First document should be #21 since it's norm was
     // increased:
-    Document d = hits.doc(0);
+    Document d = searcher.doc(hits[0].doc);
     assertEquals("didn't get the right document first", "21", d.get("id"));
 
     testHits(hits, 34, searcher.getIndexReader());
@@ -238,12 +236,12 @@
         !oldName.startsWith("21.") &&
         !oldName.startsWith("22.")) {
       // Test on indices >= 2.3
-      hits = searcher.search(new TermQuery(new Term("utf8", "\u0000")));
-      assertEquals(34, hits.length());
-      hits = searcher.search(new TermQuery(new Term("utf8", "Lu\uD834\uDD1Ece\uD834\uDD60ne")));
-      assertEquals(34, hits.length());
-      hits = searcher.search(new TermQuery(new Term("utf8", "ab\ud917\udc17cd")));
-      assertEquals(34, hits.length());
+      hits = searcher.search(new TermQuery(new Term("utf8", "\u0000")), null, 1000).scoreDocs;
+      assertEquals(34, hits.length);
+      hits = searcher.search(new TermQuery(new Term("utf8", "Lu\uD834\uDD1Ece\uD834\uDD60ne")), null, 1000).scoreDocs;
+      assertEquals(34, hits.length);
+      hits = searcher.search(new TermQuery(new Term("utf8", "ab\ud917\udc17cd")), null, 1000).scoreDocs;
+      assertEquals(34, hits.length);
     }
 
     searcher.close();
@@ -272,8 +270,8 @@
 
     // make sure searching sees right # hits
     IndexSearcher searcher = new IndexSearcher(dir);
-    Hits hits = searcher.search(new TermQuery(new Term("content", "aaa")));
-    Document d = hits.doc(0);
+    ScoreDoc[] hits = searcher.search(new TermQuery(new Term("content", "aaa")), null, 1000).scoreDocs;
+    Document d = searcher.doc(hits[0].doc);
     assertEquals("wrong first document", "21", d.get("id"));
     testHits(hits, 44, searcher.getIndexReader());
     searcher.close();
@@ -289,9 +287,9 @@
 
     // make sure they "took":
     searcher = new IndexSearcher(dir);
-    hits = searcher.search(new TermQuery(new Term("content", "aaa")));
-    assertEquals("wrong number of hits", 43, hits.length());
-    d = hits.doc(0);
+    hits = searcher.search(new TermQuery(new Term("content", "aaa")), null, 1000).scoreDocs;
+    assertEquals("wrong number of hits", 43, hits.length);
+    d = searcher.doc(hits[0].doc);
     assertEquals("wrong first document", "22", d.get("id"));
     testHits(hits, 43, searcher.getIndexReader());
     searcher.close();
@@ -302,9 +300,9 @@
     writer.close();
 
     searcher = new IndexSearcher(dir);
-    hits = searcher.search(new TermQuery(new Term("content", "aaa")));
-    assertEquals("wrong number of hits", 43, hits.length());
-    d = hits.doc(0);
+    hits = searcher.search(new TermQuery(new Term("content", "aaa")), null, 1000).scoreDocs;
+    assertEquals("wrong number of hits", 43, hits.length);
+    d = searcher.doc(hits[0].doc);
     testHits(hits, 43, searcher.getIndexReader());
     assertEquals("wrong first document", "22", d.get("id"));
     searcher.close();
@@ -322,9 +320,9 @@
 
     // make sure searching sees right # hits
     IndexSearcher searcher = new IndexSearcher(dir);
-    Hits hits = searcher.search(new TermQuery(new Term("content", "aaa")));
-    assertEquals("wrong number of hits", 34, hits.length());
-    Document d = hits.doc(0);
+    ScoreDoc[] hits = searcher.search(new TermQuery(new Term("content", "aaa")), null, 1000).scoreDocs;
+    assertEquals("wrong number of hits", 34, hits.length);
+    Document d = searcher.doc(hits[0].doc);
     assertEquals("wrong first document", "21", d.get("id"));
     searcher.close();
 
@@ -339,9 +337,9 @@
 
     // make sure they "took":
     searcher = new IndexSearcher(dir);
-    hits = searcher.search(new TermQuery(new Term("content", "aaa")));
-    assertEquals("wrong number of hits", 33, hits.length());
-    d = hits.doc(0);
+    hits = searcher.search(new TermQuery(new Term("content", "aaa")), null, 1000).scoreDocs;
+    assertEquals("wrong number of hits", 33, hits.length);
+    d = searcher.doc(hits[0].doc);
     assertEquals("wrong first document", "22", d.get("id"));
     testHits(hits, 33, searcher.getIndexReader());
     searcher.close();
@@ -352,9 +350,9 @@
     writer.close();
 
     searcher = new IndexSearcher(dir);
-    hits = searcher.search(new TermQuery(new Term("content", "aaa")));
-    assertEquals("wrong number of hits", 33, hits.length());
-    d = hits.doc(0);
+    hits = searcher.search(new TermQuery(new Term("content", "aaa")), null, 1000).scoreDocs;
+    assertEquals("wrong number of hits", 33, hits.length);
+    d = searcher.doc(hits[0].doc);
     assertEquals("wrong first document", "22", d.get("id"));
     testHits(hits, 33, searcher.getIndexReader());
     searcher.close();

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestDeletionPolicy.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestDeletionPolicy.java?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestDeletionPolicy.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestDeletionPolicy.java Fri May 23 11:57:55 2008
@@ -17,23 +17,22 @@
  * limitations under the License.
  */
 
-import org.apache.lucene.util.LuceneTestCase;
-
 import java.io.IOException;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
 
 import org.apache.lucene.analysis.WhitespaceAnalyzer;
-import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.search.Hits;
-import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
-import java.util.List;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.HashSet;
+import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.ScoreDoc;
+import org.apache.lucene.search.TermQuery;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.RAMDirectory;
+import org.apache.lucene.util.LuceneTestCase;
 
 /*
   Verify we can read the pre-2.1 file format, do searches
@@ -440,8 +439,8 @@
         reader.deleteDocument(3*i+1);
         reader.setNorm(4*i+1, "content", 2.0F);
         IndexSearcher searcher = new IndexSearcher(reader);
-        Hits hits = searcher.search(query);
-        assertEquals(16*(1+i), hits.length());
+        ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs;
+        assertEquals(16*(1+i), hits.length);
         // this is a commit when autoCommit=false:
         reader.close();
         searcher.close();
@@ -457,8 +456,8 @@
         assertEquals(2*(N+2)-1, policy.numOnCommit);
 
       IndexSearcher searcher = new IndexSearcher(dir);
-      Hits hits = searcher.search(query);
-      assertEquals(176, hits.length());
+      ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs;
+      assertEquals(176, hits.length);
 
       // Simplistic check: just verify only the past N segments_N's still
       // exist, and, I can open a reader on each:
@@ -476,7 +475,7 @@
           // autoCommit false case:
           if (!autoCommit) {
             searcher = new IndexSearcher(reader);
-            hits = searcher.search(query);
+            hits = searcher.search(query, null, 1000).scoreDocs;
             if (i > 1) {
               if (i % 2 == 0) {
                 expectedCount += 1;
@@ -484,7 +483,7 @@
                 expectedCount -= 17;
               }
             }
-            assertEquals(expectedCount, hits.length());
+            assertEquals(expectedCount, hits.length);
             searcher.close();
           }
           reader.close();
@@ -543,8 +542,8 @@
         reader.deleteDocument(3);
         reader.setNorm(5, "content", 2.0F);
         IndexSearcher searcher = new IndexSearcher(reader);
-        Hits hits = searcher.search(query);
-        assertEquals(16, hits.length());
+        ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs;
+        assertEquals(16, hits.length);
         // this is a commit when autoCommit=false:
         reader.close();
         searcher.close();
@@ -560,8 +559,8 @@
         assertEquals(2*(N+1), policy.numOnCommit);
 
       IndexSearcher searcher = new IndexSearcher(dir);
-      Hits hits = searcher.search(query);
-      assertEquals(0, hits.length());
+      ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs;
+      assertEquals(0, hits.length);
 
       // Simplistic check: just verify only the past N segments_N's still
       // exist, and, I can open a reader on each:
@@ -579,8 +578,8 @@
           // autoCommit false case:
           if (!autoCommit) {
             searcher = new IndexSearcher(reader);
-            hits = searcher.search(query);
-            assertEquals(expectedCount, hits.length());
+            hits = searcher.search(query, null, 1000).scoreDocs;
+            assertEquals(expectedCount, hits.length);
             searcher.close();
             if (expectedCount == 0) {
               expectedCount = 16;

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReader.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReader.java?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReader.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReader.java Fri May 23 11:57:55 2008
@@ -18,25 +18,35 @@
  */
 
 
-import org.apache.lucene.util.LuceneTestCase;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
 import junit.framework.TestSuite;
 import junit.textui.TestRunner;
+
 import org.apache.lucene.analysis.WhitespaceAnalyzer;
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexReader.FieldOption;
-import org.apache.lucene.search.Hits;
 import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.ScoreDoc;
 import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.store.*;
+import org.apache.lucene.store.AlreadyClosedException;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.FSDirectory;
+import org.apache.lucene.store.LockObtainFailedException;
+import org.apache.lucene.store.MockRAMDirectory;
+import org.apache.lucene.store.RAMDirectory;
+import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util._TestUtil;
 
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.*;
-
 public class TestIndexReader extends LuceneTestCase
 {
     /** Main for running test case by itself. */
@@ -910,14 +920,14 @@
           */
 
           IndexSearcher searcher = new IndexSearcher(newReader);
-          Hits hits = null;
+          ScoreDoc[] hits = null;
           try {
-            hits = searcher.search(new TermQuery(searchTerm));
+            hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
           } catch (IOException e) {
             e.printStackTrace();
             fail(testName + ": exception when searching: " + e);
           }
-          int result2 = hits.length();
+          int result2 = hits.length;
           if (success) {
             if (result2 != END_COUNT) {
               fail(testName + ": method did not throw exception but hits.length for search on term 'aaa' is " + result2 + " instead of expected " + END_COUNT);

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReaderReopen.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReaderReopen.java?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReaderReopen.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReaderReopen.java Fri May 23 11:57:55 2008
@@ -27,6 +27,8 @@
 import java.util.Random;
 import java.util.Set;
 
+import junit.framework.TestCase;
+
 import org.apache.lucene.analysis.KeywordAnalyzer;
 import org.apache.lucene.analysis.WhitespaceAnalyzer;
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
@@ -35,16 +37,14 @@
 import org.apache.lucene.document.Field.Index;
 import org.apache.lucene.document.Field.Store;
 import org.apache.lucene.index.IndexWriter.MaxFieldLength;
-import org.apache.lucene.search.Hits;
 import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.ScoreDoc;
 import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.FSDirectory;
 import org.apache.lucene.store.RAMDirectory;
 import org.apache.lucene.util.LuceneTestCase;
 
-import junit.framework.TestCase;
-
 public class TestIndexReaderReopen extends LuceneTestCase {
     
   private File indexDir;
@@ -687,9 +687,11 @@
                 
                 
                 IndexSearcher searcher = new IndexSearcher(refreshed);
-                Hits hits = searcher.search(new TermQuery(new Term("field1", "a" + rnd.nextInt(refreshed.maxDoc()))));
-                if (hits.length() > 0) {
-                  hits.doc(0);
+                ScoreDoc[] hits = searcher.search(
+                    new TermQuery(new Term("field1", "a" + rnd.nextInt(refreshed.maxDoc()))),
+                    null, 1000).scoreDocs;
+                if (hits.length > 0) {
+                  searcher.doc(hits[0].doc);
                 }
                 
                 // r might have changed because this is not a 

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java Fri May 23 11:57:55 2008
@@ -39,7 +39,7 @@
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.search.Hits;
+import org.apache.lucene.search.ScoreDoc;
 import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.spans.SpanTermQuery;
@@ -188,8 +188,8 @@
       assertEquals("first docFreq", 57, reader.docFreq(searchTerm));
 
       IndexSearcher searcher = new IndexSearcher(reader);
-      Hits hits = searcher.search(new TermQuery(searchTerm));
-      assertEquals("first number of hits", 57, hits.length());
+      ScoreDoc[] hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
+      assertEquals("first number of hits", 57, hits.length);
       searcher.close();
       reader.close();
 
@@ -392,12 +392,12 @@
 
             searcher = new IndexSearcher(reader);
             try {
-              hits = searcher.search(new TermQuery(searchTerm));
+              hits = searcher.search(new TermQuery(searchTerm), null, END_COUNT).scoreDocs;
             } catch (IOException e) {
               e.printStackTrace(System.out);
               fail(testName + ": exception when searching: " + e);
             }
-            int result2 = hits.length();
+            int result2 = hits.length;
             if (success) {
               if (result2 != result) {
                 fail(testName + ": method did not throw exception but hits.length for search on term 'aaa' is " + result2 + " instead of expected " + result);
@@ -1016,8 +1016,8 @@
 
         Term searchTerm = new Term("content", "aaa");        
         IndexSearcher searcher = new IndexSearcher(dir);
-        Hits hits = searcher.search(new TermQuery(searchTerm));
-        assertEquals("first number of hits", 14, hits.length());
+        ScoreDoc[] hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
+        assertEquals("first number of hits", 14, hits.length);
         searcher.close();
 
         IndexReader reader = IndexReader.open(dir);
@@ -1028,8 +1028,8 @@
             addDoc(writer);
           }
           searcher = new IndexSearcher(dir);
-          hits = searcher.search(new TermQuery(searchTerm));
-          assertEquals("reader incorrectly sees changes from writer with autoCommit disabled", 14, hits.length());
+          hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
+          assertEquals("reader incorrectly sees changes from writer with autoCommit disabled", 14, hits.length);
           searcher.close();
           assertTrue("reader should have still been current", reader.isCurrent());
         }
@@ -1039,8 +1039,8 @@
         assertFalse("reader should not be current now", reader.isCurrent());
 
         searcher = new IndexSearcher(dir);
-        hits = searcher.search(new TermQuery(searchTerm));
-        assertEquals("reader did not see changes after writer was closed", 47, hits.length());
+        hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
+        assertEquals("reader did not see changes after writer was closed", 47, hits.length);
         searcher.close();
     }
 
@@ -1064,8 +1064,8 @@
 
       Term searchTerm = new Term("content", "aaa");        
       IndexSearcher searcher = new IndexSearcher(dir);
-      Hits hits = searcher.search(new TermQuery(searchTerm));
-      assertEquals("first number of hits", 14, hits.length());
+      ScoreDoc[] hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
+      assertEquals("first number of hits", 14, hits.length);
       searcher.close();
 
       writer = new IndexWriter(dir, false, new WhitespaceAnalyzer(), false, IndexWriter.MaxFieldLength.LIMITED);
@@ -1077,8 +1077,8 @@
       writer.deleteDocuments(searchTerm);
 
       searcher = new IndexSearcher(dir);
-      hits = searcher.search(new TermQuery(searchTerm));
-      assertEquals("reader incorrectly sees changes from writer with autoCommit disabled", 14, hits.length());
+      hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
+      assertEquals("reader incorrectly sees changes from writer with autoCommit disabled", 14, hits.length);
       searcher.close();
 
       // Now, close the writer:
@@ -1087,8 +1087,8 @@
       assertNoUnreferencedFiles(dir, "unreferenced files remain after abort()");
 
       searcher = new IndexSearcher(dir);
-      hits = searcher.search(new TermQuery(searchTerm));
-      assertEquals("saw changes after writer.abort", 14, hits.length());
+      hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
+      assertEquals("saw changes after writer.abort", 14, hits.length);
       searcher.close();
           
       // Now make sure we can re-open the index, add docs,
@@ -1105,15 +1105,15 @@
           addDoc(writer);
         }
         searcher = new IndexSearcher(dir);
-        hits = searcher.search(new TermQuery(searchTerm));
-        assertEquals("reader incorrectly sees changes from writer with autoCommit disabled", 14, hits.length());
+        hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
+        assertEquals("reader incorrectly sees changes from writer with autoCommit disabled", 14, hits.length);
         searcher.close();
       }
 
       writer.close();
       searcher = new IndexSearcher(dir);
-      hits = searcher.search(new TermQuery(searchTerm));
-      assertEquals("didn't see changes after close", 218, hits.length());
+      hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
+      assertEquals("didn't see changes after close", 218, hits.length);
       searcher.close();
 
       dir.close();
@@ -1437,8 +1437,8 @@
       writer.close();
 
       IndexSearcher searcher = new IndexSearcher(dir);
-      Hits hits = searcher.search(new TermQuery(new Term("field", "aaa")));
-      assertEquals(300, hits.length());
+      ScoreDoc[] hits = searcher.search(new TermQuery(new Term("field", "aaa")), null, 1000).scoreDocs;
+      assertEquals(300, hits.length);
       searcher.close();
 
       dir.close();
@@ -1463,8 +1463,8 @@
       Term searchTerm = new Term("field", "aaa");
 
       IndexSearcher searcher = new IndexSearcher(dir);
-      Hits hits = searcher.search(new TermQuery(searchTerm));
-      assertEquals(10, hits.length());
+      ScoreDoc[] hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
+      assertEquals(10, hits.length);
       searcher.close();
 
       writer  = new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
@@ -1481,8 +1481,8 @@
       }
       writer.close();
       searcher = new IndexSearcher(dir);
-      hits = searcher.search(new TermQuery(searchTerm));
-      assertEquals(27, hits.length());
+      hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
+      assertEquals(27, hits.length);
       searcher.close();
 
       IndexReader reader = IndexReader.open(dir);
@@ -1546,8 +1546,8 @@
       writer.close();
       Term searchTerm = new Term("content", "aaa");        
       IndexSearcher searcher = new IndexSearcher(dir);
-      Hits hits = searcher.search(new TermQuery(searchTerm));
-      assertEquals("did not get right number of hits", 100, hits.length());
+      ScoreDoc[] hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
+      assertEquals("did not get right number of hits", 100, hits.length);
       writer.close();
 
       writer  = new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
@@ -3587,12 +3587,12 @@
     pq.add(new Term("field", "a"));
     pq.add(new Term("field", "b"));
     pq.add(new Term("field", "c"));
-    Hits hits = s.search(pq);
-    assertEquals(1, hits.length());
+    ScoreDoc[] hits = s.search(pq, null, 1000).scoreDocs;
+    assertEquals(1, hits.length);
 
     Query q = new SpanTermQuery(new Term("field", "a"));
-    hits = s.search(q);
-    assertEquals(1, hits.length());
+    hits = s.search(q, null, 1000).scoreDocs;
+    assertEquals(1, hits.length);
     TermPositions tps = s.getIndexReader().termPositions(new Term("field", "a"));
     assertTrue(tps.next());
     assertEquals(1, tps.freq());

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterDelete.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterDelete.java?rev=659626&r1=659625&r2=659626&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterDelete.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterDelete.java Fri May 23 11:57:55 2008
@@ -20,16 +20,15 @@
 import java.io.IOException;
 import java.util.Arrays;
 
-import org.apache.lucene.util.LuceneTestCase;
-
 import org.apache.lucene.analysis.WhitespaceAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
-import org.apache.lucene.search.Hits;
 import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.ScoreDoc;
 import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.MockRAMDirectory;
+import org.apache.lucene.util.LuceneTestCase;
 
 public class TestIndexWriterDelete extends LuceneTestCase {
 
@@ -278,7 +277,7 @@
 
   private int getHitCount(Directory dir, Term term) throws IOException {
     IndexSearcher searcher = new IndexSearcher(dir);
-    int hitCount = searcher.search(new TermQuery(term)).length();
+    int hitCount = searcher.search(new TermQuery(term), null, 1000).totalHits;
     searcher.close();
     return hitCount;
   }
@@ -434,15 +433,15 @@
           }
 
           IndexSearcher searcher = new IndexSearcher(newReader);
-          Hits hits = null;
+          ScoreDoc[] hits = null;
           try {
-            hits = searcher.search(new TermQuery(searchTerm));
+            hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
           }
           catch (IOException e) {
             e.printStackTrace();
             fail(testName + ": exception when searching: " + e);
           }
-          int result2 = hits.length();
+          int result2 = hits.length;
           if (success) {
             if (x == 0 && result2 != END_COUNT) {
               fail(testName



Mime
View raw message