From 4f553352d167cd97d1e271264aa0c2001b88108d Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Fri, 16 Sep 2011 10:23:38 +0000 Subject: [PATCH] LUCENE-3438: move FilteredTermsEnum, SingleTermsEnum to oal.index git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1171489 13f79535-47bb-0310-9956-ffa450edef68 --- .../queries/SlowCollatedTermRangeTermsEnum.java | 2 +- .../lucene/sandbox/queries/regex/RegexQuery.java | 2 +- .../lucene/sandbox/queries/regex/RegexTermsEnum.java | 2 +- .../org/apache/lucene/index/AutomatonTermsEnum.java | 1 - .../lucene/{search => index}/FilteredTermsEnum.java | 8 +------- .../lucene/{search => index}/SingleTermsEnum.java | 11 ++++++----- .../src/java/org/apache/lucene/search/FuzzyQuery.java | 5 +++-- .../java/org/apache/lucene/search/FuzzyTermsEnum.java | 1 + .../java/org/apache/lucene/search/MultiTermQuery.java | 2 ++ .../org/apache/lucene/search/NumericRangeQuery.java | 11 ++++++----- .../org/apache/lucene/search/PrefixTermsEnum.java | 1 + .../org/apache/lucene/search/TermRangeTermsEnum.java | 1 + .../lucene/util/automaton/CompiledAutomaton.java | 2 +- .../org/apache/lucene/search/TestAutomatonQuery.java | 1 + .../org/apache/lucene/search/TestPrefixRandom.java | 3 ++- .../org/apache/lucene/search/TestRegexpRandom2.java | 1 + 16 files changed, 29 insertions(+), 25 deletions(-) rename lucene/src/java/org/apache/lucene/{search => index}/FilteredTermsEnum.java (96%) rename lucene/src/java/org/apache/lucene/{search => index}/SingleTermsEnum.java (84%) diff --git a/lucene/contrib/sandbox/src/java/org/apache/lucene/sandbox/queries/SlowCollatedTermRangeTermsEnum.java b/lucene/contrib/sandbox/src/java/org/apache/lucene/sandbox/queries/SlowCollatedTermRangeTermsEnum.java index f299ff73290..56caec6c979 100644 --- a/lucene/contrib/sandbox/src/java/org/apache/lucene/sandbox/queries/SlowCollatedTermRangeTermsEnum.java +++ b/lucene/contrib/sandbox/src/java/org/apache/lucene/sandbox/queries/SlowCollatedTermRangeTermsEnum.java @@ -21,7 +21,7 @@ import java.io.IOException; import java.text.Collator; import org.apache.lucene.index.TermsEnum; -import org.apache.lucene.search.FilteredTermsEnum; +import org.apache.lucene.index.FilteredTermsEnum; import org.apache.lucene.util.BytesRef; /** diff --git a/lucene/contrib/sandbox/src/java/org/apache/lucene/sandbox/queries/regex/RegexQuery.java b/lucene/contrib/sandbox/src/java/org/apache/lucene/sandbox/queries/regex/RegexQuery.java index 47706941c84..aeb71d163a2 100644 --- a/lucene/contrib/sandbox/src/java/org/apache/lucene/sandbox/queries/regex/RegexQuery.java +++ b/lucene/contrib/sandbox/src/java/org/apache/lucene/sandbox/queries/regex/RegexQuery.java @@ -18,7 +18,7 @@ package org.apache.lucene.sandbox.queries.regex; */ import org.apache.lucene.search.MultiTermQuery; -import org.apache.lucene.search.FilteredTermsEnum; +import org.apache.lucene.index.FilteredTermsEnum; import org.apache.lucene.search.RegexpQuery; // javadoc import org.apache.lucene.index.Term; import org.apache.lucene.index.Terms; diff --git a/lucene/contrib/sandbox/src/java/org/apache/lucene/sandbox/queries/regex/RegexTermsEnum.java b/lucene/contrib/sandbox/src/java/org/apache/lucene/sandbox/queries/regex/RegexTermsEnum.java index e67f94d2269..870ccec0240 100644 --- a/lucene/contrib/sandbox/src/java/org/apache/lucene/sandbox/queries/regex/RegexTermsEnum.java +++ b/lucene/contrib/sandbox/src/java/org/apache/lucene/sandbox/queries/regex/RegexTermsEnum.java @@ -17,7 +17,7 @@ package org.apache.lucene.sandbox.queries.regex; * limitations under the License. */ -import org.apache.lucene.search.FilteredTermsEnum; +import org.apache.lucene.index.FilteredTermsEnum; import org.apache.lucene.index.Term; import org.apache.lucene.index.TermsEnum; import org.apache.lucene.util.BytesRef; diff --git a/lucene/src/java/org/apache/lucene/index/AutomatonTermsEnum.java b/lucene/src/java/org/apache/lucene/index/AutomatonTermsEnum.java index 9bd0554b539..a9d103dd7c8 100644 --- a/lucene/src/java/org/apache/lucene/index/AutomatonTermsEnum.java +++ b/lucene/src/java/org/apache/lucene/index/AutomatonTermsEnum.java @@ -20,7 +20,6 @@ package org.apache.lucene.index; import java.io.IOException; import java.util.Comparator; -import org.apache.lucene.search.FilteredTermsEnum; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.IntsRef; import org.apache.lucene.util.automaton.ByteRunAutomaton; diff --git a/lucene/src/java/org/apache/lucene/search/FilteredTermsEnum.java b/lucene/src/java/org/apache/lucene/index/FilteredTermsEnum.java similarity index 96% rename from lucene/src/java/org/apache/lucene/search/FilteredTermsEnum.java rename to lucene/src/java/org/apache/lucene/index/FilteredTermsEnum.java index 898e4a59ef6..3ef49cb8c84 100644 --- a/lucene/src/java/org/apache/lucene/search/FilteredTermsEnum.java +++ b/lucene/src/java/org/apache/lucene/index/FilteredTermsEnum.java @@ -1,4 +1,4 @@ -package org.apache.lucene.search; +package org.apache.lucene.index; /** * Licensed to the Apache Software Foundation (ASF) under one or more @@ -21,15 +21,9 @@ import java.io.IOException; import java.util.Comparator; import org.apache.lucene.util.BytesRef; -import org.apache.lucene.index.TermState; -import org.apache.lucene.index.TermsEnum; -import org.apache.lucene.index.DocsEnum; -import org.apache.lucene.index.DocsAndPositionsEnum; import org.apache.lucene.util.AttributeSource; import org.apache.lucene.util.Bits; -// TODO: move this class to oal.index - /** * Abstract class for enumerating a subset of all terms. * diff --git a/lucene/src/java/org/apache/lucene/search/SingleTermsEnum.java b/lucene/src/java/org/apache/lucene/index/SingleTermsEnum.java similarity index 84% rename from lucene/src/java/org/apache/lucene/search/SingleTermsEnum.java rename to lucene/src/java/org/apache/lucene/index/SingleTermsEnum.java index c890f504f2e..1c09c44beef 100644 --- a/lucene/src/java/org/apache/lucene/search/SingleTermsEnum.java +++ b/lucene/src/java/org/apache/lucene/index/SingleTermsEnum.java @@ -1,4 +1,4 @@ -package org.apache.lucene.search; +package org.apache.lucene.index; /** * Licensed to the Apache Software Foundation (ASF) under one or more @@ -19,15 +19,16 @@ package org.apache.lucene.search; import java.io.IOException; -import org.apache.lucene.index.TermsEnum; +import org.apache.lucene.search.MultiTermQuery; // javadocs import org.apache.lucene.util.BytesRef; /** * Subclass of FilteredTermsEnum for enumerating a single term. *

- * This can be used by {@link MultiTermQuery}s that need only visit one term, - * but want to preserve MultiTermQuery semantics such as - * {@link MultiTermQuery#rewriteMethod}. + * For example, this can be used by {@link MultiTermQuery}s + * that need only visit one term, but want to preserve + * MultiTermQuery semantics such as {@link + * MultiTermQuery#rewriteMethod}. */ public final class SingleTermsEnum extends FilteredTermsEnum { private final BytesRef singleRef; diff --git a/lucene/src/java/org/apache/lucene/search/FuzzyQuery.java b/lucene/src/java/org/apache/lucene/search/FuzzyQuery.java index fa9f077c8f3..c0a43333d8d 100644 --- a/lucene/src/java/org/apache/lucene/search/FuzzyQuery.java +++ b/lucene/src/java/org/apache/lucene/search/FuzzyQuery.java @@ -17,6 +17,9 @@ package org.apache.lucene.search; * limitations under the License. */ +import java.io.IOException; + +import org.apache.lucene.index.SingleTermsEnum; import org.apache.lucene.index.Term; import org.apache.lucene.index.Terms; import org.apache.lucene.index.TermsEnum; @@ -24,8 +27,6 @@ import org.apache.lucene.util.AttributeSource; import org.apache.lucene.util.ToStringUtils; import org.apache.lucene.util.automaton.LevenshteinAutomata; -import java.io.IOException; - /** Implements the fuzzy search query. The similarity measurement * is based on the Levenshtein (edit distance) algorithm. * diff --git a/lucene/src/java/org/apache/lucene/search/FuzzyTermsEnum.java b/lucene/src/java/org/apache/lucene/search/FuzzyTermsEnum.java index c84adb7534f..568b365cb3f 100644 --- a/lucene/src/java/org/apache/lucene/search/FuzzyTermsEnum.java +++ b/lucene/src/java/org/apache/lucene/search/FuzzyTermsEnum.java @@ -28,6 +28,7 @@ import org.apache.lucene.index.Term; import org.apache.lucene.index.TermState; import org.apache.lucene.index.Terms; import org.apache.lucene.index.TermsEnum; +import org.apache.lucene.index.FilteredTermsEnum; import org.apache.lucene.util.Attribute; import org.apache.lucene.util.AttributeImpl; import org.apache.lucene.util.AttributeSource; diff --git a/lucene/src/java/org/apache/lucene/search/MultiTermQuery.java b/lucene/src/java/org/apache/lucene/search/MultiTermQuery.java index aba17817184..da66af0ad13 100644 --- a/lucene/src/java/org/apache/lucene/search/MultiTermQuery.java +++ b/lucene/src/java/org/apache/lucene/search/MultiTermQuery.java @@ -19,7 +19,9 @@ package org.apache.lucene.search; import java.io.IOException; +import org.apache.lucene.index.FilteredTermsEnum; // javadocs import org.apache.lucene.index.IndexReader; +import org.apache.lucene.index.SingleTermsEnum; // javadocs import org.apache.lucene.index.Term; import org.apache.lucene.index.Terms; import org.apache.lucene.index.TermsEnum; diff --git a/lucene/src/java/org/apache/lucene/search/NumericRangeQuery.java b/lucene/src/java/org/apache/lucene/search/NumericRangeQuery.java index 1d0b6628972..b12bbb20b33 100644 --- a/lucene/src/java/org/apache/lucene/search/NumericRangeQuery.java +++ b/lucene/src/java/org/apache/lucene/search/NumericRangeQuery.java @@ -18,17 +18,18 @@ package org.apache.lucene.search; */ import java.io.IOException; -import java.util.LinkedList; import java.util.Comparator; +import java.util.LinkedList; import org.apache.lucene.analysis.NumericTokenStream; // for javadocs import org.apache.lucene.document.NumericField; // for javadocs -import org.apache.lucene.util.NumericUtils; -import org.apache.lucene.util.ToStringUtils; +import org.apache.lucene.index.FilteredTermsEnum; import org.apache.lucene.index.Terms; +import org.apache.lucene.index.TermsEnum; import org.apache.lucene.util.AttributeSource; import org.apache.lucene.util.BytesRef; -import org.apache.lucene.index.TermsEnum; +import org.apache.lucene.util.NumericUtils; +import org.apache.lucene.util.ToStringUtils; /** *

A {@link Query} that matches numeric values within a @@ -169,7 +170,7 @@ public final class NumericRangeQuery extends MultiTermQuery { // For bigger precisionSteps this query likely // hits too many terms, so set to CONSTANT_SCORE_FILTER right off - // (especially as the FilteredTermEnum is costly if wasted only for AUTO tests because it + // (especially as the FilteredTermsEnum is costly if wasted only for AUTO tests because it // creates new enums from IndexReader for each sub-range) switch (valSize) { case 64: diff --git a/lucene/src/java/org/apache/lucene/search/PrefixTermsEnum.java b/lucene/src/java/org/apache/lucene/search/PrefixTermsEnum.java index 23717be751d..b67028a7a09 100644 --- a/lucene/src/java/org/apache/lucene/search/PrefixTermsEnum.java +++ b/lucene/src/java/org/apache/lucene/search/PrefixTermsEnum.java @@ -19,6 +19,7 @@ package org.apache.lucene.search; import java.io.IOException; +import org.apache.lucene.index.FilteredTermsEnum; import org.apache.lucene.index.TermsEnum; import org.apache.lucene.util.BytesRef; diff --git a/lucene/src/java/org/apache/lucene/search/TermRangeTermsEnum.java b/lucene/src/java/org/apache/lucene/search/TermRangeTermsEnum.java index 5de82b9d8fa..ef4750b10e8 100644 --- a/lucene/src/java/org/apache/lucene/search/TermRangeTermsEnum.java +++ b/lucene/src/java/org/apache/lucene/search/TermRangeTermsEnum.java @@ -20,6 +20,7 @@ package org.apache.lucene.search; import java.io.IOException; import java.util.Comparator; +import org.apache.lucene.index.FilteredTermsEnum; import org.apache.lucene.index.TermsEnum; import org.apache.lucene.util.BytesRef; diff --git a/lucene/src/java/org/apache/lucene/util/automaton/CompiledAutomaton.java b/lucene/src/java/org/apache/lucene/util/automaton/CompiledAutomaton.java index 48b0e537459..092c6d34635 100644 --- a/lucene/src/java/org/apache/lucene/util/automaton/CompiledAutomaton.java +++ b/lucene/src/java/org/apache/lucene/util/automaton/CompiledAutomaton.java @@ -24,7 +24,7 @@ import java.util.List; import org.apache.lucene.index.Terms; import org.apache.lucene.index.TermsEnum; import org.apache.lucene.search.PrefixTermsEnum; -import org.apache.lucene.search.SingleTermsEnum; +import org.apache.lucene.index.SingleTermsEnum; import org.apache.lucene.util.BytesRef; /** diff --git a/lucene/src/test/org/apache/lucene/search/TestAutomatonQuery.java b/lucene/src/test/org/apache/lucene/search/TestAutomatonQuery.java index f38f6251573..2c104c3c85a 100644 --- a/lucene/src/test/org/apache/lucene/search/TestAutomatonQuery.java +++ b/lucene/src/test/org/apache/lucene/search/TestAutomatonQuery.java @@ -25,6 +25,7 @@ import org.apache.lucene.document.TextField; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.MultiFields; import org.apache.lucene.index.RandomIndexWriter; +import org.apache.lucene.index.SingleTermsEnum; import org.apache.lucene.index.Term; import org.apache.lucene.index.Terms; import org.apache.lucene.index.TermsEnum; diff --git a/lucene/src/test/org/apache/lucene/search/TestPrefixRandom.java b/lucene/src/test/org/apache/lucene/search/TestPrefixRandom.java index 35b1e151e30..000c13ac70a 100644 --- a/lucene/src/test/org/apache/lucene/search/TestPrefixRandom.java +++ b/lucene/src/test/org/apache/lucene/search/TestPrefixRandom.java @@ -24,11 +24,12 @@ import org.apache.lucene.analysis.MockTokenizer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.StringField; +import org.apache.lucene.index.FilteredTermsEnum; import org.apache.lucene.index.IndexReader; +import org.apache.lucene.index.RandomIndexWriter; import org.apache.lucene.index.Term; import org.apache.lucene.index.Terms; import org.apache.lucene.index.TermsEnum; -import org.apache.lucene.index.RandomIndexWriter; import org.apache.lucene.index.codecs.CodecProvider; import org.apache.lucene.store.Directory; import org.apache.lucene.util.AttributeSource; diff --git a/lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java b/lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java index e5ac627ddde..2f74d8da6e3 100644 --- a/lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java +++ b/lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java @@ -27,6 +27,7 @@ import org.apache.lucene.analysis.MockTokenizer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.StringField; +import org.apache.lucene.index.FilteredTermsEnum; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.RandomIndexWriter; import org.apache.lucene.index.Term;