LUCENE-8638: remove unused deprecated methods and related tests (#248)

This commit is contained in:
Michael Sokolov 2021-08-18 08:19:49 -04:00 committed by GitHub
parent 666c7a2590
commit d1d60e2db6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 0 additions and 131 deletions

View File

@ -39,18 +39,6 @@ import org.apache.lucene.util.BitUtil;
*/
public abstract class DataInput implements Cloneable {
private static final int SKIP_BUFFER_SIZE = 1024;
/* This buffer is used to skip over bytes with the slow implementation of
* skipBytesSlowly. The reason why we need to use an instance member instead of
* sharing a single instance across threads is that some delegating
* implementations of DataInput might want to reuse the provided buffer in
* order to eg. update the checksum. If we shared the same buffer across
* threads, then another thread might update the buffer while the checksum is
* being computed, making it invalid. See LUCENE-5583 for more information.
*/
private byte[] skipBuffer;
/**
* Reads and returns a single byte.
*
@ -336,30 +324,6 @@ public abstract class DataInput implements Cloneable {
}
}
/**
* Skip over <code>numBytes</code> bytes. The contract on this method is that it should have the
* same behavior as reading the same number of bytes into a buffer and discarding its content.
* Negative values of <code>numBytes</code> are not supported.
*
* @deprecated Implementing subclasses should override #skipBytes with a more performant solution
* where possible.
*/
@Deprecated
protected void skipBytesSlowly(final long numBytes) throws IOException {
if (numBytes < 0) {
throw new IllegalArgumentException("numBytes must be >= 0, got " + numBytes);
}
if (skipBuffer == null) {
skipBuffer = new byte[SKIP_BUFFER_SIZE];
}
assert skipBuffer.length == SKIP_BUFFER_SIZE;
for (long skipped = 0; skipped < numBytes; ) {
final int step = (int) Math.min(SKIP_BUFFER_SIZE, numBytes - skipped);
readBytes(skipBuffer, 0, step, false);
skipped += step;
}
}
/**
* Skip over <code>numBytes</code> bytes. This method may skip bytes in whatever way is most
* optimal, and may not have the same behavior as reading the skipped bytes. In general, negative

View File

@ -211,24 +211,6 @@ public class FacetsConfig {
dimConfig.indexFieldName = indexFieldName;
}
/**
* Specify whether drill down on the dimension is necessary.
*
* @deprecated Use {@link FacetsConfig#setDrillDownTermsIndexing(String, DrillDownTermsIndexing)}
* instead
*/
@Deprecated
public synchronized void setRequireDimensionDrillDown(String dimName, boolean value) {
DimConfig dimConfig = fieldTypes.get(dimName);
if (dimConfig == null) {
dimConfig = new DimConfig();
fieldTypes.put(dimName, dimConfig);
}
dimConfig.drillDownTermsIndexing =
value ? DrillDownTermsIndexing.ALL : DrillDownTermsIndexing.ALL_PATHS_NO_DIM;
}
/** Specify drill down terms option on the field / dimension. */
public synchronized void setDrillDownTermsIndexing(
String dimName, DrillDownTermsIndexing drillDownTermsIndexing) {

View File

@ -259,50 +259,6 @@ public class TestDrillDownQuery extends FacetTestCase {
assertEquals(base, rewrite);
}
@SuppressWarnings("deprecation")
public void testRequireDimensionDrillDown() throws Exception {
Directory dir = newDirectory();
RandomIndexWriter writer =
new RandomIndexWriter(
random(),
dir,
newIndexWriterConfig(new MockAnalyzer(random(), MockTokenizer.KEYWORD, false)));
Directory taxoDir = newDirectory();
TaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(taxoDir);
FacetsConfig config = new FacetsConfig();
config.setRequireDimensionDrillDown("a", true);
config.setRequireDimensionDrillDown("b", false);
Document doc = new Document();
doc.add(new FacetField("a", "1"));
doc.add(new FacetField("b", "2"));
writer.addDocument(config.build(taxoWriter, doc));
taxoWriter.close();
IndexReader reader = writer.getReader();
DirectoryTaxonomyReader taxoReader = new DirectoryTaxonomyReader(taxoDir);
IndexSearcher searcher = newSearcher(reader);
DrillDownQuery q = new DrillDownQuery(config);
q.add("a", "1");
assertEquals(1, searcher.count(q));
q = new DrillDownQuery(config);
q.add("a");
assertEquals(1, searcher.count(q));
q = new DrillDownQuery(config);
q.add("b", "2");
assertEquals(1, searcher.count(q));
q = new DrillDownQuery(config);
q.add("b");
// no hits because we disabled dimension drill down for dimension "b":
assertEquals(0, searcher.count(q));
IOUtils.close(taxoReader, reader, writer, dir, taxoDir);
}
public void testSkipDrillDownTermsIndexing() throws Exception {
Directory dir = newDirectory();
RandomIndexWriter writer =

View File

@ -50,14 +50,6 @@ public class LengthGoalBreakIterator extends BreakIterator {
baseIter, minLength, fragmentAlignment, true, baseIter.current());
}
/**
* For backwards compatibility you can initialise the break iterator without fragmentAlignment.
*/
@Deprecated
public static LengthGoalBreakIterator createMinLength(BreakIterator baseIter, int minLength) {
return createMinLength(baseIter, minLength, 0.f);
}
/**
* Breaks will be on average {@code targetLength} apart; the closest break to this target (before
* or after) is chosen. The match will be positioned according to {@code fragmentAlignment} as
@ -69,15 +61,6 @@ public class LengthGoalBreakIterator extends BreakIterator {
baseIter, targetLength, fragmentAlignment, false, baseIter.current());
}
/**
* For backwards compatibility you can initialise the break iterator without fragmentAlignment.
*/
@Deprecated
public static LengthGoalBreakIterator createClosestToLength(
BreakIterator baseIter, int targetLength) {
return createClosestToLength(baseIter, targetLength, 0.f);
}
private LengthGoalBreakIterator(
BreakIterator baseIter,
int lengthGoal,

View File

@ -62,12 +62,6 @@ public class TestLengthGoalBreakIterator extends LuceneTestCase {
LengthGoalBreakIterator.createClosestToLength(baseBI, 50, alignment);
});
}
// test backwards compatibility constructors
String backwardCompString =
LengthGoalBreakIterator.createClosestToLength(baseBI, 50).toString();
assertTrue(backwardCompString, backwardCompString.contains("fragAlign=0.0"));
backwardCompString = LengthGoalBreakIterator.createMinLength(baseBI, 50).toString();
assertTrue(backwardCompString, backwardCompString.contains("fragAlign=0.0"));
}
public void testTargetLen() throws IOException {

View File

@ -82,16 +82,6 @@ public class BlockJoinSelector {
};
}
/**
* Wraps the provided {@link SortedSetDocValues} in order to only select one value per parent
* among its {@code children} using the configured {@code selection} type.
*/
@Deprecated
public static SortedDocValues wrap(
SortedSetDocValues sortedSet, Type selection, BitSet parents, BitSet children) {
return wrap(sortedSet, selection, parents, toIter(children));
}
/**
* Wraps the provided {@link SortedSetDocValues} in order to only select one value per parent
* among its {@code children} using the configured {@code selection} type.