From 360452940ec060e389dbf990996f3f44200281e0 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Tue, 16 Jul 2013 17:44:10 +0000 Subject: [PATCH] LUCENE-5114: remove unused useCache param git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1503805 13f79535-47bb-0310-9956-ffa450edef68 --- lucene/CHANGES.txt | 3 ++ .../codecs/blockterms/BlockTermsReader.java | 35 ++----------------- .../bloom/BloomFilteringPostingsFormat.java | 8 ++--- .../codecs/memory/DirectPostingsFormat.java | 6 ++-- .../codecs/memory/MemoryPostingsFormat.java | 4 +-- .../simpletext/SimpleTextFieldsReader.java | 4 +-- .../SimpleTextTermVectorsReader.java | 2 +- .../lucene/codecs/BlockTreeTermsReader.java | 10 +++--- .../CompressingTermVectorsReader.java | 2 +- .../lucene40/Lucene40TermVectorsReader.java | 2 +- .../lucene42/Lucene42DocValuesProducer.java | 4 +-- .../org/apache/lucene/index/AtomicReader.java | 8 ++--- .../lucene/index/BufferedDeletesStream.java | 2 +- .../org/apache/lucene/index/CheckIndex.java | 4 +-- .../org/apache/lucene/index/DocTermOrds.java | 4 +-- .../lucene/index/FilterAtomicReader.java | 4 +-- .../lucene/index/FilteredTermsEnum.java | 6 ++-- .../org/apache/lucene/index/MultiFields.java | 4 +-- .../apache/lucene/index/MultiTermsEnum.java | 12 +++---- .../index/SortedDocValuesTermsEnum.java | 4 +-- .../index/SortedSetDocValuesTermsEnum.java | 4 +-- .../org/apache/lucene/index/TermContext.java | 4 +-- .../org/apache/lucene/index/TermsEnum.java | 19 ++++------ .../apache/lucene/search/FuzzyTermsEnum.java | 8 ++--- .../lucene/search/MultiPhraseQuery.java | 2 +- .../org/apache/lucene/search/PhraseQuery.java | 5 ++- .../org/apache/lucene/search/TermQuery.java | 2 +- .../search/payloads/PayloadSpanUtil.java | 2 +- .../lucene/search/spans/SpanTermQuery.java | 2 +- .../lucene/search/spans/SpanWeight.java | 2 +- .../codecs/lucene40/TestReuseDocsEnum.java | 2 +- .../lucene41/TestBlockPostingsFormat3.java | 12 +++---- .../apache/lucene/index/TestDocTermOrds.java | 10 +++--- .../lucene/index/TestDocsAndPositions.java | 6 ++-- .../lucene/index/TestPayloadsOnVectors.java | 4 +-- .../lucene/index/TestPerSegmentDeletes.java | 2 +- .../lucene/index/TestPostingsOffsets.java | 2 +- .../lucene/index/TestStressIndexing2.java | 2 +- .../apache/lucene/index/TestTermsEnum.java | 10 +++--- .../apache/lucene/index/TestTermsEnum2.java | 8 ++--- .../lucene/search/TestMinShouldMatch2.java | 2 +- .../search/spans/MultiSpansWrapper.java | 2 +- .../org/apache/lucene/util/fst/TestFSTs.java | 9 ++--- .../facet/search/DrillSidewaysQuery.java | 2 +- .../directory/DirectoryTaxonomyWriter.java | 2 +- .../util/FacetsPayloadMigrationReader.java | 2 +- .../term/TermGroupFacetCollector.java | 6 ++-- .../highlight/WeightedSpanTermExtractor.java | 2 +- .../PostingsHighlighter.java | 2 +- .../search/join/TermsIncludingScoreQuery.java | 6 ++-- .../lucene/search/join/TestJoinUtil.java | 2 +- .../lucene/index/memory/MemoryIndex.java | 4 +-- .../lucene/index/memory/MemoryIndexTest.java | 4 +-- .../lucene/queries/CommonTermsQuery.java | 2 +- .../apache/lucene/queries/TermsFilter.java | 2 +- .../valuesource/JoinDocFreqValueSource.java | 2 +- .../function/valuesource/TFValueSource.java | 2 +- .../valuesource/TermFreqValueSource.java | 2 +- .../AbstractVisitingPrefixTreeFilter.java | 4 +-- .../prefix/ContainsPrefixTreeFilter.java | 2 +- .../lucene/search/spell/SpellChecker.java | 2 +- .../codecs/lucene41ords/Lucene41WithOrds.java | 3 -- .../MockFixedIntBlockPostingsFormat.java | 1 - .../MockVariableIntBlockPostingsFormat.java | 1 - .../mockrandom/MockRandomPostingsFormat.java | 3 -- .../codecs/mocksep/MockSepPostingsFormat.java | 1 - .../codecs/ramonly/RAMOnlyPostingsFormat.java | 2 +- .../lucene/index/AssertingAtomicReader.java | 8 ++--- .../index/BaseDocValuesFormatTestCase.java | 16 ++++----- .../index/BasePostingsFormatTestCase.java | 2 +- .../index/BaseTermVectorsFormatTestCase.java | 4 +-- .../lucene/search/ShardSearchingTestBase.java | 2 +- .../apache/lucene/util/LuceneTestCase.java | 7 ++-- .../org/apache/lucene/util/_TestUtil.java | 2 +- .../component/QueryElevationComponent.java | 2 +- .../handler/component/TermsComponent.java | 2 +- .../org/apache/solr/request/SimpleFacets.java | 2 +- .../apache/solr/request/UnInvertedField.java | 4 +-- .../apache/solr/search/JoinQParserPlugin.java | 2 +- .../apache/solr/search/SolrIndexSearcher.java | 4 +-- .../solr/search/function/FileFloatSource.java | 2 +- .../org/apache/solr/request/TestFaceting.java | 2 +- .../org/apache/solr/search/TestRTGBase.java | 2 +- 83 files changed, 162 insertions(+), 211 deletions(-) diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index 96087b08dce..9800fa8d38c 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -62,6 +62,9 @@ API Changes * LUCENE-5094: Add ramBytesUsed() to MultiDocValues.OrdinalMap. (Robert Muir) +* LUCENE-5114: Remove unused boolean useCache parameter from + TermsEnum.seekCeil and .seekExact (Mike McCandless) + ======================= Lucene 4.4.0 ======================= Changes in backwards compatibility policy diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/BlockTermsReader.java b/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/BlockTermsReader.java index 2d1fb8f39e5..eb13fe907ac 100644 --- a/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/BlockTermsReader.java +++ b/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/BlockTermsReader.java @@ -69,9 +69,6 @@ public class BlockTermsReader extends FieldsProducer { private final TreeMap fields = new TreeMap(); - // Caches the most recently looked-up field + terms: - private final DoubleBarrelLRUCache termsCache; - // Reads the terms index private TermsIndexReaderBase indexReader; @@ -113,11 +110,10 @@ public class BlockTermsReader extends FieldsProducer { // private String segment; public BlockTermsReader(TermsIndexReaderBase indexReader, Directory dir, FieldInfos fieldInfos, SegmentInfo info, PostingsReaderBase postingsReader, IOContext context, - int termsCacheSize, String segmentSuffix) + String segmentSuffix) throws IOException { this.postingsReader = postingsReader; - termsCache = new DoubleBarrelLRUCache(termsCacheSize); // this.segment = segment; in = dir.openInput(IndexFileNames.segmentFileName(info.name, segmentSuffix, BlockTermsWriter.TERMS_EXTENSION), @@ -362,13 +358,13 @@ public class BlockTermsReader extends FieldsProducer { // return NOT_FOUND so it's a waste for us to fill in // the term that was actually NOT_FOUND @Override - public SeekStatus seekCeil(final BytesRef target, final boolean useCache) throws IOException { + public SeekStatus seekCeil(final BytesRef target) throws IOException { if (indexEnum == null) { throw new IllegalStateException("terms index was not loaded"); } - //System.out.println("BTR.seek seg=" + segment + " target=" + fieldInfo.name + ":" + target.utf8ToString() + " " + target + " current=" + term().utf8ToString() + " " + term() + " useCache=" + useCache + " indexIsCurrent=" + indexIsCurrent + " didIndexNext=" + didIndexNext + " seekPending=" + seekPending + " divisor=" + indexReader.getDivisor() + " this=" + this); + //System.out.println("BTR.seek seg=" + segment + " target=" + fieldInfo.name + ":" + target.utf8ToString() + " " + target + " current=" + term().utf8ToString() + " " + term() + " indexIsCurrent=" + indexIsCurrent + " didIndexNext=" + didIndexNext + " seekPending=" + seekPending + " divisor=" + indexReader.getDivisor() + " this=" + this); if (didIndexNext) { if (nextIndexTerm == null) { //System.out.println(" nextIndexTerm=null"); @@ -377,23 +373,6 @@ public class BlockTermsReader extends FieldsProducer { } } - // Check cache - if (useCache) { - fieldTerm.term = target; - // TODO: should we differentiate "frozen" - // TermState (ie one that was cloned and - // cached/returned by termState()) from the - // malleable (primary) one? - final TermState cachedState = termsCache.get(fieldTerm); - if (cachedState != null) { - seekPending = true; - //System.out.println(" cached!"); - seekExact(target, cachedState); - //System.out.println(" term=" + term.utf8ToString()); - return SeekStatus.FOUND; - } - } - boolean doSeek = true; // See if we can avoid seeking, because target term @@ -574,14 +553,6 @@ public class BlockTermsReader extends FieldsProducer { // Done! Exact match. Stop here, fill in // real term, return FOUND. //System.out.println(" FOUND"); - - if (useCache) { - // Store in cache - decodeMetaData(); - //System.out.println(" cache! state=" + state); - termsCache.put(new FieldAndTerm(fieldTerm), (BlockTermState) state.clone()); - } - return SeekStatus.FOUND; } else { //System.out.println(" NOT_FOUND"); diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/bloom/BloomFilteringPostingsFormat.java b/lucene/codecs/src/java/org/apache/lucene/codecs/bloom/BloomFilteringPostingsFormat.java index 2ff143e6327..982b72ab427 100644 --- a/lucene/codecs/src/java/org/apache/lucene/codecs/bloom/BloomFilteringPostingsFormat.java +++ b/lucene/codecs/src/java/org/apache/lucene/codecs/bloom/BloomFilteringPostingsFormat.java @@ -331,7 +331,7 @@ public final class BloomFilteringPostingsFormat extends PostingsFormat { } @Override - public final boolean seekExact(BytesRef text, boolean useCache) + public final boolean seekExact(BytesRef text) throws IOException { // The magical fail-fast speed up that is the entire point of all of // this code - save a disk seek if there is a match on an in-memory @@ -341,13 +341,13 @@ public final class BloomFilteringPostingsFormat extends PostingsFormat { if (filter.contains(text) == ContainsResult.NO) { return false; } - return delegate().seekExact(text, useCache); + return delegate().seekExact(text); } @Override - public final SeekStatus seekCeil(BytesRef text, boolean useCache) + public final SeekStatus seekCeil(BytesRef text) throws IOException { - return delegate().seekCeil(text, useCache); + return delegate().seekCeil(text); } @Override diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java index 0594c88ce45..b19b15151ab 100644 --- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java +++ b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java @@ -684,7 +684,7 @@ public final class DirectPostingsFormat extends PostingsFormat { } @Override - public SeekStatus seekCeil(BytesRef term, boolean useCache) { + public SeekStatus seekCeil(BytesRef term) { // TODO: we should use the skip pointers; should be // faster than bin search; we should also hold // & reuse current state so seeking forwards is @@ -707,7 +707,7 @@ public final class DirectPostingsFormat extends PostingsFormat { } @Override - public boolean seekExact(BytesRef term, boolean useCache) { + public boolean seekExact(BytesRef term) { // TODO: we should use the skip pointers; should be // faster than bin search; we should also hold // & reuse current state so seeking forwards is @@ -1413,7 +1413,7 @@ public final class DirectPostingsFormat extends PostingsFormat { } @Override - public SeekStatus seekCeil(BytesRef term, boolean useCache) { + public SeekStatus seekCeil(BytesRef term) { throw new UnsupportedOperationException(); } diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryPostingsFormat.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryPostingsFormat.java index e16b7c869f8..67a0d9204d1 100644 --- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryPostingsFormat.java +++ b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryPostingsFormat.java @@ -654,7 +654,7 @@ public final class MemoryPostingsFormat extends PostingsFormat { } @Override - public boolean seekExact(BytesRef text, boolean useCache /* ignored */) throws IOException { + public boolean seekExact(BytesRef text) throws IOException { //System.out.println("te.seekExact text=" + field.name + ":" + text.utf8ToString() + " this=" + this); current = fstEnum.seekExact(text); didDecode = false; @@ -662,7 +662,7 @@ public final class MemoryPostingsFormat extends PostingsFormat { } @Override - public SeekStatus seekCeil(BytesRef text, boolean useCache /* ignored */) throws IOException { + public SeekStatus seekCeil(BytesRef text) throws IOException { //System.out.println("te.seek text=" + field.name + ":" + text.utf8ToString() + " this=" + this); current = fstEnum.seekCeil(text); if (current == null) { diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldsReader.java b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldsReader.java index d576d3ce1ef..74b1d79b046 100644 --- a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldsReader.java +++ b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldsReader.java @@ -109,7 +109,7 @@ class SimpleTextFieldsReader extends FieldsProducer { } @Override - public boolean seekExact(BytesRef text, boolean useCache /* ignored */) throws IOException { + public boolean seekExact(BytesRef text) throws IOException { final BytesRefFSTEnum.InputOutput>> result = fstEnum.seekExact(text); if (result != null) { @@ -125,7 +125,7 @@ class SimpleTextFieldsReader extends FieldsProducer { } @Override - public SeekStatus seekCeil(BytesRef text, boolean useCache /* ignored */) throws IOException { + public SeekStatus seekCeil(BytesRef text) throws IOException { //System.out.println("seek to text=" + text.utf8ToString()); final BytesRefFSTEnum.InputOutput>> result = fstEnum.seekCeil(text); diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextTermVectorsReader.java b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextTermVectorsReader.java index 2fe6419b29f..2c33a0f9a3e 100644 --- a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextTermVectorsReader.java +++ b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextTermVectorsReader.java @@ -331,7 +331,7 @@ public class SimpleTextTermVectorsReader extends TermVectorsReader { } @Override - public SeekStatus seekCeil(BytesRef text, boolean useCache) throws IOException { + public SeekStatus seekCeil(BytesRef text) throws IOException { iterator = terms.tailMap(text).entrySet().iterator(); if (!iterator.hasNext()) { return SeekStatus.END; diff --git a/lucene/core/src/java/org/apache/lucene/codecs/BlockTreeTermsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/BlockTreeTermsReader.java index 32324bb0890..9545d57c108 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/BlockTreeTermsReader.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/BlockTreeTermsReader.java @@ -1222,7 +1222,7 @@ public class BlockTreeTermsReader extends FieldsProducer { } @Override - public boolean seekExact(BytesRef text, boolean useCache) { + public boolean seekExact(BytesRef text) { throw new UnsupportedOperationException(); } @@ -1237,7 +1237,7 @@ public class BlockTreeTermsReader extends FieldsProducer { } @Override - public SeekStatus seekCeil(BytesRef text, boolean useCache) { + public SeekStatus seekCeil(BytesRef text) { throw new UnsupportedOperationException(); } } @@ -1499,7 +1499,7 @@ public class BlockTreeTermsReader extends FieldsProducer { } @Override - public boolean seekExact(final BytesRef target, final boolean useCache) throws IOException { + public boolean seekExact(final BytesRef target) throws IOException { if (index == null) { throw new IllegalStateException("terms index was not loaded"); @@ -1760,7 +1760,7 @@ public class BlockTreeTermsReader extends FieldsProducer { } @Override - public SeekStatus seekCeil(final BytesRef target, final boolean useCache) throws IOException { + public SeekStatus seekCeil(final BytesRef target) throws IOException { if (index == null) { throw new IllegalStateException("terms index was not loaded"); } @@ -2096,7 +2096,7 @@ public class BlockTreeTermsReader extends FieldsProducer { // this method catches up all internal state so next() // works properly: //if (DEBUG) System.out.println(" re-seek to pending term=" + term.utf8ToString() + " " + term); - final boolean result = seekExact(term, false); + final boolean result = seekExact(term); assert result; } diff --git a/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingTermVectorsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingTermVectorsReader.java index 48c8d5c8435..22706a2fd5b 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingTermVectorsReader.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingTermVectorsReader.java @@ -824,7 +824,7 @@ public final class CompressingTermVectorsReader extends TermVectorsReader implem } @Override - public SeekStatus seekCeil(BytesRef text, boolean useCache) + public SeekStatus seekCeil(BytesRef text) throws IOException { if (ord < numTerms && ord >= 0) { final int cmp = term().compareTo(text); diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40TermVectorsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40TermVectorsReader.java index 5faa1436bdb..11f6b3df6dd 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40TermVectorsReader.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40TermVectorsReader.java @@ -433,7 +433,7 @@ public class Lucene40TermVectorsReader extends TermVectorsReader implements Clos // NOTE: slow! (linear scan) @Override - public SeekStatus seekCeil(BytesRef text, boolean useCache) + public SeekStatus seekCeil(BytesRef text) throws IOException { if (nextTerm != 0) { final int cmp = text.compareTo(term); diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene42/Lucene42DocValuesProducer.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene42/Lucene42DocValuesProducer.java index c5ac3f11ee8..16ecf187b93 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/lucene42/Lucene42DocValuesProducer.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene42/Lucene42DocValuesProducer.java @@ -490,7 +490,7 @@ class Lucene42DocValuesProducer extends DocValuesProducer { } @Override - public SeekStatus seekCeil(BytesRef text, boolean useCache) throws IOException { + public SeekStatus seekCeil(BytesRef text) throws IOException { if (in.seekCeil(text) == null) { return SeekStatus.END; } else if (term().equals(text)) { @@ -503,7 +503,7 @@ class Lucene42DocValuesProducer extends DocValuesProducer { } @Override - public boolean seekExact(BytesRef text, boolean useCache) throws IOException { + public boolean seekExact(BytesRef text) throws IOException { if (in.seekExact(text) == null) { return false; } else { diff --git a/lucene/core/src/java/org/apache/lucene/index/AtomicReader.java b/lucene/core/src/java/org/apache/lucene/index/AtomicReader.java index f671a5b4cfd..1b0e4168969 100644 --- a/lucene/core/src/java/org/apache/lucene/index/AtomicReader.java +++ b/lucene/core/src/java/org/apache/lucene/index/AtomicReader.java @@ -78,7 +78,7 @@ public abstract class AtomicReader extends IndexReader { return 0; } final TermsEnum termsEnum = terms.iterator(null); - if (termsEnum.seekExact(term.bytes(), true)) { + if (termsEnum.seekExact(term.bytes())) { return termsEnum.docFreq(); } else { return 0; @@ -101,7 +101,7 @@ public abstract class AtomicReader extends IndexReader { return 0; } final TermsEnum termsEnum = terms.iterator(null); - if (termsEnum.seekExact(term.bytes(), true)) { + if (termsEnum.seekExact(term.bytes())) { return termsEnum.totalTermFreq(); } else { return 0; @@ -156,7 +156,7 @@ public abstract class AtomicReader extends IndexReader { final Terms terms = fields.terms(term.field()); if (terms != null) { final TermsEnum termsEnum = terms.iterator(null); - if (termsEnum.seekExact(term.bytes(), true)) { + if (termsEnum.seekExact(term.bytes())) { return termsEnum.docs(getLiveDocs(), null); } } @@ -176,7 +176,7 @@ public abstract class AtomicReader extends IndexReader { final Terms terms = fields.terms(term.field()); if (terms != null) { final TermsEnum termsEnum = terms.iterator(null); - if (termsEnum.seekExact(term.bytes(), true)) { + if (termsEnum.seekExact(term.bytes())) { return termsEnum.docsAndPositions(getLiveDocs(), null); } } diff --git a/lucene/core/src/java/org/apache/lucene/index/BufferedDeletesStream.java b/lucene/core/src/java/org/apache/lucene/index/BufferedDeletesStream.java index 5ef2b9ce79b..247626ee9fb 100644 --- a/lucene/core/src/java/org/apache/lucene/index/BufferedDeletesStream.java +++ b/lucene/core/src/java/org/apache/lucene/index/BufferedDeletesStream.java @@ -390,7 +390,7 @@ class BufferedDeletesStream { // System.out.println(" term=" + term); - if (termsEnum.seekExact(term.bytes(), false)) { + if (termsEnum.seekExact(term.bytes())) { // we don't need term frequencies for this DocsEnum docsEnum = termsEnum.docs(rld.getLiveDocs(), docs, DocsEnum.FLAG_NONE); //System.out.println("BDS: got docsEnum=" + docsEnum); diff --git a/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java b/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java index 142a67cbbb2..a4881a9600b 100644 --- a/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java +++ b/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java @@ -1117,7 +1117,7 @@ public class CheckIndex { long totDocCountNoDeletes = 0; long totDocFreq = 0; for(int i=0;i= 0) { currentOrd = ord; @@ -61,7 +61,7 @@ class SortedDocValuesTermsEnum extends TermsEnum { } @Override - public boolean seekExact(BytesRef text, boolean useCache) throws IOException { + public boolean seekExact(BytesRef text) throws IOException { int ord = values.lookupTerm(text); if (ord >= 0) { term.offset = 0; diff --git a/lucene/core/src/java/org/apache/lucene/index/SortedSetDocValuesTermsEnum.java b/lucene/core/src/java/org/apache/lucene/index/SortedSetDocValuesTermsEnum.java index a9ceac950bb..3c04135205f 100644 --- a/lucene/core/src/java/org/apache/lucene/index/SortedSetDocValuesTermsEnum.java +++ b/lucene/core/src/java/org/apache/lucene/index/SortedSetDocValuesTermsEnum.java @@ -37,7 +37,7 @@ class SortedSetDocValuesTermsEnum extends TermsEnum { } @Override - public SeekStatus seekCeil(BytesRef text, boolean useCache /* ignored */) throws IOException { + public SeekStatus seekCeil(BytesRef text) throws IOException { long ord = values.lookupTerm(text); if (ord >= 0) { currentOrd = ord; @@ -61,7 +61,7 @@ class SortedSetDocValuesTermsEnum extends TermsEnum { } @Override - public boolean seekExact(BytesRef text, boolean useCache) throws IOException { + public boolean seekExact(BytesRef text) throws IOException { long ord = values.lookupTerm(text); if (ord >= 0) { term.offset = 0; diff --git a/lucene/core/src/java/org/apache/lucene/index/TermContext.java b/lucene/core/src/java/org/apache/lucene/index/TermContext.java index ec7ef8fc8fa..ac80a944568 100644 --- a/lucene/core/src/java/org/apache/lucene/index/TermContext.java +++ b/lucene/core/src/java/org/apache/lucene/index/TermContext.java @@ -78,7 +78,7 @@ public final class TermContext { *

* Note: the given context must be a top-level context. */ - public static TermContext build(IndexReaderContext context, Term term, boolean cache) + public static TermContext build(IndexReaderContext context, Term term) throws IOException { assert context != null && context.isTopLevel; final String field = term.field(); @@ -92,7 +92,7 @@ public final class TermContext { final Terms terms = fields.terms(field); if (terms != null) { final TermsEnum termsEnum = terms.iterator(null); - if (termsEnum.seekExact(bytes, cache)) { + if (termsEnum.seekExact(bytes)) { final TermState termState = termsEnum.termState(); //if (DEBUG) System.out.println(" found"); perReaderTermState.register(termState, ctx.ord, termsEnum.docFreq(), termsEnum.totalTermFreq()); diff --git a/lucene/core/src/java/org/apache/lucene/index/TermsEnum.java b/lucene/core/src/java/org/apache/lucene/index/TermsEnum.java index 3814bc64c0b..b54c19ef9e4 100644 --- a/lucene/core/src/java/org/apache/lucene/index/TermsEnum.java +++ b/lucene/core/src/java/org/apache/lucene/index/TermsEnum.java @@ -26,7 +26,7 @@ import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRefIterator; /** Iterator to seek ({@link #seekCeil(BytesRef)}, {@link - * #seekExact(BytesRef,boolean)}) or step through ({@link + * #seekExact(BytesRef)}) or step through ({@link * #next} terms to obtain frequency information ({@link * #docFreq}), {@link DocsEnum} or {@link * DocsAndPositionsEnum} for the current term ({@link @@ -70,24 +70,17 @@ public abstract class TermsEnum implements BytesRefIterator { * true if the term is found. If this returns false, the * enum is unpositioned. For some codecs, seekExact may * be substantially faster than {@link #seekCeil}. */ - public boolean seekExact(BytesRef text, boolean useCache) throws IOException { - return seekCeil(text, useCache) == SeekStatus.FOUND; + public boolean seekExact(BytesRef text) throws IOException { + return seekCeil(text) == SeekStatus.FOUND; } - /** Expert: just like {@link #seekCeil(BytesRef)} but allows - * you to control whether the implementation should - * attempt to use its term cache (if it uses one). */ - public abstract SeekStatus seekCeil(BytesRef text, boolean useCache) throws IOException; - /** Seeks to the specified term, if it exists, or to the * next (ceiling) term. Returns SeekStatus to * indicate whether exact term was found, a different * term was found, or EOF was hit. The target term may * be before or after the current term. If this returns * SeekStatus.END, the enum is unpositioned. */ - public final SeekStatus seekCeil(BytesRef text) throws IOException { - return seekCeil(text, true); - } + public abstract SeekStatus seekCeil(BytesRef text) throws IOException; /** Seeks to the specified term by ordinal (position) as * previously returned by {@link #ord}. The target ord @@ -117,7 +110,7 @@ public abstract class TermsEnum implements BytesRefIterator { * @param state the {@link TermState} * */ public void seekExact(BytesRef term, TermState state) throws IOException { - if (!seekExact(term, true)) { + if (!seekExact(term)) { throw new IllegalArgumentException("term=" + term + " does not exist"); } } @@ -226,7 +219,7 @@ public abstract class TermsEnum implements BytesRefIterator { */ public static final TermsEnum EMPTY = new TermsEnum() { @Override - public SeekStatus seekCeil(BytesRef term, boolean useCache) { return SeekStatus.END; } + public SeekStatus seekCeil(BytesRef term) { return SeekStatus.END; } @Override public void seekExact(long ord) {} diff --git a/lucene/core/src/java/org/apache/lucene/search/FuzzyTermsEnum.java b/lucene/core/src/java/org/apache/lucene/search/FuzzyTermsEnum.java index 6d58749fa4c..85698fed538 100644 --- a/lucene/core/src/java/org/apache/lucene/search/FuzzyTermsEnum.java +++ b/lucene/core/src/java/org/apache/lucene/search/FuzzyTermsEnum.java @@ -303,13 +303,13 @@ public class FuzzyTermsEnum extends TermsEnum { } @Override - public boolean seekExact(BytesRef text, boolean useCache) throws IOException { - return actualEnum.seekExact(text, useCache); + public boolean seekExact(BytesRef text) throws IOException { + return actualEnum.seekExact(text); } @Override - public SeekStatus seekCeil(BytesRef text, boolean useCache) throws IOException { - return actualEnum.seekCeil(text, useCache); + public SeekStatus seekCeil(BytesRef text) throws IOException { + return actualEnum.seekCeil(text); } @Override diff --git a/lucene/core/src/java/org/apache/lucene/search/MultiPhraseQuery.java b/lucene/core/src/java/org/apache/lucene/search/MultiPhraseQuery.java index 92837ecc7bf..c46ec482e9d 100644 --- a/lucene/core/src/java/org/apache/lucene/search/MultiPhraseQuery.java +++ b/lucene/core/src/java/org/apache/lucene/search/MultiPhraseQuery.java @@ -149,7 +149,7 @@ public class MultiPhraseQuery extends Query { for (Term term: terms) { TermContext termContext = termContexts.get(term); if (termContext == null) { - termContext = TermContext.build(context, term, true); + termContext = TermContext.build(context, term); termContexts.put(term, termContext); } allTermStats.add(searcher.termStatistics(term, termContext)); diff --git a/lucene/core/src/java/org/apache/lucene/search/PhraseQuery.java b/lucene/core/src/java/org/apache/lucene/search/PhraseQuery.java index b48a1dce28b..6a32d51578f 100644 --- a/lucene/core/src/java/org/apache/lucene/search/PhraseQuery.java +++ b/lucene/core/src/java/org/apache/lucene/search/PhraseQuery.java @@ -37,7 +37,6 @@ import org.apache.lucene.search.similarities.Similarity.SimScorer; import org.apache.lucene.search.similarities.Similarity; import org.apache.lucene.util.ArrayUtil; import org.apache.lucene.util.Bits; -import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.ToStringUtils; /** A Query that matches documents containing a particular sequence of terms. @@ -218,7 +217,7 @@ public class PhraseQuery extends Query { TermStatistics termStats[] = new TermStatistics[terms.size()]; for (int i = 0; i < terms.size(); i++) { final Term term = terms.get(i); - states[i] = TermContext.build(context, term, true); + states[i] = TermContext.build(context, term); termStats[i] = searcher.termStatistics(term, states[i]); } stats = similarity.computeWeight(getBoost(), searcher.collectionStatistics(field), termStats); @@ -269,7 +268,7 @@ public class PhraseQuery extends Query { // PhraseQuery on a field that did not index // positions. if (postingsEnum == null) { - assert te.seekExact(t.bytes(), false) : "termstate found but no term exists in reader"; + assert te.seekExact(t.bytes()) : "termstate found but no term exists in reader"; // term does exist, but has no positions throw new IllegalStateException("field \"" + t.field() + "\" was indexed without position data; cannot run PhraseQuery (term=" + t.text() + ")"); } diff --git a/lucene/core/src/java/org/apache/lucene/search/TermQuery.java b/lucene/core/src/java/org/apache/lucene/search/TermQuery.java index 099e90b5981..b6a1f237225 100644 --- a/lucene/core/src/java/org/apache/lucene/search/TermQuery.java +++ b/lucene/core/src/java/org/apache/lucene/search/TermQuery.java @@ -163,7 +163,7 @@ public class TermQuery extends Query { final TermContext termState; if (perReaderTermState == null || perReaderTermState.topReaderContext != context) { // make TermQuery single-pass if we don't have a PRTS or if the context differs! - termState = TermContext.build(context, term, true); // cache term lookups! + termState = TermContext.build(context, term); } else { // PRTS was pre-build for this IS termState = this.perReaderTermState; diff --git a/lucene/core/src/java/org/apache/lucene/search/payloads/PayloadSpanUtil.java b/lucene/core/src/java/org/apache/lucene/search/payloads/PayloadSpanUtil.java index 3ae6ffdc062..a3075983b7d 100644 --- a/lucene/core/src/java/org/apache/lucene/search/payloads/PayloadSpanUtil.java +++ b/lucene/core/src/java/org/apache/lucene/search/payloads/PayloadSpanUtil.java @@ -182,7 +182,7 @@ public class PayloadSpanUtil { TreeSet terms = new TreeSet(); query.extractTerms(terms); for (Term term : terms) { - termContexts.put(term, TermContext.build(context, term, true)); + termContexts.put(term, TermContext.build(context, term)); } for (AtomicReaderContext atomicReaderContext : context.leaves()) { final Spans spans = query.getSpans(atomicReaderContext, atomicReaderContext.reader().getLiveDocs(), termContexts); diff --git a/lucene/core/src/java/org/apache/lucene/search/spans/SpanTermQuery.java b/lucene/core/src/java/org/apache/lucene/search/spans/SpanTermQuery.java index 7fcbfa0135d..f0a27c4ee90 100644 --- a/lucene/core/src/java/org/apache/lucene/search/spans/SpanTermQuery.java +++ b/lucene/core/src/java/org/apache/lucene/search/spans/SpanTermQuery.java @@ -98,7 +98,7 @@ public class SpanTermQuery extends SpanQuery { final Terms terms = fields.terms(term.field()); if (terms != null) { final TermsEnum termsEnum = terms.iterator(null); - if (termsEnum.seekExact(term.bytes(), true)) { + if (termsEnum.seekExact(term.bytes())) { state = termsEnum.termState(); } else { state = null; diff --git a/lucene/core/src/java/org/apache/lucene/search/spans/SpanWeight.java b/lucene/core/src/java/org/apache/lucene/search/spans/SpanWeight.java index 8e428f1671f..fb7372150dc 100644 --- a/lucene/core/src/java/org/apache/lucene/search/spans/SpanWeight.java +++ b/lucene/core/src/java/org/apache/lucene/search/spans/SpanWeight.java @@ -52,7 +52,7 @@ public class SpanWeight extends Weight { final TermStatistics termStats[] = new TermStatistics[terms.size()]; int i = 0; for (Term term : terms) { - TermContext state = TermContext.build(context, term, true); + TermContext state = TermContext.build(context, term); termStats[i] = searcher.termStatistics(term, state); termContexts.put(term, state); i++; diff --git a/lucene/core/src/test/org/apache/lucene/codecs/lucene40/TestReuseDocsEnum.java b/lucene/core/src/test/org/apache/lucene/codecs/lucene40/TestReuseDocsEnum.java index c5aa64477f8..848b7e62b3d 100644 --- a/lucene/core/src/test/org/apache/lucene/codecs/lucene40/TestReuseDocsEnum.java +++ b/lucene/core/src/test/org/apache/lucene/codecs/lucene40/TestReuseDocsEnum.java @@ -162,7 +162,7 @@ public class TestReuseDocsEnum extends LuceneTestCase { return null; } TermsEnum iterator = terms.iterator(null); - if (iterator.seekExact(term, true)) { + if (iterator.seekExact(term)) { return iterator.docs(bits, null, random().nextBoolean() ? DocsEnum.FLAG_FREQS : DocsEnum.FLAG_NONE); } return null; diff --git a/lucene/core/src/test/org/apache/lucene/codecs/lucene41/TestBlockPostingsFormat3.java b/lucene/core/src/test/org/apache/lucene/codecs/lucene41/TestBlockPostingsFormat3.java index 19d8a1a0a50..76e5fd0e67b 100644 --- a/lucene/core/src/test/org/apache/lucene/codecs/lucene41/TestBlockPostingsFormat3.java +++ b/lucene/core/src/test/org/apache/lucene/codecs/lucene41/TestBlockPostingsFormat3.java @@ -235,21 +235,21 @@ public class TestBlockPostingsFormat3 extends LuceneTestCase { leftEnum = leftTerms.iterator(leftEnum); rightEnum = rightTerms.iterator(rightEnum); - assertEquals(leftEnum.seekExact(b, false), rightEnum.seekExact(b, false)); - assertEquals(leftEnum.seekExact(b, true), rightEnum.seekExact(b, true)); + assertEquals(leftEnum.seekExact(b), rightEnum.seekExact(b)); + assertEquals(leftEnum.seekExact(b), rightEnum.seekExact(b)); SeekStatus leftStatus; SeekStatus rightStatus; - leftStatus = leftEnum.seekCeil(b, false); - rightStatus = rightEnum.seekCeil(b, false); + leftStatus = leftEnum.seekCeil(b); + rightStatus = rightEnum.seekCeil(b); assertEquals(leftStatus, rightStatus); if (leftStatus != SeekStatus.END) { assertEquals(leftEnum.term(), rightEnum.term()); } - leftStatus = leftEnum.seekCeil(b, true); - rightStatus = rightEnum.seekCeil(b, true); + leftStatus = leftEnum.seekCeil(b); + rightStatus = rightEnum.seekCeil(b); assertEquals(leftStatus, rightStatus); if (leftStatus != SeekStatus.END) { assertEquals(leftEnum.term(), rightEnum.term()); diff --git a/lucene/core/src/test/org/apache/lucene/index/TestDocTermOrds.java b/lucene/core/src/test/org/apache/lucene/index/TestDocTermOrds.java index d6bccca699d..51af43e87af 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestDocTermOrds.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestDocTermOrds.java @@ -332,7 +332,7 @@ public class TestDocTermOrds extends LuceneTestCase { Terms terms = MultiFields.getTerms(r, "field"); if (terms != null) { TermsEnum termsEnum = terms.iterator(null); - TermsEnum.SeekStatus result = termsEnum.seekCeil(prefixRef, false); + TermsEnum.SeekStatus result = termsEnum.seekCeil(prefixRef); if (result != TermsEnum.SeekStatus.END) { assertFalse("term=" + termsEnum.term().utf8ToString() + " matches prefix=" + prefixRef.utf8ToString(), StringHelper.startsWith(termsEnum.term(), prefixRef)); } else { @@ -454,16 +454,16 @@ public class TestDocTermOrds extends LuceneTestCase { assertEquals(SeekStatus.END, termsEnum.seekCeil(new BytesRef("zzz"))); // seekExact() - assertTrue(termsEnum.seekExact(new BytesRef("beer"), true)); + assertTrue(termsEnum.seekExact(new BytesRef("beer"))); assertEquals("beer", termsEnum.term().utf8ToString()); assertEquals(0, termsEnum.ord()); - assertTrue(termsEnum.seekExact(new BytesRef("hello"), true)); + assertTrue(termsEnum.seekExact(new BytesRef("hello"))); assertEquals("hello", termsEnum.term().utf8ToString()); assertEquals(1, termsEnum.ord()); - assertTrue(termsEnum.seekExact(new BytesRef("world"), true)); + assertTrue(termsEnum.seekExact(new BytesRef("world"))); assertEquals("world", termsEnum.term().utf8ToString()); assertEquals(2, termsEnum.ord()); - assertFalse(termsEnum.seekExact(new BytesRef("bogus"), true)); + assertFalse(termsEnum.seekExact(new BytesRef("bogus"))); // seek(ord) termsEnum.seekExact(0); diff --git a/lucene/core/src/test/org/apache/lucene/index/TestDocsAndPositions.java b/lucene/core/src/test/org/apache/lucene/index/TestDocsAndPositions.java index 80d0d7375ba..c4423bb1555 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestDocsAndPositions.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestDocsAndPositions.java @@ -95,7 +95,7 @@ public class TestDocsAndPositions extends LuceneTestCase { Terms terms = reader.terms(fieldName); if (terms != null) { TermsEnum te = terms.iterator(null); - if (te.seekExact(bytes, true)) { + if (te.seekExact(bytes)) { return te.docsAndPositions(liveDocs, null); } } @@ -341,7 +341,7 @@ public class TestDocsAndPositions extends LuceneTestCase { // now reuse and check again TermsEnum te = r.terms("foo").iterator(null); - assertTrue(te.seekExact(new BytesRef("bar"), true)); + assertTrue(te.seekExact(new BytesRef("bar"))); disi = _TestUtil.docs(random(), te, null, disi, DocsEnum.FLAG_NONE); docid = disi.docID(); assertEquals(-1, docid); @@ -366,7 +366,7 @@ public class TestDocsAndPositions extends LuceneTestCase { // now reuse and check again TermsEnum te = r.terms("foo").iterator(null); - assertTrue(te.seekExact(new BytesRef("bar"), true)); + assertTrue(te.seekExact(new BytesRef("bar"))); disi = te.docsAndPositions(null, disi); docid = disi.docID(); assertEquals(-1, docid); diff --git a/lucene/core/src/test/org/apache/lucene/index/TestPayloadsOnVectors.java b/lucene/core/src/test/org/apache/lucene/index/TestPayloadsOnVectors.java index d1bbcca4dae..2cc02e789b3 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestPayloadsOnVectors.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestPayloadsOnVectors.java @@ -70,7 +70,7 @@ public class TestPayloadsOnVectors extends LuceneTestCase { Terms terms = reader.getTermVector(1, "field"); assert terms != null; TermsEnum termsEnum = terms.iterator(null); - assertTrue(termsEnum.seekExact(new BytesRef("withPayload"), true)); + assertTrue(termsEnum.seekExact(new BytesRef("withPayload"))); DocsAndPositionsEnum de = termsEnum.docsAndPositions(null, null); assertEquals(0, de.nextDoc()); assertEquals(0, de.nextPosition()); @@ -112,7 +112,7 @@ public class TestPayloadsOnVectors extends LuceneTestCase { Terms terms = reader.getTermVector(0, "field"); assert terms != null; TermsEnum termsEnum = terms.iterator(null); - assertTrue(termsEnum.seekExact(new BytesRef("withPayload"), true)); + assertTrue(termsEnum.seekExact(new BytesRef("withPayload"))); DocsAndPositionsEnum de = termsEnum.docsAndPositions(null, null); assertEquals(0, de.nextDoc()); assertEquals(3, de.nextPosition()); diff --git a/lucene/core/src/test/org/apache/lucene/index/TestPerSegmentDeletes.java b/lucene/core/src/test/org/apache/lucene/index/TestPerSegmentDeletes.java index 9718e108397..e56e6ef820b 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestPerSegmentDeletes.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestPerSegmentDeletes.java @@ -227,7 +227,7 @@ public class TestPerSegmentDeletes extends LuceneTestCase { Fields fields = MultiFields.getFields(reader); Terms cterms = fields.terms(term.field); TermsEnum ctermsEnum = cterms.iterator(null); - if (ctermsEnum.seekExact(new BytesRef(term.text()), false)) { + if (ctermsEnum.seekExact(new BytesRef(term.text()))) { DocsEnum docsEnum = _TestUtil.docs(random(), ctermsEnum, bits, null, DocsEnum.FLAG_NONE); return toArray(docsEnum); } diff --git a/lucene/core/src/test/org/apache/lucene/index/TestPostingsOffsets.java b/lucene/core/src/test/org/apache/lucene/index/TestPostingsOffsets.java index a3e58a913ae..f25e80bf6d2 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestPostingsOffsets.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestPostingsOffsets.java @@ -301,7 +301,7 @@ public class TestPostingsOffsets extends LuceneTestCase { final FieldCache.Ints docIDToID = FieldCache.DEFAULT.getInts(sub, "id", false); for(String term : terms) { //System.out.println(" term=" + term); - if (termsEnum.seekExact(new BytesRef(term), random().nextBoolean())) { + if (termsEnum.seekExact(new BytesRef(term))) { docs = termsEnum.docs(null, docs); assertNotNull(docs); int doc; diff --git a/lucene/core/src/test/org/apache/lucene/index/TestStressIndexing2.java b/lucene/core/src/test/org/apache/lucene/index/TestStressIndexing2.java index bc782493029..9ce0b06dcf7 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestStressIndexing2.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestStressIndexing2.java @@ -354,7 +354,7 @@ public class TestStressIndexing2 extends LuceneTestCase { } termDocs1 = _TestUtil.docs(random(), termsEnum, liveDocs1, termDocs1, DocsEnum.FLAG_NONE); - if (termsEnum2.seekExact(term, false)) { + if (termsEnum2.seekExact(term)) { termDocs2 = _TestUtil.docs(random(), termsEnum2, liveDocs2, termDocs2, DocsEnum.FLAG_NONE); } else { termDocs2 = null; diff --git a/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum.java b/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum.java index 0d2c5dfb899..a955e291402 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum.java @@ -111,7 +111,7 @@ public class TestTermsEnum extends LuceneTestCase { System.out.println("TEST: iter seekCeil target=" + target.utf8ToString() + " exists=" + exists); } // seekCeil - final TermsEnum.SeekStatus status = termsEnum.seekCeil(target, random().nextBoolean()); + final TermsEnum.SeekStatus status = termsEnum.seekCeil(target); if (VERBOSE) { System.out.println(" got " + status); } @@ -134,7 +134,7 @@ public class TestTermsEnum extends LuceneTestCase { System.out.println("TEST: iter seekExact target=" + target.utf8ToString() + " exists=" + exists); } // seekExact - final boolean result = termsEnum.seekExact(target, false); + final boolean result = termsEnum.seekExact(target); if (VERBOSE) { System.out.println(" got " + result); } @@ -571,7 +571,7 @@ public class TestTermsEnum extends LuceneTestCase { // sugar private boolean seekExact(TermsEnum te, String term) throws IOException { - return te.seekExact(new BytesRef(term), random().nextBoolean()); + return te.seekExact(new BytesRef(term)); } // sugar @@ -666,13 +666,13 @@ public class TestTermsEnum extends LuceneTestCase { if (VERBOSE) { System.out.println(" seekExact"); } - assertEquals(loc >= 0, te.seekExact(t, random().nextBoolean())); + assertEquals(loc >= 0, te.seekExact(t)); } else { if (VERBOSE) { System.out.println(" seekCeil"); } - final TermsEnum.SeekStatus result = te.seekCeil(t, random().nextBoolean()); + final TermsEnum.SeekStatus result = te.seekCeil(t); if (VERBOSE) { System.out.println(" got " + result); } diff --git a/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum2.java b/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum2.java index 7ef612eb6f5..813771ad4f8 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum2.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum2.java @@ -117,10 +117,10 @@ public class TestTermsEnum2 extends LuceneTestCase { // term is accepted if (random().nextBoolean()) { // seek exact - assertTrue(te.seekExact(term, random().nextBoolean())); + assertTrue(te.seekExact(term)); } else { // seek ceil - assertEquals(SeekStatus.FOUND, te.seekCeil(term, random().nextBoolean())); + assertEquals(SeekStatus.FOUND, te.seekCeil(term)); assertEquals(term, te.term()); } } @@ -138,10 +138,10 @@ public class TestTermsEnum2 extends LuceneTestCase { if (c == 0) { assertEquals(term, te.next()); } else if (c == 1) { - assertEquals(SeekStatus.FOUND, te.seekCeil(term, random().nextBoolean())); + assertEquals(SeekStatus.FOUND, te.seekCeil(term)); assertEquals(term, te.term()); } else { - assertTrue(te.seekExact(term, random().nextBoolean())); + assertTrue(te.seekExact(term)); } } } diff --git a/lucene/core/src/test/org/apache/lucene/search/TestMinShouldMatch2.java b/lucene/core/src/test/org/apache/lucene/search/TestMinShouldMatch2.java index 57db46a9c43..c8e963cb3b1 100644 --- a/lucene/core/src/test/org/apache/lucene/search/TestMinShouldMatch2.java +++ b/lucene/core/src/test/org/apache/lucene/search/TestMinShouldMatch2.java @@ -294,7 +294,7 @@ public class TestMinShouldMatch2 extends LuceneTestCase { if (ord >= 0) { boolean success = ords.add(ord); assert success; // no dups - TermContext context = TermContext.build(reader.getContext(), term, true); + TermContext context = TermContext.build(reader.getContext(), term); SimWeight w = weight.similarity.computeWeight(1f, searcher.collectionStatistics("field"), searcher.termStatistics(term, context)); diff --git a/lucene/core/src/test/org/apache/lucene/search/spans/MultiSpansWrapper.java b/lucene/core/src/test/org/apache/lucene/search/spans/MultiSpansWrapper.java index 6d38820db9c..fcab7ae0fa8 100644 --- a/lucene/core/src/test/org/apache/lucene/search/spans/MultiSpansWrapper.java +++ b/lucene/core/src/test/org/apache/lucene/search/spans/MultiSpansWrapper.java @@ -60,7 +60,7 @@ public class MultiSpansWrapper extends Spans { // can't be package private due t TreeSet terms = new TreeSet(); query.extractTerms(terms); for (Term term : terms) { - termContexts.put(term, TermContext.build(topLevelReaderContext, term, true)); + termContexts.put(term, TermContext.build(topLevelReaderContext, term)); } final List leaves = topLevelReaderContext.leaves(); if(leaves.size() == 1) { diff --git a/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java b/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java index fe21e0ab87a..f647a7171b8 100644 --- a/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java +++ b/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java @@ -932,20 +932,15 @@ public class TestFSTs extends LuceneTestCase { } } - final boolean useCache = random().nextBoolean(); - if (VERBOSE) { - System.out.println(" useCache=" + useCache); - } - final TermsEnum.SeekStatus status; if (nextID == null) { - if (termsEnum.seekExact(new BytesRef(id), useCache)) { + if (termsEnum.seekExact(new BytesRef(id))) { status = TermsEnum.SeekStatus.FOUND; } else { status = TermsEnum.SeekStatus.NOT_FOUND; } } else { - status = termsEnum.seekCeil(new BytesRef(id), useCache); + status = termsEnum.seekCeil(new BytesRef(id)); } if (nextID != null) { diff --git a/lucene/facet/src/java/org/apache/lucene/facet/search/DrillSidewaysQuery.java b/lucene/facet/src/java/org/apache/lucene/facet/search/DrillSidewaysQuery.java index fd5d16077d5..eee04315b32 100644 --- a/lucene/facet/src/java/org/apache/lucene/facet/search/DrillSidewaysQuery.java +++ b/lucene/facet/src/java/org/apache/lucene/facet/search/DrillSidewaysQuery.java @@ -130,7 +130,7 @@ class DrillSidewaysQuery extends Query { continue; } for(int i=0;i extractedTerms = new TreeSet(); q.extractTerms(extractedTerms); for (Term term : extractedTerms) { - termContexts.put(term, TermContext.build(context, term, true)); + termContexts.put(term, TermContext.build(context, term)); } Bits acceptDocs = context.reader().getLiveDocs(); final Spans spans = q.getSpans(context, acceptDocs, termContexts); diff --git a/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/PostingsHighlighter.java b/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/PostingsHighlighter.java index 715efebde7d..622a9f28d61 100644 --- a/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/PostingsHighlighter.java +++ b/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/PostingsHighlighter.java @@ -459,7 +459,7 @@ public class PostingsHighlighter { continue; } else if (de == null) { postings[i] = EMPTY; // initially - if (!termsEnum.seekExact(terms[i], true)) { + if (!termsEnum.seekExact(terms[i])) { continue; // term not found } de = postings[i] = termsEnum.docsAndPositions(null, null, DocsAndPositionsEnum.FLAG_OFFSETS); diff --git a/lucene/join/src/java/org/apache/lucene/search/join/TermsIncludingScoreQuery.java b/lucene/join/src/java/org/apache/lucene/search/join/TermsIncludingScoreQuery.java index 31eba6e3a12..c239ce42e19 100644 --- a/lucene/join/src/java/org/apache/lucene/search/join/TermsIncludingScoreQuery.java +++ b/lucene/join/src/java/org/apache/lucene/search/join/TermsIncludingScoreQuery.java @@ -241,7 +241,7 @@ class TermsIncludingScoreQuery extends Query { } scoreUpto = upto; - if (termsEnum.seekExact(terms.get(ords[upto++], spare), true)) { + if (termsEnum.seekExact(terms.get(ords[upto++], spare))) { docsEnum = reuse = termsEnum.docs(acceptDocs, reuse, DocsEnum.FLAG_NONE); } } @@ -337,7 +337,7 @@ class TermsIncludingScoreQuery extends Query { BytesRef spare = new BytesRef(); DocsEnum docsEnum = null; for (int i = 0; i < terms.size(); i++) { - if (termsEnum.seekExact(terms.get(ords[i], spare), true)) { + if (termsEnum.seekExact(terms.get(ords[i], spare))) { docsEnum = termsEnum.docs(acceptDocs, docsEnum, DocsEnum.FLAG_NONE); float score = TermsIncludingScoreQuery.this.scores[ords[i]]; for (int doc = docsEnum.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = docsEnum.nextDoc()) { @@ -393,7 +393,7 @@ class TermsIncludingScoreQuery extends Query { BytesRef spare = new BytesRef(); DocsEnum docsEnum = null; for (int i = 0; i < terms.size(); i++) { - if (termsEnum.seekExact(terms.get(ords[i], spare), true)) { + if (termsEnum.seekExact(terms.get(ords[i], spare))) { docsEnum = termsEnum.docs(acceptDocs, docsEnum, DocsEnum.FLAG_NONE); float score = TermsIncludingScoreQuery.this.scores[ords[i]]; for (int doc = docsEnum.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = docsEnum.nextDoc()) { diff --git a/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java b/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java index dbbf7ba2d7f..e067f0b0aac 100644 --- a/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java +++ b/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java @@ -557,7 +557,7 @@ public class TestJoinUtil extends LuceneTestCase { joinValues.addAll(joinValueToJoinScores.keySet()); for (BytesRef joinValue : joinValues) { termsEnum = terms.iterator(termsEnum); - if (termsEnum.seekExact(joinValue, true)) { + if (termsEnum.seekExact(joinValue)) { docsEnum = termsEnum.docs(slowCompositeReader.getLiveDocs(), docsEnum, DocsEnum.FLAG_NONE); JoinScore joinScore = joinValueToJoinScores.get(joinValue); diff --git a/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java b/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java index c8918523f0b..8107aab3b68 100644 --- a/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java +++ b/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java @@ -885,13 +885,13 @@ public class MemoryIndex { @Override - public boolean seekExact(BytesRef text, boolean useCache) { + public boolean seekExact(BytesRef text) { termUpto = binarySearch(text, br, 0, info.terms.size()-1, info.terms, info.sortedTerms, BytesRef.getUTF8SortedAsUnicodeComparator()); return termUpto >= 0; } @Override - public SeekStatus seekCeil(BytesRef text, boolean useCache) { + public SeekStatus seekCeil(BytesRef text) { termUpto = binarySearch(text, br, 0, info.terms.size()-1, info.terms, info.sortedTerms, BytesRef.getUTF8SortedAsUnicodeComparator()); if (termUpto < 0) { // not found; choose successor termUpto = -termUpto-1; diff --git a/lucene/memory/src/test/org/apache/lucene/index/memory/MemoryIndexTest.java b/lucene/memory/src/test/org/apache/lucene/index/memory/MemoryIndexTest.java index 5d9b1d654d8..350e9e92b1f 100644 --- a/lucene/memory/src/test/org/apache/lucene/index/memory/MemoryIndexTest.java +++ b/lucene/memory/src/test/org/apache/lucene/index/memory/MemoryIndexTest.java @@ -327,7 +327,7 @@ public class MemoryIndexTest extends BaseTokenStreamTestCase { // now reuse and check again TermsEnum te = reader.terms("foo").iterator(null); - assertTrue(te.seekExact(new BytesRef("bar"), true)); + assertTrue(te.seekExact(new BytesRef("bar"))); disi = te.docs(null, disi, DocsEnum.FLAG_NONE); docid = disi.docID(); assertEquals(-1, docid); @@ -361,7 +361,7 @@ public class MemoryIndexTest extends BaseTokenStreamTestCase { // now reuse and check again TermsEnum te = reader.terms("foo").iterator(null); - assertTrue(te.seekExact(new BytesRef("bar"), true)); + assertTrue(te.seekExact(new BytesRef("bar"))); disi = te.docsAndPositions(null, disi); docid = disi.docID(); assertEquals(-1, docid); diff --git a/lucene/queries/src/java/org/apache/lucene/queries/CommonTermsQuery.java b/lucene/queries/src/java/org/apache/lucene/queries/CommonTermsQuery.java index 5bdbadac8fd..cbf652fa114 100644 --- a/lucene/queries/src/java/org/apache/lucene/queries/CommonTermsQuery.java +++ b/lucene/queries/src/java/org/apache/lucene/queries/CommonTermsQuery.java @@ -246,7 +246,7 @@ public class CommonTermsQuery extends Query { assert termsEnum != null; if (termsEnum == TermsEnum.EMPTY) continue; - if (termsEnum.seekExact(term.bytes(), false)) { + if (termsEnum.seekExact(term.bytes())) { if (termContext == null) { contextArray[i] = new TermContext(reader.getContext(), termsEnum.termState(), context.ord, termsEnum.docFreq(), diff --git a/lucene/queries/src/java/org/apache/lucene/queries/TermsFilter.java b/lucene/queries/src/java/org/apache/lucene/queries/TermsFilter.java index 6480c407349..4dc88222f8f 100644 --- a/lucene/queries/src/java/org/apache/lucene/queries/TermsFilter.java +++ b/lucene/queries/src/java/org/apache/lucene/queries/TermsFilter.java @@ -193,7 +193,7 @@ public final class TermsFilter extends Filter { for (int i = termsAndField.start; i < termsAndField.end; i++) { spare.offset = offsets[i]; spare.length = offsets[i+1] - offsets[i]; - if (termsEnum.seekExact(spare, false)) { // don't use cache since we could pollute the cache here easily + if (termsEnum.seekExact(spare)) { docs = termsEnum.docs(acceptDocs, docs, DocsEnum.FLAG_NONE); // no freq since we don't need them if (result == null) { if (docs.nextDoc() != DocIdSetIterator.NO_MORE_DOCS) { diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/JoinDocFreqValueSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/JoinDocFreqValueSource.java index 1936a494187..c59ef21e5c6 100644 --- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/JoinDocFreqValueSource.java +++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/JoinDocFreqValueSource.java @@ -69,7 +69,7 @@ public class JoinDocFreqValueSource extends FieldCacheSource { { try { terms.get(doc, ref); - if (termsEnum.seekExact(ref, true)) { + if (termsEnum.seekExact(ref)) { return termsEnum.docFreq(); } else { return 0; diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TFValueSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TFValueSource.java index 12554be6329..5fe1af404a2 100755 --- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TFValueSource.java +++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TFValueSource.java @@ -67,7 +67,7 @@ public class TFValueSource extends TermFreqValueSource { if (terms != null) { final TermsEnum termsEnum = terms.iterator(null); - if (termsEnum.seekExact(indexedBytes, false)) { + if (termsEnum.seekExact(indexedBytes)) { docs = termsEnum.docs(null, null); } else { docs = null; diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TermFreqValueSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TermFreqValueSource.java index ee6800cfe24..3fba5f85964 100755 --- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TermFreqValueSource.java +++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TermFreqValueSource.java @@ -60,7 +60,7 @@ public class TermFreqValueSource extends DocFreqValueSource { if (terms != null) { final TermsEnum termsEnum = terms.iterator(null); - if (termsEnum.seekExact(indexedBytes, false)) { + if (termsEnum.seekExact(indexedBytes)) { docs = termsEnum.docs(null, null); } else { docs = null; diff --git a/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/AbstractVisitingPrefixTreeFilter.java b/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/AbstractVisitingPrefixTreeFilter.java index 6763c998670..9f4eebfae32 100644 --- a/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/AbstractVisitingPrefixTreeFilter.java +++ b/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/AbstractVisitingPrefixTreeFilter.java @@ -171,11 +171,11 @@ public abstract class AbstractVisitingPrefixTreeFilter extends AbstractPrefixTre int compare = termsEnum.getComparator().compare(thisTerm, curVNodeTerm); if (compare > 0) { // leap frog (termsEnum is beyond where we would otherwise seek) - assert ! context.reader().terms(fieldName).iterator(null).seekExact(curVNodeTerm, false) : "should be absent"; + assert ! context.reader().terms(fieldName).iterator(null).seekExact(curVNodeTerm) : "should be absent"; } else { if (compare < 0) { // Seek ! - TermsEnum.SeekStatus seekStatus = termsEnum.seekCeil(curVNodeTerm, true); + TermsEnum.SeekStatus seekStatus = termsEnum.seekCeil(curVNodeTerm); if (seekStatus == TermsEnum.SeekStatus.END) break; // all done thisTerm = termsEnum.term(); diff --git a/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/ContainsPrefixTreeFilter.java b/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/ContainsPrefixTreeFilter.java index bd0e9543e54..6b48dd1a4da 100644 --- a/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/ContainsPrefixTreeFilter.java +++ b/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/ContainsPrefixTreeFilter.java @@ -134,7 +134,7 @@ public class ContainsPrefixTreeFilter extends AbstractPrefixTreeFilter { termBytes.bytes = cell.getTokenBytes(); termBytes.length = termBytes.bytes.length; - return termsEnum.seekExact(termBytes, cell.getLevel() <= 2); + return termsEnum.seekExact(termBytes); } private SmallDocSet getDocs(Cell cell, Bits acceptContains) throws IOException { diff --git a/lucene/suggest/src/java/org/apache/lucene/search/spell/SpellChecker.java b/lucene/suggest/src/java/org/apache/lucene/search/spell/SpellChecker.java index 7aadbb6f375..6f5f399ef9a 100755 --- a/lucene/suggest/src/java/org/apache/lucene/search/spell/SpellChecker.java +++ b/lucene/suggest/src/java/org/apache/lucene/search/spell/SpellChecker.java @@ -525,7 +525,7 @@ public class SpellChecker implements java.io.Closeable { if (!isEmpty) { for (TermsEnum te : termsEnums) { - if (te.seekExact(currentTerm, false)) { + if (te.seekExact(currentTerm)) { continue terms; } } diff --git a/lucene/test-framework/src/java/org/apache/lucene/codecs/lucene41ords/Lucene41WithOrds.java b/lucene/test-framework/src/java/org/apache/lucene/codecs/lucene41ords/Lucene41WithOrds.java index d06e1aa6925..7058d671bf8 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/codecs/lucene41ords/Lucene41WithOrds.java +++ b/lucene/test-framework/src/java/org/apache/lucene/codecs/lucene41ords/Lucene41WithOrds.java @@ -87,8 +87,6 @@ public final class Lucene41WithOrds extends PostingsFormat { } } - public final static int TERMS_CACHE_SIZE = 1024; - @Override public FieldsProducer fieldsProducer(SegmentReadState state) throws IOException { PostingsReaderBase postings = new Lucene41PostingsReader(state.directory, state.fieldInfos, state.segmentInfo, state.context, state.segmentSuffix); @@ -117,7 +115,6 @@ public final class Lucene41WithOrds extends PostingsFormat { state.segmentInfo, postings, state.context, - TERMS_CACHE_SIZE, state.segmentSuffix); success = true; return ret; diff --git a/lucene/test-framework/src/java/org/apache/lucene/codecs/mockintblock/MockFixedIntBlockPostingsFormat.java b/lucene/test-framework/src/java/org/apache/lucene/codecs/mockintblock/MockFixedIntBlockPostingsFormat.java index d5be4c34ce1..8e0fadc75b0 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/codecs/mockintblock/MockFixedIntBlockPostingsFormat.java +++ b/lucene/test-framework/src/java/org/apache/lucene/codecs/mockintblock/MockFixedIntBlockPostingsFormat.java @@ -187,7 +187,6 @@ public final class MockFixedIntBlockPostingsFormat extends PostingsFormat { state.segmentInfo, postingsReader, state.context, - 1024, state.segmentSuffix); success = true; return ret; diff --git a/lucene/test-framework/src/java/org/apache/lucene/codecs/mockintblock/MockVariableIntBlockPostingsFormat.java b/lucene/test-framework/src/java/org/apache/lucene/codecs/mockintblock/MockVariableIntBlockPostingsFormat.java index f647b8581a4..e4c70c809f8 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/codecs/mockintblock/MockVariableIntBlockPostingsFormat.java +++ b/lucene/test-framework/src/java/org/apache/lucene/codecs/mockintblock/MockVariableIntBlockPostingsFormat.java @@ -212,7 +212,6 @@ public final class MockVariableIntBlockPostingsFormat extends PostingsFormat { state.segmentInfo, postingsReader, state.context, - 1024, state.segmentSuffix); success = true; return ret; diff --git a/lucene/test-framework/src/java/org/apache/lucene/codecs/mockrandom/MockRandomPostingsFormat.java b/lucene/test-framework/src/java/org/apache/lucene/codecs/mockrandom/MockRandomPostingsFormat.java index 0284a44794f..3e6266d7d5d 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/codecs/mockrandom/MockRandomPostingsFormat.java +++ b/lucene/test-framework/src/java/org/apache/lucene/codecs/mockrandom/MockRandomPostingsFormat.java @@ -400,8 +400,6 @@ public final class MockRandomPostingsFormat extends PostingsFormat { } } - final int termsCacheSize = _TestUtil.nextInt(random, 1, 1024); - success = false; try { fields = new BlockTermsReader(indexReader, @@ -410,7 +408,6 @@ public final class MockRandomPostingsFormat extends PostingsFormat { state.segmentInfo, postingsReader, state.context, - termsCacheSize, state.segmentSuffix); success = true; } finally { diff --git a/lucene/test-framework/src/java/org/apache/lucene/codecs/mocksep/MockSepPostingsFormat.java b/lucene/test-framework/src/java/org/apache/lucene/codecs/mocksep/MockSepPostingsFormat.java index 1047aa0b4a8..02f2a220485 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/codecs/mocksep/MockSepPostingsFormat.java +++ b/lucene/test-framework/src/java/org/apache/lucene/codecs/mocksep/MockSepPostingsFormat.java @@ -110,7 +110,6 @@ public final class MockSepPostingsFormat extends PostingsFormat { state.segmentInfo, postingsReader, state.context, - 1024, state.segmentSuffix); success = true; return ret; diff --git a/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java b/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java index 2cc7384db5c..6d356833a15 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java +++ b/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java @@ -336,7 +336,7 @@ public final class RAMOnlyPostingsFormat extends PostingsFormat { } @Override - public SeekStatus seekCeil(BytesRef term, boolean useCache) { + public SeekStatus seekCeil(BytesRef term) { current = term.utf8ToString(); it = null; if (ramField.termToDocs.containsKey(current)) { diff --git a/lucene/test-framework/src/java/org/apache/lucene/index/AssertingAtomicReader.java b/lucene/test-framework/src/java/org/apache/lucene/index/AssertingAtomicReader.java index bbcec7aaa40..6db5ccdeea3 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/index/AssertingAtomicReader.java +++ b/lucene/test-framework/src/java/org/apache/lucene/index/AssertingAtomicReader.java @@ -185,9 +185,9 @@ public class AssertingAtomicReader extends FilterAtomicReader { } @Override - public SeekStatus seekCeil(BytesRef term, boolean useCache) throws IOException { + public SeekStatus seekCeil(BytesRef term) throws IOException { assert term.isValid(); - SeekStatus result = super.seekCeil(term, useCache); + SeekStatus result = super.seekCeil(term); if (result == SeekStatus.END) { state = State.UNPOSITIONED; } else { @@ -197,9 +197,9 @@ public class AssertingAtomicReader extends FilterAtomicReader { } @Override - public boolean seekExact(BytesRef text, boolean useCache) throws IOException { + public boolean seekExact(BytesRef text) throws IOException { assert text.isValid(); - if (super.seekExact(text, useCache)) { + if (super.seekExact(text)) { state = State.POSITIONED; return true; } else { diff --git a/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java index a6eb50e195a..af66e03a622 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java +++ b/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java @@ -746,16 +746,16 @@ public abstract class BaseDocValuesFormatTestCase extends LuceneTestCase { assertEquals(SeekStatus.END, termsEnum.seekCeil(new BytesRef("zzz"))); // seekExact() - assertTrue(termsEnum.seekExact(new BytesRef("beer"), true)); + assertTrue(termsEnum.seekExact(new BytesRef("beer"))); assertEquals("beer", termsEnum.term().utf8ToString()); assertEquals(0, termsEnum.ord()); - assertTrue(termsEnum.seekExact(new BytesRef("hello"), true)); + assertTrue(termsEnum.seekExact(new BytesRef("hello"))); assertEquals(Codec.getDefault().toString(), "hello", termsEnum.term().utf8ToString()); assertEquals(1, termsEnum.ord()); - assertTrue(termsEnum.seekExact(new BytesRef("world"), true)); + assertTrue(termsEnum.seekExact(new BytesRef("world"))); assertEquals("world", termsEnum.term().utf8ToString()); assertEquals(2, termsEnum.ord()); - assertFalse(termsEnum.seekExact(new BytesRef("bogus"), true)); + assertFalse(termsEnum.seekExact(new BytesRef("bogus"))); // seek(ord) termsEnum.seekExact(0); @@ -1788,16 +1788,16 @@ public abstract class BaseDocValuesFormatTestCase extends LuceneTestCase { assertEquals(SeekStatus.END, termsEnum.seekCeil(new BytesRef("zzz"))); // seekExact() - assertTrue(termsEnum.seekExact(new BytesRef("beer"), true)); + assertTrue(termsEnum.seekExact(new BytesRef("beer"))); assertEquals("beer", termsEnum.term().utf8ToString()); assertEquals(0, termsEnum.ord()); - assertTrue(termsEnum.seekExact(new BytesRef("hello"), true)); + assertTrue(termsEnum.seekExact(new BytesRef("hello"))); assertEquals("hello", termsEnum.term().utf8ToString()); assertEquals(1, termsEnum.ord()); - assertTrue(termsEnum.seekExact(new BytesRef("world"), true)); + assertTrue(termsEnum.seekExact(new BytesRef("world"))); assertEquals("world", termsEnum.term().utf8ToString()); assertEquals(2, termsEnum.ord()); - assertFalse(termsEnum.seekExact(new BytesRef("bogus"), true)); + assertFalse(termsEnum.seekExact(new BytesRef("bogus"))); // seek(ord) termsEnum.seekExact(0); diff --git a/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java index fd3f90be826..a864cc30f23 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java +++ b/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java @@ -983,7 +983,7 @@ public abstract class BasePostingsFormatTestCase extends LuceneTestCase { termsEnum = terms.iterator(null); if (!useTermState) { - assertTrue(termsEnum.seekExact(fieldAndTerm.term, true)); + assertTrue(termsEnum.seekExact(fieldAndTerm.term)); } else { termsEnum.seekExact(fieldAndTerm.term, termState); } diff --git a/lucene/test-framework/src/java/org/apache/lucene/index/BaseTermVectorsFormatTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/index/BaseTermVectorsFormatTestCase.java index ac4a69b9c0e..150922b4ef6 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/index/BaseTermVectorsFormatTestCase.java +++ b/lucene/test-framework/src/java/org/apache/lucene/index/BaseTermVectorsFormatTestCase.java @@ -500,9 +500,9 @@ public abstract class BaseTermVectorsFormatTestCase extends LuceneTestCase { assertNull(termsEnum.next()); for (int i = 0; i < 5; ++i) { if (random().nextBoolean()) { - assertTrue(termsEnum.seekExact(RandomPicks.randomFrom(random(), tk.termBytes), random().nextBoolean())); + assertTrue(termsEnum.seekExact(RandomPicks.randomFrom(random(), tk.termBytes))); } else { - assertEquals(SeekStatus.FOUND, termsEnum.seekCeil(RandomPicks.randomFrom(random(), tk.termBytes), random().nextBoolean())); + assertEquals(SeekStatus.FOUND, termsEnum.seekCeil(RandomPicks.randomFrom(random(), tk.termBytes))); } } } diff --git a/lucene/test-framework/src/java/org/apache/lucene/search/ShardSearchingTestBase.java b/lucene/test-framework/src/java/org/apache/lucene/search/ShardSearchingTestBase.java index 5596383474a..c25fe8bef0e 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/search/ShardSearchingTestBase.java +++ b/lucene/test-framework/src/java/org/apache/lucene/search/ShardSearchingTestBase.java @@ -185,7 +185,7 @@ public abstract class ShardSearchingTestBase extends LuceneTestCase { } try { for(Term term : terms) { - final TermContext termContext = TermContext.build(s.getIndexReader().getContext(), term, false); + final TermContext termContext = TermContext.build(s.getIndexReader().getContext(), term); stats.put(term, s.termStatistics(term, termContext)); } } finally { diff --git a/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java index 3791e489362..5e38d92ad13 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java +++ b/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java @@ -1751,14 +1751,13 @@ public abstract class LuceneTestCase extends Assert { rightEnum = rightTerms.iterator(rightEnum); } - final boolean useCache = random().nextBoolean(); final boolean seekExact = random().nextBoolean(); if (seekExact) { - assertEquals(info, leftEnum.seekExact(b, useCache), rightEnum.seekExact(b, useCache)); + assertEquals(info, leftEnum.seekExact(b), rightEnum.seekExact(b)); } else { - SeekStatus leftStatus = leftEnum.seekCeil(b, useCache); - SeekStatus rightStatus = rightEnum.seekCeil(b, useCache); + SeekStatus leftStatus = leftEnum.seekCeil(b); + SeekStatus rightStatus = rightEnum.seekCeil(b); assertEquals(info, leftStatus, rightStatus); if (leftStatus != SeekStatus.END) { assertEquals(info, leftEnum.term(), rightEnum.term()); diff --git a/lucene/test-framework/src/java/org/apache/lucene/util/_TestUtil.java b/lucene/test-framework/src/java/org/apache/lucene/util/_TestUtil.java index 9eccf2770e5..e0ef230f91d 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/util/_TestUtil.java +++ b/lucene/test-framework/src/java/org/apache/lucene/util/_TestUtil.java @@ -928,7 +928,7 @@ public class _TestUtil { return null; } final TermsEnum termsEnum = terms.iterator(null); - if (!termsEnum.seekExact(term, random.nextBoolean())) { + if (!termsEnum.seekExact(term)) { return null; } return docs(random, termsEnum, liveDocs, reuse, flags); diff --git a/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java b/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java index 5aa353ec57e..ec245d20061 100644 --- a/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java +++ b/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java @@ -562,7 +562,7 @@ public class QueryElevationComponent extends SearchComponent implements SolrCore for (String id : elevations.ids) { term.copyChars(id); - if (seen.contains(id) == false && termsEnum.seekExact(term, false)) { + if (seen.contains(id) == false && termsEnum.seekExact(term)) { docsEnum = termsEnum.docs(liveDocs, docsEnum, DocsEnum.FLAG_NONE); if (docsEnum != null) { int docId = docsEnum.nextDoc(); diff --git a/solr/core/src/java/org/apache/solr/handler/component/TermsComponent.java b/solr/core/src/java/org/apache/solr/handler/component/TermsComponent.java index d671de26d5d..1fe142df96d 100644 --- a/solr/core/src/java/org/apache/solr/handler/component/TermsComponent.java +++ b/solr/core/src/java/org/apache/solr/handler/component/TermsComponent.java @@ -163,7 +163,7 @@ public class TermsComponent extends SearchComponent { BytesRef term = null; if (lowerBytes != null) { - if (termsEnum.seekCeil(lowerBytes, true) == TermsEnum.SeekStatus.END) { + if (termsEnum.seekCeil(lowerBytes) == TermsEnum.SeekStatus.END) { termsEnum = null; } else { term = termsEnum.term(); diff --git a/solr/core/src/java/org/apache/solr/request/SimpleFacets.java b/solr/core/src/java/org/apache/solr/request/SimpleFacets.java index 7822c1e7f80..835c4134bc9 100644 --- a/solr/core/src/java/org/apache/solr/request/SimpleFacets.java +++ b/solr/core/src/java/org/apache/solr/request/SimpleFacets.java @@ -768,7 +768,7 @@ public class SimpleFacets { // facet.offset when sorting by index order. if (startTermBytes != null) { - if (termsEnum.seekCeil(startTermBytes, true) == TermsEnum.SeekStatus.END) { + if (termsEnum.seekCeil(startTermBytes) == TermsEnum.SeekStatus.END) { termsEnum = null; } else { term = termsEnum.term(); diff --git a/solr/core/src/java/org/apache/solr/request/UnInvertedField.java b/solr/core/src/java/org/apache/solr/request/UnInvertedField.java index ad08167f1e7..55918f61aae 100755 --- a/solr/core/src/java/org/apache/solr/request/UnInvertedField.java +++ b/solr/core/src/java/org/apache/solr/request/UnInvertedField.java @@ -231,13 +231,13 @@ public class UnInvertedField extends DocTermOrds { TermsEnum te = getOrdTermsEnum(searcher.getAtomicReader()); if (te != null && prefix != null && prefix.length() > 0) { final BytesRef prefixBr = new BytesRef(prefix); - if (te.seekCeil(prefixBr, true) == TermsEnum.SeekStatus.END) { + if (te.seekCeil(prefixBr) == TermsEnum.SeekStatus.END) { startTerm = numTermsInField; } else { startTerm = (int) te.ord(); } prefixBr.append(UnicodeUtil.BIG_TERM); - if (te.seekCeil(prefixBr, true) == TermsEnum.SeekStatus.END) { + if (te.seekCeil(prefixBr) == TermsEnum.SeekStatus.END) { endTerm = numTermsInField; } else { endTerm = (int) te.ord(); diff --git a/solr/core/src/java/org/apache/solr/search/JoinQParserPlugin.java b/solr/core/src/java/org/apache/solr/search/JoinQParserPlugin.java index 55e5add95b9..86756cc378d 100644 --- a/solr/core/src/java/org/apache/solr/search/JoinQParserPlugin.java +++ b/solr/core/src/java/org/apache/solr/search/JoinQParserPlugin.java @@ -309,7 +309,7 @@ class JoinQuery extends Query { if (prefix == null) { term = termsEnum.next(); } else { - if (termsEnum.seekCeil(prefix, true) != TermsEnum.SeekStatus.END) { + if (termsEnum.seekCeil(prefix) != TermsEnum.SeekStatus.END) { term = termsEnum.term(); } } diff --git a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java index 44ba1660aff..bad1d954625 100644 --- a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java +++ b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java @@ -718,7 +718,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable,SolrIn if (terms == null) return -1; BytesRef termBytes = t.bytes(); final TermsEnum termsEnum = terms.iterator(null); - if (!termsEnum.seekExact(termBytes, false)) { + if (!termsEnum.seekExact(termBytes)) { return -1; } DocsEnum docs = termsEnum.docs(atomicReader.getLiveDocs(), null, DocsEnum.FLAG_NONE); @@ -742,7 +742,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable,SolrIn if (terms == null) continue; TermsEnum te = terms.iterator(null); - if (te.seekExact(idBytes, true)) { + if (te.seekExact(idBytes)) { DocsEnum docs = te.docs(reader.getLiveDocs(), null, DocsEnum.FLAG_NONE); int id = docs.nextDoc(); if (id == DocIdSetIterator.NO_MORE_DOCS) continue; diff --git a/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java b/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java index de508cf4bca..b6bb66bb148 100755 --- a/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java +++ b/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java @@ -297,7 +297,7 @@ public class FileFloatSource extends ValueSource { continue; // go to next line in file.. leave values as default. } - if (!termsEnum.seekExact(internalKey, false)) { + if (!termsEnum.seekExact(internalKey)) { if (notFoundCount<10) { // collect first 10 not found for logging notFound.add(key); } diff --git a/solr/core/src/test/org/apache/solr/request/TestFaceting.java b/solr/core/src/test/org/apache/solr/request/TestFaceting.java index 124a30b9759..a884c103637 100755 --- a/solr/core/src/test/org/apache/solr/request/TestFaceting.java +++ b/solr/core/src/test/org/apache/solr/request/TestFaceting.java @@ -112,7 +112,7 @@ public class TestFaceting extends SolrTestCaseJ4 { // test seeking before term if (size>0) { - assertEquals(size>0, te.seekCeil(new BytesRef("000"), true) != TermsEnum.SeekStatus.END); + assertEquals(size>0, te.seekCeil(new BytesRef("000")) != TermsEnum.SeekStatus.END); assertEquals(0, te.ord()); assertEquals(t(0), te.term().utf8ToString()); } diff --git a/solr/core/src/test/org/apache/solr/search/TestRTGBase.java b/solr/core/src/test/org/apache/solr/search/TestRTGBase.java index 114b97f6b60..d107a8ba687 100644 --- a/solr/core/src/test/org/apache/solr/search/TestRTGBase.java +++ b/solr/core/src/test/org/apache/solr/search/TestRTGBase.java @@ -132,7 +132,7 @@ public class TestRTGBase extends SolrTestCaseJ4 { if (terms == null) return -1; BytesRef termBytes = t.bytes(); final TermsEnum termsEnum = terms.iterator(null); - if (!termsEnum.seekExact(termBytes, false)) { + if (!termsEnum.seekExact(termBytes)) { return -1; } DocsEnum docs = termsEnum.docs(MultiFields.getLiveDocs(r), null, DocsEnum.FLAG_NONE);