mirror of https://github.com/apache/lucene.git
Added subDoc() method, renamed searcherIndex() to subSearcher().
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@149895 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
686bdde10b
commit
57cdbe4187
|
@ -98,13 +98,20 @@ public class MultiSearcher extends Searcher implements Searchable {
|
||||||
|
|
||||||
/** For use by {@link HitCollector} implementations. */
|
/** For use by {@link HitCollector} implementations. */
|
||||||
public Document doc(int n) throws IOException {
|
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
|
return searchables[i].doc(n - starts[i]); // dispatch to searcher
|
||||||
}
|
}
|
||||||
|
|
||||||
/** For use by {@link HitCollector} implementations to identify the
|
/** Call {@link #subSearcher} instead.
|
||||||
* index of the sub-searcher that a particular hit came from. */
|
* @deprecated
|
||||||
public int searcherIndex(int n) { // find searcher for doc n:
|
*/
|
||||||
|
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
|
// replace w/ call to Arrays.binarySearch in Java 1.2
|
||||||
int lo = 0; // search starts array
|
int lo = 0; // search starts array
|
||||||
int hi = searchables.length - 1; // for first element less
|
int hi = searchables.length - 1; // for first element less
|
||||||
|
@ -126,6 +133,12 @@ public class MultiSearcher extends Searcher implements Searchable {
|
||||||
return hi;
|
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 {
|
public int maxDoc() throws IOException {
|
||||||
return maxDoc;
|
return maxDoc;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue