You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by so...@apache.org on 2021/08/18 12:19:56 UTC

[lucene] branch main updated: LUCENE-8638: remove unused deprecated methods and related tests (#248)

This is an automated email from the ASF dual-hosted git repository.

sokolov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/main by this push:
     new d1d60e2  LUCENE-8638: remove unused deprecated methods and related tests (#248)
d1d60e2 is described below

commit d1d60e2db655de3156f70220e146a0a7a623da76
Author: Michael Sokolov <so...@falutin.net>
AuthorDate: Wed Aug 18 08:19:49 2021 -0400

    LUCENE-8638: remove unused deprecated methods and related tests (#248)
---
 .../java/org/apache/lucene/store/DataInput.java    | 36 ------------------
 .../java/org/apache/lucene/facet/FacetsConfig.java | 18 ---------
 .../apache/lucene/facet/TestDrillDownQuery.java    | 44 ----------------------
 .../search/uhighlight/LengthGoalBreakIterator.java | 17 ---------
 .../uhighlight/TestLengthGoalBreakIterator.java    |  6 ---
 .../lucene/search/join/BlockJoinSelector.java      | 10 -----
 6 files changed, 131 deletions(-)

diff --git a/lucene/core/src/java/org/apache/lucene/store/DataInput.java b/lucene/core/src/java/org/apache/lucene/store/DataInput.java
index 6a65c08..f68bad5 100644
--- a/lucene/core/src/java/org/apache/lucene/store/DataInput.java
+++ b/lucene/core/src/java/org/apache/lucene/store/DataInput.java
@@ -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.
    *
@@ -337,30 +325,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
    * <code>numBytes</code> are not supported.
diff --git a/lucene/facet/src/java/org/apache/lucene/facet/FacetsConfig.java b/lucene/facet/src/java/org/apache/lucene/facet/FacetsConfig.java
index 343ef01..02361b6 100644
--- a/lucene/facet/src/java/org/apache/lucene/facet/FacetsConfig.java
+++ b/lucene/facet/src/java/org/apache/lucene/facet/FacetsConfig.java
@@ -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) {
diff --git a/lucene/facet/src/test/org/apache/lucene/facet/TestDrillDownQuery.java b/lucene/facet/src/test/org/apache/lucene/facet/TestDrillDownQuery.java
index 3f7f18d..8f216f3 100644
--- a/lucene/facet/src/test/org/apache/lucene/facet/TestDrillDownQuery.java
+++ b/lucene/facet/src/test/org/apache/lucene/facet/TestDrillDownQuery.java
@@ -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 =
diff --git a/lucene/highlighter/src/java/org/apache/lucene/search/uhighlight/LengthGoalBreakIterator.java b/lucene/highlighter/src/java/org/apache/lucene/search/uhighlight/LengthGoalBreakIterator.java
index 1f9fe1e..8f6a148 100644
--- a/lucene/highlighter/src/java/org/apache/lucene/search/uhighlight/LengthGoalBreakIterator.java
+++ b/lucene/highlighter/src/java/org/apache/lucene/search/uhighlight/LengthGoalBreakIterator.java
@@ -51,14 +51,6 @@ public class LengthGoalBreakIterator extends BreakIterator {
   }
 
   /**
-   * 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
    * much as possible.
@@ -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,
diff --git a/lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestLengthGoalBreakIterator.java b/lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestLengthGoalBreakIterator.java
index 85d467d..bc54425 100644
--- a/lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestLengthGoalBreakIterator.java
+++ b/lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestLengthGoalBreakIterator.java
@@ -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 {
diff --git a/lucene/join/src/java/org/apache/lucene/search/join/BlockJoinSelector.java b/lucene/join/src/java/org/apache/lucene/search/join/BlockJoinSelector.java
index 5bd780b..c8e0d6d 100644
--- a/lucene/join/src/java/org/apache/lucene/search/join/BlockJoinSelector.java
+++ b/lucene/join/src/java/org/apache/lucene/search/join/BlockJoinSelector.java
@@ -86,16 +86,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.
-   */
   public static SortedDocValues wrap(
       SortedSetDocValues sortedSet, Type selection, BitSet parents, DocIdSetIterator children) {
     SortedDocValues values;