lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject cvs commit: jakarta-lucene/src/java/org/apache/lucene/search MultiSearcher.java
Date Mon, 25 Nov 2002 20:50:15 GMT
cutting     2002/11/25 12:50:15

  Modified:    src/java/org/apache/lucene/search MultiSearcher.java
  Log:
  Added subDoc() method, renamed searcherIndex() to subSearcher().
  
  Revision  Changes    Path
  1.7       +17 -4     jakarta-lucene/src/java/org/apache/lucene/search/MultiSearcher.java
  
  Index: MultiSearcher.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/search/MultiSearcher.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- MultiSearcher.java	20 Sep 2002 17:25:13 -0000	1.6
  +++ MultiSearcher.java	25 Nov 2002 20:50:15 -0000	1.7
  @@ -98,13 +98,20 @@
   
     /** For use by {@link HitCollector} implementations. */
     public Document doc(int n) throws IOException {
  -    int i = searcherIndex(n);			  // find searcher index
  +    int i = subSearcher(n);			  // find searcher index
       return searchables[i].doc(n - starts[i]);	  // dispatch to searcher
     }
   
  -  /** For use by {@link HitCollector} implementations to identify the
  -   * index of the sub-searcher that a particular hit came from. */
  -  public int searcherIndex(int n) {               // find searcher for doc n:
  +  /** Call {@link #subSearcher} instead.
  +   * @deprecated
  +   */
  +  public int searcherIndex(int n) {
  +    return subSearcher(n);
  +  }
  +
  +  /** Returns index of the searcher for document <code>n</code> in the array
  +   * used to construct this searcher. */
  +  public int subSearcher(int n) {                 // find searcher for doc n:
       // replace w/ call to Arrays.binarySearch in Java 1.2
       int lo = 0;					  // search starts array
       int hi = searchables.length - 1;		  // for first element less
  @@ -124,6 +131,12 @@
         }
       }
       return hi;
  +  }
  +
  +  /** Returns the document number of document <code>n</code> within its
  +   * sub-index. */
  +  public int subDoc(int n) {
  +    return n - starts[subSearcher(n)];
     }
   
     public int maxDoc() throws IOException {
  
  
  

--
To unsubscribe, e-mail:   <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>


Mime
View raw message