Skip to content

Apache Lucene open-source search software

LUCENE-8638: remove deprecated Legacy*DocValues* classes in org.apache.lucene.codecs.memory package (#198)

Christine Poerschke167bd99c2352
diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacyBinaryDocValues.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacyBinaryDocValues.java
deleted file mode 100644
index c7a82f7883b..00000000000
--- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacyBinaryDocValues.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.lucene.codecs.memory;
-
-import org.apache.lucene.index.BinaryDocValues;
-import org.apache.lucene.util.BytesRef;
-
-/**
- * A per-document byte[]
- *
- * @deprecated Use {@link BinaryDocValues} instead.
- */
-@Deprecated
-abstract class LegacyBinaryDocValues {
-
- /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
- protected LegacyBinaryDocValues() {}
-
- /**
- * Lookup the value for document. The returned {@link BytesRef} may be re-used across calls to
- * {@link #get(int)} so make sure to {@link BytesRef#deepCopyOf(BytesRef) copy it} if you want to
- * keep it around.
- */
- public abstract BytesRef get(int docID);
-}
diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacyBinaryDocValuesWrapper.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacyBinaryDocValuesWrapper.java
deleted file mode 100644
index 25fdde180bb..00000000000
--- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacyBinaryDocValuesWrapper.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.lucene.codecs.memory;
-
-import java.io.IOException;
-import org.apache.lucene.index.BinaryDocValues;
-import org.apache.lucene.util.Bits;
-import org.apache.lucene.util.BytesRef;
-
-/**
- * Wraps a {@link LegacyBinaryDocValues} into a {@link BinaryDocValues}.
- *
- * @deprecated Implement {@link BinaryDocValues} directly.
- */
-@Deprecated
-final class LegacyBinaryDocValuesWrapper extends BinaryDocValues {
- private final Bits docsWithField;
- private final LegacyBinaryDocValues values;
- private final int maxDoc;
- private int docID = -1;
-
- public LegacyBinaryDocValuesWrapper(Bits docsWithField, LegacyBinaryDocValues values) {
- this.docsWithField = docsWithField;
- this.values = values;
- this.maxDoc = docsWithField.length();
- }
-
- @Override
- public int docID() {
- return docID;
- }
-
- @Override
- public int nextDoc() {
- docID++;
- while (docID < maxDoc) {
- if (docsWithField.get(docID)) {
- return docID;
- }
- docID++;
- }
- docID = NO_MORE_DOCS;
- return NO_MORE_DOCS;
- }
-
- @Override
- public int advance(int target) {
- if (target < docID) {
- throw new IllegalArgumentException(
- "cannot advance backwards: docID=" + docID + " target=" + target);
- }
- if (target == NO_MORE_DOCS) {
- this.docID = NO_MORE_DOCS;
- } else {
- this.docID = target - 1;
- nextDoc();
- }
- return docID;
- }
-
- @Override
- public boolean advanceExact(int target) throws IOException {
- docID = target;
- return docsWithField.get(target);
- }
-
- @Override
- public long cost() {
- return 0;
- }
-
- @Override
- public BytesRef binaryValue() {
- return values.get(docID);
- }
-}
diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacyDocValuesIterables.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacyDocValuesIterables.java
deleted file mode 100644
index 00eb5065acc..00000000000
--- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacyDocValuesIterables.java
+++ /dev/null
@@ -1,567 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.lucene.codecs.memory;
-
-import static org.apache.lucene.index.SortedSetDocValues.NO_MORE_ORDS;
-import static org.apache.lucene.search.DocIdSetIterator.NO_MORE_DOCS;
-
-import java.io.IOException;
-import java.util.Iterator;
-import org.apache.lucene.codecs.DocValuesProducer;
-import org.apache.lucene.codecs.NormsProducer;
-import org.apache.lucene.index.BinaryDocValues;
-import org.apache.lucene.index.FieldInfo;
-import org.apache.lucene.index.NumericDocValues;
-import org.apache.lucene.index.SortedDocValues;
-import org.apache.lucene.index.SortedNumericDocValues;
-import org.apache.lucene.index.SortedSetDocValues;
-import org.apache.lucene.util.BytesRef;
-
-/** Bridge helper methods for legacy codecs to map sorted doc values to iterables. */
-class LegacyDocValuesIterables {
-
- private LegacyDocValuesIterables() {
- // no
- }
-
- /**
- * Converts {@link SortedDocValues} into an {@code Iterable&lt;BytesRef&gt;} for all the values.
- *
- * @deprecated Consume {@link SortedDocValues} instead.
- */
- @Deprecated
- public static Iterable<BytesRef> valuesIterable(final SortedDocValues values) {
- return new Iterable<BytesRef>() {
- @Override
- public Iterator<BytesRef> iterator() {
- return new Iterator<BytesRef>() {
- private int nextOrd;
-
- @Override
- public boolean hasNext() {
- return nextOrd < values.getValueCount();
- }
-
- @Override
- public BytesRef next() {
- try {
- return values.lookupOrd(nextOrd++);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
- };
- }
- };
- }
-
- /**
- * Converts {@link SortedSetDocValues} into an {@code Iterable&lt;BytesRef&gt;} for all the
- * values.
- *
- * @deprecated Consume {@link SortedSetDocValues} instead.
- */
- @Deprecated
- public static Iterable<BytesRef> valuesIterable(final SortedSetDocValues values) {
- return new Iterable<BytesRef>() {
- @Override
- public Iterator<BytesRef> iterator() {
- return new Iterator<BytesRef>() {
- private long nextOrd;
-
- @Override
- public boolean hasNext() {
- return nextOrd < values.getValueCount();
- }
-
- @Override
- public BytesRef next() {
- try {
- return values.lookupOrd(nextOrd++);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
- };
- }
- };
- }
-
- /**
- * Converts {@link SortedDocValues} into the ord for each document as an {@code
- * Iterable&lt;Number&gt;}.
- *
- * @deprecated Consume {@link SortedDocValues} instead.
- */
- @Deprecated
- public static Iterable<Number> sortedOrdIterable(
- final DocValuesProducer valuesProducer, FieldInfo fieldInfo, int maxDoc) {
- return new Iterable<Number>() {
- @Override
- public Iterator<Number> iterator() {
-
- final SortedDocValues values;
- try {
- values = valuesProducer.getSorted(fieldInfo);
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
-
- return new Iterator<Number>() {
- private int nextDocID;
-
- @Override
- public boolean hasNext() {
- return nextDocID < maxDoc;
- }
-
- @Override
- public Number next() {
- try {
- if (nextDocID > values.docID()) {
- values.nextDoc();
- }
- int result;
- if (nextDocID == values.docID()) {
- result = values.ordValue();
- } else {
- result = -1;
- }
- nextDocID++;
- return result;
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
- }
- };
- }
- };
- }
-
- /**
- * Converts number-of-ords per document from {@link SortedSetDocValues} into {@code
- * Iterable&lt;Number&gt;}.
- *
- * @deprecated Consume {@link SortedSetDocValues} instead.
- */
- @Deprecated
- public static Iterable<Number> sortedSetOrdCountIterable(
- final DocValuesProducer valuesProducer, final FieldInfo fieldInfo, final int maxDoc) {
-
- return new Iterable<Number>() {
-
- @Override
- public Iterator<Number> iterator() {
-
- final SortedSetDocValues values;
- try {
- values = valuesProducer.getSortedSet(fieldInfo);
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
-
- return new Iterator<Number>() {
- private int nextDocID;
- private int ordCount;
-
- @Override
- public boolean hasNext() {
- return nextDocID < maxDoc;
- }
-
- @Override
- public Number next() {
- try {
- if (nextDocID > values.docID()) {
- if (values.nextDoc() != NO_MORE_DOCS) {
- ordCount = 0;
- while (values.nextOrd() != NO_MORE_ORDS) {
- ordCount++;
- }
- }
- }
- int result;
- if (nextDocID == values.docID()) {
- result = ordCount;
- } else {
- result = 0;
- }
- nextDocID++;
- return result;
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
- }
- };
- }
- };
- }
-
- /**
- * Converts all concatenated ords (in docID order) from {@link SortedSetDocValues} into {@code
- * Iterable&lt;Number&gt;}.
- *
- * @deprecated Consume {@link SortedSetDocValues} instead.
- */
- @Deprecated
- public static Iterable<Number> sortedSetOrdsIterable(
- final DocValuesProducer valuesProducer, final FieldInfo fieldInfo) {
-
- return new Iterable<Number>() {
-
- @Override
- public Iterator<Number> iterator() {
-
- final SortedSetDocValues values;
- try {
- values = valuesProducer.getSortedSet(fieldInfo);
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
-
- return new Iterator<Number>() {
- private boolean nextIsSet;
- private long nextOrd;
-
- private void setNext() {
- try {
- if (nextIsSet == false) {
- if (values.docID() == -1) {
- values.nextDoc();
- }
- while (true) {
- if (values.docID() == NO_MORE_DOCS) {
- nextOrd = -1;
- break;
- }
- nextOrd = values.nextOrd();
- if (nextOrd != -1) {
- break;
- }
- values.nextDoc();
- }
- nextIsSet = true;
- }
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
- }
-
- @Override
- public boolean hasNext() {
- setNext();
- return nextOrd != -1;
- }
-
- @Override
- public Number next() {
- setNext();
- assert nextOrd != -1;
- nextIsSet = false;
- return nextOrd;
- }
- };
- }
- };
- }
-
- /**
- * Converts number-of-values per document from {@link SortedNumericDocValues} into {@code
- * Iterable&lt;Number&gt;}.
- *
- * @deprecated Consume {@link SortedDocValues} instead.
- */
- @Deprecated
- public static Iterable<Number> sortedNumericToDocCount(
- final DocValuesProducer valuesProducer, final FieldInfo fieldInfo, int maxDoc) {
- return new Iterable<Number>() {
-
- @Override
- public Iterator<Number> iterator() {
-
- final SortedNumericDocValues values;
- try {
- values = valuesProducer.getSortedNumeric(fieldInfo);
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
-
- return new Iterator<Number>() {
- private int nextDocID;
-
- @Override
- public boolean hasNext() {
- return nextDocID < maxDoc;
- }
-
- @Override
- public Number next() {
- try {
- if (nextDocID > values.docID()) {
- values.nextDoc();
- }
- int result;
- if (nextDocID == values.docID()) {
- result = values.docValueCount();
- } else {
- result = 0;
- }
- nextDocID++;
- return result;
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
- }
- };
- }
- };
- }
-
- /**
- * Converts all concatenated values (in docID order) from {@link SortedNumericDocValues} into
- * {@code Iterable&lt;Number&gt;}.
- *
- * @deprecated Consume {@link SortedDocValues} instead.
- */
- @Deprecated
- public static Iterable<Number> sortedNumericToValues(
- final DocValuesProducer valuesProducer, final FieldInfo fieldInfo) {
- return new Iterable<Number>() {
-
- @Override
- public Iterator<Number> iterator() {
-
- final SortedNumericDocValues values;
- try {
- values = valuesProducer.getSortedNumeric(fieldInfo);
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
-
- return new Iterator<Number>() {
- private boolean nextIsSet;
- private int nextCount;
- private int upto;
- private long nextValue;
-
- private void setNext() {
- try {
- if (nextIsSet == false) {
- if (upto == nextCount) {
- values.nextDoc();
- if (values.docID() == NO_MORE_DOCS) {
- nextCount = 0;
- nextIsSet = false;
- return;
- } else {
- nextCount = values.docValueCount();
- }
- upto = 0;
- }
- nextValue = values.nextValue();
- upto++;
- nextIsSet = true;
- }
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
- }
-
- @Override
- public boolean hasNext() {
- setNext();
- return nextCount != 0;
- }
-
- @Override
- public Number next() {
- setNext();
- assert nextCount != 0;
- nextIsSet = false;
- return nextValue;
- }
- };
- }
- };
- }
-
- /**
- * Converts norms into {@code Iterable&lt;Number&gt;}.
- *
- * @deprecated Consume {@link NumericDocValues} instead.
- */
- @Deprecated
- public static Iterable<Number> normsIterable(
- final FieldInfo field, final NormsProducer normsProducer, final int maxDoc) {
-
- return new Iterable<Number>() {
-
- @Override
- public Iterator<Number> iterator() {
-
- final NumericDocValues values;
- try {
- values = normsProducer.getNorms(field);
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
-
- return new Iterator<Number>() {
- private int docIDUpto = -1;
-
- @Override
- public boolean hasNext() {
- return docIDUpto + 1 < maxDoc;
- }
-
- @Override
- public Number next() {
- docIDUpto++;
- if (docIDUpto > values.docID()) {
- try {
- values.nextDoc();
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
- }
- Number result;
- if (docIDUpto == values.docID()) {
- try {
- result = values.longValue();
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
- } else {
- // Unlike NumericDocValues, norms used to return 0 for missing values:
- result = 0;
- }
- return result;
- }
- };
- }
- };
- }
-
- /**
- * Converts values from {@link BinaryDocValues} into {@code Iterable&lt;BytesRef&gt;}.
- *
- * @deprecated Consume {@link BinaryDocValues} instead.
- */
- @Deprecated
- public static Iterable<BytesRef> binaryIterable(
- final FieldInfo field, final DocValuesProducer valuesProducer, final int maxDoc) {
- return new Iterable<BytesRef>() {
- @Override
- public Iterator<BytesRef> iterator() {
-
- final BinaryDocValues values;
- try {
- values = valuesProducer.getBinary(field);
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
-
- return new Iterator<BytesRef>() {
- private int docIDUpto = -1;
-
- @Override
- public boolean hasNext() {
- return docIDUpto + 1 < maxDoc;
- }
-
- @Override
- public BytesRef next() {
- docIDUpto++;
- if (docIDUpto > values.docID()) {
- try {
- values.nextDoc();
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
- }
- BytesRef result;
- if (docIDUpto == values.docID()) {
- try {
- result = values.binaryValue();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- } else {
- result = null;
- }
- return result;
- }
- };
- }
- };
- }
-
- /**
- * Converts values from {@link NumericDocValues} into {@code Iterable&lt;Number&gt;}.
- *
- * @deprecated Consume {@link NumericDocValues} instead.
- */
- @Deprecated
- public static Iterable<Number> numericIterable(
- final FieldInfo field, final DocValuesProducer valuesProducer, final int maxDoc) {
- return new Iterable<Number>() {
- @Override
- public Iterator<Number> iterator() {
-
- final NumericDocValues values;
- try {
- values = valuesProducer.getNumeric(field);
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
-
- return new Iterator<Number>() {
- private int docIDUpto = -1;
-
- @Override
- public boolean hasNext() {
- return docIDUpto + 1 < maxDoc;
- }
-
- @Override
- public Number next() {
- docIDUpto++;
- if (docIDUpto > values.docID()) {
- try {
- values.nextDoc();
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
- }
- Number result;
- if (docIDUpto == values.docID()) {
- try {
- result = values.longValue();
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
- } else {
- result = null;
- }
- return result;
- }
- };
- }
- };
- }
-}
diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacyNumericDocValues.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacyNumericDocValues.java
deleted file mode 100644
index debc0de698d..00000000000
--- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacyNumericDocValues.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.lucene.codecs.memory;
-
-import org.apache.lucene.index.NumericDocValues;
-
-/**
- * A per-document numeric value.
- *
- * @deprecated Use {@link NumericDocValues} instead.
- */
-@Deprecated
-abstract class LegacyNumericDocValues {
-
- /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
- protected LegacyNumericDocValues() {}
-
- /**
- * Returns the numeric value for the specified document ID.
- *
- * @param docID document ID to lookup
- * @return numeric value
- */
- public abstract long get(int docID);
-}
diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacyNumericDocValuesWrapper.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacyNumericDocValuesWrapper.java
deleted file mode 100644
index f77e936bd57..00000000000
--- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacyNumericDocValuesWrapper.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.lucene.codecs.memory;
-
-import java.io.IOException;
-import org.apache.lucene.index.NumericDocValues;
-import org.apache.lucene.util.Bits;
-
-/**
- * Wraps a {@link LegacyNumericDocValues} into a {@link NumericDocValues}.
- *
- * @deprecated Implement {@link NumericDocValues} directly.
- */
-@Deprecated
-final class LegacyNumericDocValuesWrapper extends NumericDocValues {
- private final Bits docsWithField;
- private final LegacyNumericDocValues values;
- private final int maxDoc;
- private int docID = -1;
- private long value;
-
- public LegacyNumericDocValuesWrapper(Bits docsWithField, LegacyNumericDocValues values) {
- this.docsWithField = docsWithField;
- this.values = values;
- this.maxDoc = docsWithField.length();
- }
-
- @Override
- public int docID() {
- return docID;
- }
-
- @Override
- public int nextDoc() {
- docID++;
- while (docID < maxDoc) {
- value = values.get(docID);
- if (value != 0 || docsWithField.get(docID)) {
- return docID;
- }
- docID++;
- }
- docID = NO_MORE_DOCS;
- return NO_MORE_DOCS;
- }
-
- @Override
- public int advance(int target) {
- assert target >= docID : "target=" + target + " docID=" + docID;
- if (target == NO_MORE_DOCS) {
- this.docID = NO_MORE_DOCS;
- } else {
- this.docID = target - 1;
- nextDoc();
- }
- return docID;
- }
-
- @Override
- public boolean advanceExact(int target) throws IOException {
- docID = target;
- value = values.get(docID);
- return value != 0 || docsWithField.get(docID);
- }
-
- @Override
- public long cost() {
- // TODO
- return 0;
- }
-
- @Override
- public long longValue() {
- return value;
- }
-
- @Override
- public String toString() {
- return "LegacyNumericDocValuesWrapper(" + values + ")";
- }
-}
diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacySortedDocValues.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacySortedDocValues.java
deleted file mode 100644
index 8587e690e6a..00000000000
--- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacySortedDocValues.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.lucene.codecs.memory;
-
-import org.apache.lucene.index.SortedDocValues;
-import org.apache.lucene.index.TermsEnum;
-import org.apache.lucene.util.BytesRef;
-
-/**
- * A per-document byte[] with presorted values.
- *
- * <p>Per-Document values in a SortedDocValues are deduplicated, dereferenced, and sorted into a
- * dictionary of unique values. A pointer to the dictionary value (ordinal) can be retrieved for
- * each document. Ordinals are dense and in increasing sorted order.
- *
- * @deprecated Use {@link SortedDocValues} instead.
- */
-@Deprecated
-abstract class LegacySortedDocValues extends LegacyBinaryDocValues {
-
- /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
- protected LegacySortedDocValues() {}
-
- /**
- * Returns the ordinal for the specified docID.
- *
- * @param docID document ID to lookup
- * @return ordinal for the document: this is dense, starts at 0, then increments by 1 for the next
- * value in sorted order. Note that missing values are indicated by -1.
- */
- public abstract int getOrd(int docID);
-
- /**
- * Retrieves the value for the specified ordinal. The returned {@link BytesRef} may be re-used
- * across calls to {@link #lookupOrd(int)} so make sure to {@link BytesRef#deepCopyOf(BytesRef)
- * copy it} if you want to keep it around.
- *
- * @param ord ordinal to lookup (must be &gt;= 0 and &lt; {@link #getValueCount()})
- * @see #getOrd(int)
- */
- public abstract BytesRef lookupOrd(int ord);
-
- /**
- * Returns the number of unique values.
- *
- * @return number of unique values in this SortedDocValues. This is also equivalent to one plus
- * the maximum ordinal.
- */
- public abstract int getValueCount();
-
- private final BytesRef empty = new BytesRef();
-
- @Override
- public BytesRef get(int docID) {
- int ord = getOrd(docID);
- if (ord == -1) {
- return empty;
- } else {
- return lookupOrd(ord);
- }
- }
-
- /**
- * If {@code key} exists, returns its ordinal, else returns {@code -insertionPoint-1}, like {@code
- * Arrays.binarySearch}.
- *
- * @param key Key to look up
- */
- public int lookupTerm(BytesRef key) {
- int low = 0;
- int high = getValueCount() - 1;
-
- while (low <= high) {
- int mid = (low + high) >>> 1;
- final BytesRef term = lookupOrd(mid);
- int cmp = term.compareTo(key);
-
- if (cmp < 0) {
- low = mid + 1;
- } else if (cmp > 0) {
- high = mid - 1;
- } else {
- return mid; // key found
- }
- }
-
- return -(low + 1); // key not found.
- }
-
- /**
- * Returns a {@link TermsEnum} over the values. The enum supports {@link TermsEnum#ord()} and
- * {@link TermsEnum#seekExact(long)}.
- */
- public TermsEnum termsEnum() {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacySortedDocValuesWrapper.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacySortedDocValuesWrapper.java
deleted file mode 100644
index 5e092371f39..00000000000
--- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacySortedDocValuesWrapper.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.lucene.codecs.memory;
-
-import java.io.IOException;
-import org.apache.lucene.index.SortedDocValues;
-import org.apache.lucene.util.BytesRef;
-
-/**
- * Wraps a {@link LegacySortedDocValues} into a {@link SortedDocValues}.
- *
- * @deprecated Implement {@link SortedDocValues} directly.
- */
-@Deprecated
-final class LegacySortedDocValuesWrapper extends SortedDocValues {
- private final LegacySortedDocValues values;
- private final int maxDoc;
- private int docID = -1;
- private int ord;
-
- public LegacySortedDocValuesWrapper(LegacySortedDocValues values, int maxDoc) {
- this.values = values;
- this.maxDoc = maxDoc;
- }
-
- @Override
- public int docID() {
- return docID;
- }
-
- @Override
- public int nextDoc() {
- assert docID != NO_MORE_DOCS;
- docID++;
- while (docID < maxDoc) {
- ord = values.getOrd(docID);
- if (ord != -1) {
- return docID;
- }
- docID++;
- }
- docID = NO_MORE_DOCS;
- return NO_MORE_DOCS;
- }
-
- @Override
- public int advance(int target) {
- if (target < docID) {
- throw new IllegalArgumentException(
- "cannot advance backwards: docID=" + docID + " target=" + target);
- }
- if (target >= maxDoc) {
- this.docID = NO_MORE_DOCS;
- } else {
- this.docID = target - 1;
- nextDoc();
- }
- return docID;
- }
-
- @Override
- public boolean advanceExact(int target) throws IOException {
- docID = target;
- ord = values.getOrd(docID);
- return ord != -1;
- }
-
- @Override
- public long cost() {
- return 0;
- }
-
- @Override
- public int ordValue() {
- return ord;
- }
-
- @Override
- public BytesRef lookupOrd(int ord) {
- return values.lookupOrd(ord);
- }
-
- @Override
- public int getValueCount() {
- return values.getValueCount();
- }
-}
diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacySortedNumericDocValues.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacySortedNumericDocValues.java
deleted file mode 100644
index 4b70389370f..00000000000
--- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacySortedNumericDocValues.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.lucene.codecs.memory;
-
-import org.apache.lucene.index.SortedNumericDocValues;
-
-/**
- * A list of per-document numeric values, sorted according to {@link Long#compare(long, long)}.
- *
- * @deprecated Use {@link SortedNumericDocValues} instead.
- */
-@Deprecated
-abstract class LegacySortedNumericDocValues {
-
- /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
- protected LegacySortedNumericDocValues() {}
-
- /** Positions to the specified document */
- public abstract void setDocument(int doc);
-
- /**
- * Retrieve the value for the current document at the specified index. An index ranges from {@code
- * 0} to {@code count()-1}.
- */
- public abstract long valueAt(int index);
-
- /**
- * Retrieves the count of values for the current document. This may be zero if a document has no
- * values.
- */
- public abstract int count();
-}
diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacySortedNumericDocValuesWrapper.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacySortedNumericDocValuesWrapper.java
deleted file mode 100644
index e8a209d2cec..00000000000
--- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacySortedNumericDocValuesWrapper.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.lucene.codecs.memory;
-
-import java.io.IOException;
-import org.apache.lucene.index.SortedNumericDocValues;
-
-/**
- * Wraps a {@link LegacySortedNumericDocValues} into a {@link SortedNumericDocValues}.
- *
- * @deprecated Implement {@link SortedNumericDocValues} directly.
- */
-@Deprecated
-final class LegacySortedNumericDocValuesWrapper extends SortedNumericDocValues {
- private final LegacySortedNumericDocValues values;
- private final int maxDoc;
- private int docID = -1;
- private int upto;
-
- public LegacySortedNumericDocValuesWrapper(LegacySortedNumericDocValues values, int maxDoc) {
- this.values = values;
- this.maxDoc = maxDoc;
- }
-
- @Override
- public int docID() {
- return docID;
- }
-
- @Override
- public int nextDoc() {
- assert docID != NO_MORE_DOCS;
- while (true) {
- docID++;
- if (docID == maxDoc) {
- docID = NO_MORE_DOCS;
- break;
- }
- values.setDocument(docID);
- if (values.count() != 0) {
- break;
- }
- }
- upto = 0;
- return docID;
- }
-
- @Override
- public int advance(int target) {
- if (target < docID) {
- throw new IllegalArgumentException(
- "cannot advance backwards: docID=" + docID + " target=" + target);
- }
- if (target >= maxDoc) {
- docID = NO_MORE_DOCS;
- } else {
- docID = target - 1;
- nextDoc();
- }
- return docID;
- }
-
- @Override
- public boolean advanceExact(int target) throws IOException {
- docID = target;
- values.setDocument(docID);
- upto = 0;
- return values.count() != 0;
- }
-
- @Override
- public long cost() {
- return 0;
- }
-
- @Override
- public long nextValue() {
- return values.valueAt(upto++);
- }
-
- @Override
- public int docValueCount() {
- return values.count();
- }
-}
diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacySortedSetDocValues.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacySortedSetDocValues.java
deleted file mode 100644
index b4cc3339eea..00000000000
--- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacySortedSetDocValues.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.lucene.codecs.memory;
-
-import java.io.IOException;
-import org.apache.lucene.index.SortedSetDocValues;
-import org.apache.lucene.index.TermsEnum;
-import org.apache.lucene.util.BytesRef;
-
-/**
- * A per-document set of presorted byte[] values.
- *
- * <p>Per-Document values in a SortedDocValues are deduplicated, dereferenced, and sorted into a
- * dictionary of unique values. A pointer to the dictionary value (ordinal) can be retrieved for
- * each document. Ordinals are dense and in increasing sorted order.
- *
- * @deprecated Use {@link SortedSetDocValues} instead.
- */
-@Deprecated
-abstract class LegacySortedSetDocValues {
-
- /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
- protected LegacySortedSetDocValues() {}
-
- /** When returned by {@link #nextOrd()} it means there are no more ordinals for the document. */
- public static final long NO_MORE_ORDS = -1;
-
- /**
- * Returns the next ordinal for the current document (previously set by {@link #setDocument(int)}.
- *
- * @return next ordinal for the document, or {@link #NO_MORE_ORDS}. ordinals are dense, start at
- * 0, then increment by 1 for the next value in sorted order.
- */
- public abstract long nextOrd();
-
- /**
- * Sets iteration to the specified docID
- *
- * @param docID document ID
- */
- public abstract void setDocument(int docID);
-
- /**
- * Retrieves the value for the specified ordinal. The returned {@link BytesRef} may be re-used
- * across calls to lookupOrd so make sure to {@link BytesRef#deepCopyOf(BytesRef) copy it} if you
- * want to keep it around.
- *
- * @param ord ordinal to lookup
- * @see #nextOrd
- */
- public abstract BytesRef lookupOrd(long ord);
-
- /**
- * Returns the number of unique values.
- *
- * @return number of unique values in this SortedDocValues. This is also equivalent to one plus
- * the maximum ordinal.
- */
- public abstract long getValueCount();
-
- /**
- * If {@code key} exists, returns its ordinal, else returns {@code -insertionPoint-1}, like {@code
- * Arrays.binarySearch}.
- *
- * @param key Key to look up
- */
- public long lookupTerm(BytesRef key) {
- long low = 0;
- long high = getValueCount() - 1;
-
- while (low <= high) {
- long mid = (low + high) >>> 1;
- final BytesRef term = lookupOrd(mid);
- int cmp = term.compareTo(key);
-
- if (cmp < 0) {
- low = mid + 1;
- } else if (cmp > 0) {
- high = mid - 1;
- } else {
- return mid; // key found
- }
- }
-
- return -(low + 1); // key not found.
- }
-
- /**
- * Returns a {@link TermsEnum} over the values. The enum supports {@link TermsEnum#ord()} and
- * {@link TermsEnum#seekExact(long)}.
- */
- public TermsEnum termsEnum() throws IOException {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacySortedSetDocValuesWrapper.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacySortedSetDocValuesWrapper.java
deleted file mode 100644
index eff1b7255e5..00000000000
--- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/LegacySortedSetDocValuesWrapper.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.lucene.codecs.memory;
-
-import java.io.IOException;
-import org.apache.lucene.index.SortedSetDocValues;
-import org.apache.lucene.util.BytesRef;
-
-/**
- * Wraps a {@link LegacySortedSetDocValues} into a {@link SortedSetDocValues}.
- *
- * @deprecated Implement {@link SortedSetDocValues} directly.
- */
-@Deprecated
-final class LegacySortedSetDocValuesWrapper extends SortedSetDocValues {
- private final LegacySortedSetDocValues values;
- private final int maxDoc;
- private int docID = -1;
- private long ord;
-
- public LegacySortedSetDocValuesWrapper(LegacySortedSetDocValues values, int maxDoc) {
- this.values = values;
- this.maxDoc = maxDoc;
- }
-
- @Override
- public int docID() {
- return docID;
- }
-
- @Override
- public int nextDoc() {
- assert docID != NO_MORE_DOCS;
- docID++;
- while (docID < maxDoc) {
- values.setDocument(docID);
- ord = values.nextOrd();
- if (ord != NO_MORE_ORDS) {
- return docID;
- }
- docID++;
- }
- docID = NO_MORE_DOCS;
- return NO_MORE_DOCS;
- }
-
- @Override
- public int advance(int target) {
- if (target < docID) {
- throw new IllegalArgumentException(
- "cannot advance backwards: docID=" + docID + " target=" + target);
- }
- if (target >= maxDoc) {
- this.docID = NO_MORE_DOCS;
- } else {
- this.docID = target - 1;
- nextDoc();
- }
- return docID;
- }
-
- @Override
- public boolean advanceExact(int target) throws IOException {
- docID = target;
- values.setDocument(docID);
- ord = values.nextOrd();
- return ord != NO_MORE_ORDS;
- }
-
- @Override
- public long cost() {
- return 0;
- }
-
- @Override
- public long nextOrd() {
- long result = ord;
- if (result != NO_MORE_ORDS) {
- ord = values.nextOrd();
- }
- return result;
- }
-
- @Override
- public BytesRef lookupOrd(long ord) {
- return values.lookupOrd((int) ord);
- }
-
- @Override
- public long getValueCount() {
- return values.getValueCount();
- }
-
- @Override
- public String toString() {
- return "LegacySortedSetDocValuesWrapper(" + values + ")";
- }
-}