From a5e5dc8794694e6f61e209defde74fcef7bc84c7 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Sat, 26 Sep 2009 13:02:48 +0000 Subject: [PATCH] LUCENE-1925: open up IndexSearcher a bit for expert usage git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@819130 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 24 +++++++++++++++++++ .../apache/lucene/search/IndexSearcher.java | 20 ++++++++++++++-- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 0a23680f4d9..8e5b7e2e6a0 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,30 @@ Lucene Change Log $Id$ +======================= Trunk (not yet released) ======================= + +Changes in backwards compatibility policy + +Changes in runtime behavior + +API Changes + +* LUCENE-1925: Make IndexSearcher's subReaders and docStarts members + protected; add expert ctor to directly specify reader, subReaders + and docStarts. (John Wang, Tim Smith via Mike McCandless) + +Bug fixes + +New features + +Optimizations + +Documentation + +Build + +Test Cases + ======================= Release 2.9.0 2009-09-23 ======================= Changes in backwards compatibility policy diff --git a/src/java/org/apache/lucene/search/IndexSearcher.java b/src/java/org/apache/lucene/search/IndexSearcher.java index fc1a3546504..c1c55c45093 100644 --- a/src/java/org/apache/lucene/search/IndexSearcher.java +++ b/src/java/org/apache/lucene/search/IndexSearcher.java @@ -50,8 +50,11 @@ import org.apache.lucene.util.ReaderUtil; public class IndexSearcher extends Searcher { IndexReader reader; private boolean closeReader; - private IndexReader[] subReaders; - private int[] docStarts; + + // NOTE: these members might change in incompatible ways + // in the next release + protected IndexReader[] subReaders; + protected int[] docStarts; /** Creates a searcher searching the index in the named directory. * @throws CorruptIndexException if the index is corrupt @@ -106,6 +109,19 @@ public class IndexSearcher extends Searcher { public IndexSearcher(IndexReader r) { this(r, false); } + + /** Expert: directly specify the reader, subReaders and + * their docID starts. + * + *

NOTE: This API is experimental and + * might change in incompatible ways in the next + * release.

*/ + public IndexSearcher(IndexReader reader, IndexReader[] subReaders, int[] docStarts) { + this.reader = reader; + this.subReaders = subReaders; + this.docStarts = docStarts; + closeReader = false; + } private IndexSearcher(IndexReader r, boolean closeReader) { reader = r;