mirror of https://github.com/apache/lucene.git
LUCENE-3789: Expose MTQ TermsEnum via RewriteMethod for non package private access
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1291187 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
83f02d630b
commit
cbf8d55ecb
|
@ -861,7 +861,7 @@ New Features
|
|||
|
||||
* LUCENE-3714: Add top N shortest cost paths search for FST<Long>.
|
||||
(Robert Muir, Dawid Weiss, Mike McCandless)
|
||||
|
||||
|
||||
Bug fixes
|
||||
|
||||
* LUCENE-3595: Fixed FieldCacheRangeFilter and FieldCacheTermsFilter
|
||||
|
@ -1109,6 +1109,9 @@ New Features
|
|||
* LUCENE-3558: Moved SearcherManager, NRTManager & SearcherLifetimeManager into
|
||||
core. All classes are contained in o.a.l.search. (Simon Willnauer)
|
||||
|
||||
* LUCENE-3789: Expose MTQ TermsEnum via RewriteMethod for non package private
|
||||
access (Simon Willnauer)
|
||||
|
||||
Optimizations
|
||||
|
||||
* LUCENE-3426: Add NGramPhraseQuery which extends PhraseQuery and tries to
|
||||
|
|
|
@ -68,6 +68,13 @@ public abstract class MultiTermQuery extends Query {
|
|||
/** Abstract class that defines how the query is rewritten. */
|
||||
public static abstract class RewriteMethod {
|
||||
public abstract Query rewrite(IndexReader reader, MultiTermQuery query) throws IOException;
|
||||
/**
|
||||
* Returns the {@link MultiTermQuery}s {@link TermsEnum}
|
||||
* @see MultiTermQuery#getTermsEnum(Terms, AttributeSource);
|
||||
*/
|
||||
protected TermsEnum getTermsEnum(MultiTermQuery query, Terms terms, AttributeSource atts) throws IOException {
|
||||
return query.getTermsEnum(terms, atts); // allow RewriteMethod subclasses to pull a TermsEnum from the MTQ
|
||||
}
|
||||
}
|
||||
|
||||
/** A rewrite method that first creates a private Filter,
|
||||
|
|
|
@ -62,7 +62,7 @@ abstract class TermCollectingRewrite<Q extends Query> extends MultiTermQuery.Rew
|
|||
continue;
|
||||
}
|
||||
|
||||
final TermsEnum termsEnum = query.getTermsEnum(terms, collector.attributes);
|
||||
final TermsEnum termsEnum = getTermsEnum(query, terms, collector.attributes);
|
||||
assert termsEnum != null;
|
||||
|
||||
if (termsEnum == TermsEnum.EMPTY)
|
||||
|
|
Loading…
Reference in New Issue