diff --git a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/lowlevel/comparator/impl/DoubleValuesSourceComparator.java b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/lowlevel/comparator/impl/DoubleValuesSourceComparator.java index 76ae9962090..7bdd2478a4b 100644 --- a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/lowlevel/comparator/impl/DoubleValuesSourceComparator.java +++ b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/lowlevel/comparator/impl/DoubleValuesSourceComparator.java @@ -13,6 +13,7 @@ import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.index.NumericDocValues; import org.apache.lucene.search.LeafFieldComparator; +import org.apache.lucene.search.Pruning; import org.apache.lucene.search.comparators.DoubleComparator; public class DoubleValuesSourceComparator extends DoubleComparator { @@ -20,8 +21,8 @@ public class DoubleValuesSourceComparator extends DoubleComparator { private final DoubleMultiValuesToSingleValuesSource source; public DoubleValuesSourceComparator(int numHits, String field, Double missingValue, boolean reversed, - boolean enableSkipping, DoubleMultiValuesToSingleValuesSource source) { - super( numHits, field, missingValue, reversed, enableSkipping ); + Pruning pruning, DoubleMultiValuesToSingleValuesSource source) { + super( numHits, field, missingValue, reversed, pruning ); this.source = source; } @@ -33,6 +34,7 @@ public LeafFieldComparator getLeafComparator(LeafReaderContext context) throws I private class DoubleValuesSourceLeafComparator extends DoubleLeafComparator { DoubleValuesSourceLeafComparator(LeafReaderContext context) throws IOException { super( context ); + disableSkipping(); } @Override diff --git a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/lowlevel/comparator/impl/FloatValuesSourceComparator.java b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/lowlevel/comparator/impl/FloatValuesSourceComparator.java index cc53767ade6..62c697aaa60 100644 --- a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/lowlevel/comparator/impl/FloatValuesSourceComparator.java +++ b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/lowlevel/comparator/impl/FloatValuesSourceComparator.java @@ -13,15 +13,16 @@ import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.index.NumericDocValues; import org.apache.lucene.search.LeafFieldComparator; +import org.apache.lucene.search.Pruning; import org.apache.lucene.search.comparators.FloatComparator; public class FloatValuesSourceComparator extends FloatComparator { private final DoubleMultiValuesToSingleValuesSource source; - public FloatValuesSourceComparator(int numHits, String field, Float missingValue, boolean reversed, boolean enableSkipping, + public FloatValuesSourceComparator(int numHits, String field, Float missingValue, boolean reversed, Pruning pruning, DoubleMultiValuesToSingleValuesSource source) { - super( numHits, field, missingValue, reversed, enableSkipping ); + super( numHits, field, missingValue, reversed, pruning ); this.source = source; } @@ -33,6 +34,7 @@ public LeafFieldComparator getLeafComparator(LeafReaderContext context) throws I private class FloatValuesSourceLeafComparator extends FloatLeafComparator { FloatValuesSourceLeafComparator(LeafReaderContext context) throws IOException { super( context ); + disableSkipping(); } @Override diff --git a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/lowlevel/comparator/impl/IntValuesSourceComparator.java b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/lowlevel/comparator/impl/IntValuesSourceComparator.java index c999822b8e7..c6720f91207 100644 --- a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/lowlevel/comparator/impl/IntValuesSourceComparator.java +++ b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/lowlevel/comparator/impl/IntValuesSourceComparator.java @@ -13,15 +13,16 @@ import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.index.NumericDocValues; import org.apache.lucene.search.LeafFieldComparator; +import org.apache.lucene.search.Pruning; import org.apache.lucene.search.comparators.IntComparator; public class IntValuesSourceComparator extends IntComparator { private final LongMultiValuesToSingleValuesSource source; - public IntValuesSourceComparator(int numHits, String field, Integer missingValue, boolean reversed, boolean enableSkipping, + public IntValuesSourceComparator(int numHits, String field, Integer missingValue, boolean reversed, Pruning pruning, LongMultiValuesToSingleValuesSource source) { - super( numHits, field, missingValue, reversed, enableSkipping ); + super( numHits, field, missingValue, reversed, pruning ); this.source = source; } @@ -33,6 +34,7 @@ public LeafFieldComparator getLeafComparator(LeafReaderContext context) throws I private class IntValuesSourceLeafComparator extends IntLeafComparator { IntValuesSourceLeafComparator(LeafReaderContext context) throws IOException { super( context ); + disableSkipping(); } @Override diff --git a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/lowlevel/comparator/impl/LongValuesSourceComparator.java b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/lowlevel/comparator/impl/LongValuesSourceComparator.java index fc8d9e1db77..c4ac90c5811 100644 --- a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/lowlevel/comparator/impl/LongValuesSourceComparator.java +++ b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/lowlevel/comparator/impl/LongValuesSourceComparator.java @@ -13,15 +13,16 @@ import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.index.NumericDocValues; import org.apache.lucene.search.LeafFieldComparator; +import org.apache.lucene.search.Pruning; import org.apache.lucene.search.comparators.LongComparator; public class LongValuesSourceComparator extends LongComparator { private final LongMultiValuesToSingleValuesSource source; - public LongValuesSourceComparator(int numHits, String field, Long missingValue, boolean reversed, boolean enableSkipping, + public LongValuesSourceComparator(int numHits, String field, Long missingValue, boolean reversed, Pruning pruning, LongMultiValuesToSingleValuesSource source) { - super( numHits, field, missingValue, reversed, enableSkipping ); + super( numHits, field, missingValue, reversed, pruning ); this.source = source; } @@ -33,6 +34,7 @@ public LeafFieldComparator getLeafComparator(LeafReaderContext context) throws I private class LongValuesSourceLeafComparator extends LongLeafComparator { LongValuesSourceLeafComparator(LeafReaderContext context) throws IOException { super( context ); + disableSkipping(); } @Override diff --git a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/lowlevel/impl/LuceneDoubleDomain.java b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/lowlevel/impl/LuceneDoubleDomain.java index 9ace9fd352c..0e1bd2802db 100644 --- a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/lowlevel/impl/LuceneDoubleDomain.java +++ b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/lowlevel/impl/LuceneDoubleDomain.java @@ -26,6 +26,7 @@ import org.apache.lucene.facet.FacetsCollector; import org.apache.lucene.index.IndexableField; import org.apache.lucene.search.FieldComparator; +import org.apache.lucene.search.Pruning; import org.apache.lucene.search.Query; import org.apache.lucene.util.NumericUtils; @@ -129,11 +130,11 @@ public IndexableField createSortedDocValuesField(String absoluteFieldPath, Doubl @Override public FieldComparator createFieldComparator(String fieldName, int numHits, - Double missingValue, boolean reversed, boolean enableSkipping, MultiValueMode multiValueMode, + Double missingValue, boolean reversed, Pruning pruning, MultiValueMode multiValueMode, NestedDocsProvider nestedDocsProvider) { DoubleMultiValuesToSingleValuesSource source = DoubleMultiValuesToSingleValuesSource .fromDoubleField( fieldName, multiValueMode, nestedDocsProvider ); - return new DoubleValuesSourceComparator( numHits, fieldName, missingValue, reversed, enableSkipping, source ); + return new DoubleValuesSourceComparator( numHits, fieldName, missingValue, reversed, pruning, source ); } } diff --git a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/lowlevel/impl/LuceneFloatDomain.java b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/lowlevel/impl/LuceneFloatDomain.java index 6a00bc0e7db..f8ea707fd4b 100644 --- a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/lowlevel/impl/LuceneFloatDomain.java +++ b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/lowlevel/impl/LuceneFloatDomain.java @@ -26,6 +26,7 @@ import org.apache.lucene.facet.FacetsCollector; import org.apache.lucene.index.IndexableField; import org.apache.lucene.search.FieldComparator; +import org.apache.lucene.search.Pruning; import org.apache.lucene.search.Query; import org.apache.lucene.util.NumericUtils; @@ -129,11 +130,11 @@ public IndexableField createSortedDocValuesField(String absoluteFieldPath, Float @Override public FieldComparator createFieldComparator(String fieldName, int numHits, - Float missingValue, boolean reversed, boolean enableSkipping, MultiValueMode multiValueMode, + Float missingValue, boolean reversed, Pruning pruning, MultiValueMode multiValueMode, NestedDocsProvider nestedDocsProvider) { DoubleMultiValuesToSingleValuesSource source = DoubleMultiValuesToSingleValuesSource.fromFloatField( fieldName, multiValueMode, nestedDocsProvider ); - return new FloatValuesSourceComparator( numHits, fieldName, missingValue, reversed, enableSkipping, source ); + return new FloatValuesSourceComparator( numHits, fieldName, missingValue, reversed, pruning, source ); } } diff --git a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/lowlevel/impl/LuceneIntegerDomain.java b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/lowlevel/impl/LuceneIntegerDomain.java index 35dc0eb6473..16a5974ff78 100644 --- a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/lowlevel/impl/LuceneIntegerDomain.java +++ b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/lowlevel/impl/LuceneIntegerDomain.java @@ -26,6 +26,7 @@ import org.apache.lucene.facet.FacetsCollector; import org.apache.lucene.index.IndexableField; import org.apache.lucene.search.FieldComparator; +import org.apache.lucene.search.Pruning; import org.apache.lucene.search.Query; public class LuceneIntegerDomain implements LuceneNumericDomain { @@ -122,10 +123,10 @@ public IndexableField createSortedDocValuesField(String absoluteFieldPath, Integ @Override public FieldComparator createFieldComparator(String fieldName, int numHits, - Integer missingValue, boolean reversed, boolean enableSkipping, MultiValueMode multiValueMode, + Integer missingValue, boolean reversed, Pruning pruning, MultiValueMode multiValueMode, NestedDocsProvider nestedDocsProvider) { LongMultiValuesToSingleValuesSource source = LongMultiValuesToSingleValuesSource.fromIntField( fieldName, multiValueMode, nestedDocsProvider ); - return new IntValuesSourceComparator( numHits, fieldName, missingValue, reversed, enableSkipping, source ); + return new IntValuesSourceComparator( numHits, fieldName, missingValue, reversed, pruning, source ); } } diff --git a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/lowlevel/impl/LuceneLongDomain.java b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/lowlevel/impl/LuceneLongDomain.java index 63ae1267946..f85e9ac3e16 100644 --- a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/lowlevel/impl/LuceneLongDomain.java +++ b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/lowlevel/impl/LuceneLongDomain.java @@ -26,6 +26,7 @@ import org.apache.lucene.facet.FacetsCollector; import org.apache.lucene.index.IndexableField; import org.apache.lucene.search.FieldComparator; +import org.apache.lucene.search.Pruning; import org.apache.lucene.search.Query; public class LuceneLongDomain implements LuceneNumericDomain { @@ -122,10 +123,10 @@ public IndexableField createSortedDocValuesField(String absoluteFieldPath, Long @Override public FieldComparator createFieldComparator(String fieldName, int numHits, - Long missingValue, boolean reversed, boolean enableSkipping, MultiValueMode multiValueMode, + Long missingValue, boolean reversed, Pruning pruning, MultiValueMode multiValueMode, NestedDocsProvider nestedDocsProvider) { LongMultiValuesToSingleValuesSource source = LongMultiValuesToSingleValuesSource.fromLongField( fieldName, multiValueMode, nestedDocsProvider ); - return new LongValuesSourceComparator( numHits, fieldName, missingValue, reversed, enableSkipping, source ); + return new LongValuesSourceComparator( numHits, fieldName, missingValue, reversed, pruning, source ); } } diff --git a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/lowlevel/impl/LuceneNumericDomain.java b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/lowlevel/impl/LuceneNumericDomain.java index 52971544392..7efc4de4a8f 100644 --- a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/lowlevel/impl/LuceneNumericDomain.java +++ b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/lowlevel/impl/LuceneNumericDomain.java @@ -18,6 +18,7 @@ import org.apache.lucene.facet.FacetsCollector; import org.apache.lucene.index.IndexableField; import org.apache.lucene.search.FieldComparator; +import org.apache.lucene.search.Pruning; import org.apache.lucene.search.Query; public interface LuceneNumericDomain { @@ -54,6 +55,6 @@ Facets createRangeFacetCounts(String absoluteFieldPath, IndexableField createSortedDocValuesField(String absoluteFieldPath, E numericValue); FieldComparator createFieldComparator(String absoluteFieldPath, int numHits, - E missingValue, boolean reversed, boolean enableSkipping, MultiValueMode multiValueMode, + E missingValue, boolean reversed, Pruning pruning, MultiValueMode multiValueMode, NestedDocsProvider nestedDocsProvider); } diff --git a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/sort/comparatorsource/impl/LuceneGeoPointDistanceComparatorSource.java b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/sort/comparatorsource/impl/LuceneGeoPointDistanceComparatorSource.java index 007de9225f5..d774cb42853 100644 --- a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/sort/comparatorsource/impl/LuceneGeoPointDistanceComparatorSource.java +++ b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/sort/comparatorsource/impl/LuceneGeoPointDistanceComparatorSource.java @@ -12,6 +12,7 @@ import org.hibernate.search.engine.spatial.GeoPoint; import org.apache.lucene.search.FieldComparator; +import org.apache.lucene.search.Pruning; import org.apache.lucene.search.Query; public class LuceneGeoPointDistanceComparatorSource extends LuceneFieldComparatorSource { @@ -29,11 +30,11 @@ public LuceneGeoPointDistanceComparatorSource(String nestedDocumentPath, GeoPoin } @Override - public FieldComparator newComparator(String fieldname, int numHits, boolean enableSkipping, boolean reversed) { + public FieldComparator newComparator(String fieldname, int numHits, Pruning pruning, boolean reversed) { GeoPointDistanceMultiValuesToSingleValuesSource source = new GeoPointDistanceMultiValuesToSingleValuesSource( fieldname, mode, nestedDocsProvider, center ); // forcing to not skipping documents - return new DoubleValuesSourceComparator( numHits, fieldname, missingValue, reversed, false, source ); + return new DoubleValuesSourceComparator( numHits, fieldname, missingValue, reversed, Pruning.NONE, source ); } } diff --git a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/sort/comparatorsource/impl/LuceneNumericFieldComparatorSource.java b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/sort/comparatorsource/impl/LuceneNumericFieldComparatorSource.java index 55adae16014..064ab2d007a 100644 --- a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/sort/comparatorsource/impl/LuceneNumericFieldComparatorSource.java +++ b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/sort/comparatorsource/impl/LuceneNumericFieldComparatorSource.java @@ -10,6 +10,7 @@ import org.hibernate.search.backend.lucene.types.lowlevel.impl.LuceneNumericDomain; import org.apache.lucene.search.FieldComparator; +import org.apache.lucene.search.Pruning; import org.apache.lucene.search.Query; public class LuceneNumericFieldComparatorSource extends LuceneFieldComparatorSource { @@ -27,8 +28,8 @@ public LuceneNumericFieldComparatorSource(String nestedDocumentPath, LuceneNumer } @Override - public FieldComparator newComparator(String fieldname, int numHits, boolean enableSkipping, boolean reversed) { - return numericDomain.createFieldComparator( fieldname, numHits, missingValue, reversed, enableSkipping, + public FieldComparator newComparator(String fieldname, int numHits, Pruning pruning, boolean reversed) { + return numericDomain.createFieldComparator( fieldname, numHits, missingValue, reversed, pruning, sortMode, nestedDocsProvider ); } } diff --git a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/sort/comparatorsource/impl/LuceneTextFieldComparatorSource.java b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/sort/comparatorsource/impl/LuceneTextFieldComparatorSource.java index ea2ee8fb963..21e783ee926 100644 --- a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/sort/comparatorsource/impl/LuceneTextFieldComparatorSource.java +++ b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/types/sort/comparatorsource/impl/LuceneTextFieldComparatorSource.java @@ -16,6 +16,7 @@ import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.index.SortedDocValues; import org.apache.lucene.search.FieldComparator; +import org.apache.lucene.search.Pruning; import org.apache.lucene.search.Query; import org.apache.lucene.search.comparators.TermOrdValComparator; import org.apache.lucene.util.BytesRef; @@ -33,7 +34,7 @@ public LuceneTextFieldComparatorSource(String nestedDocumentPath, Object missing } @Override - public FieldComparator newComparator(String fieldname, int numHits, boolean enableSkipping, boolean reversed) { + public FieldComparator newComparator(String fieldname, int numHits, Pruning pruning, boolean reversed) { final boolean considerMissingHighest; if ( SortMissingValue.MISSING_LOWEST.equals( missingValue ) ) { considerMissingHighest = false; @@ -53,7 +54,7 @@ else if ( SortMissingValue.MISSING_LAST.equals( missingValue ) ) { TextMultiValuesToSingleValuesSource.fromField( fieldname, multiValueMode, nestedDocsProvider ); // forcing to not skipping documents - return new TermOrdValComparator( numHits, fieldname, considerMissingHighest, reversed, false ) { + return new TermOrdValComparator( numHits, fieldname, considerMissingHighest, reversed, Pruning.NONE ) { @Override protected SortedDocValues getSortedDocValues(LeafReaderContext context, String field) throws IOException { SortedDocValues sortedDocValues = source.getValues( context ); diff --git a/build/parents/build/pom.xml b/build/parents/build/pom.xml index 181022e3803..0afc70de39b 100644 --- a/build/parents/build/pom.xml +++ b/build/parents/build/pom.xml @@ -30,7 +30,7 @@ - 9.8.0 + 10.0.0-SNAPSHOT ${parsed-version.org.apache.lucene.majorVersion}_${parsed-version.org.apache.lucene.minorVersion}_${parsed-version.org.apache.lucene.incrementalVersion} https://lucene.apache.org/core/${javadoc.org.apache.lucene.tag}/core/ https://lucene.apache.org/core/${javadoc.org.apache.lucene.tag}/analyzers-common/ diff --git a/integrationtest/v5migrationhelper/orm/src/test/java/org/hibernate/search/test/query/sorting/SortTest.java b/integrationtest/v5migrationhelper/orm/src/test/java/org/hibernate/search/test/query/sorting/SortTest.java index 4207e950e40..b780df43a35 100644 --- a/integrationtest/v5migrationhelper/orm/src/test/java/org/hibernate/search/test/query/sorting/SortTest.java +++ b/integrationtest/v5migrationhelper/orm/src/test/java/org/hibernate/search/test/query/sorting/SortTest.java @@ -47,6 +47,7 @@ import org.apache.lucene.search.FieldComparator; import org.apache.lucene.search.FieldComparatorSource; import org.apache.lucene.search.MatchAllDocsQuery; +import org.apache.lucene.search.Pruning; import org.apache.lucene.search.Query; import org.apache.lucene.search.SimpleFieldComparator; import org.apache.lucene.search.Sort; @@ -485,7 +486,7 @@ public String toString() { public static class SumFieldComparatorSource extends FieldComparatorSource { @Override - public FieldComparator newComparator(String fieldName, int numHits, boolean enableSkipping, boolean reversed) { + public FieldComparator newComparator(String fieldName, int numHits, Pruning pruning, boolean reversed) { return new SumFieldComparator( numHits, "num1", "num2" ); } } diff --git a/util/internal/integrationtest/backend/lucene/src/main/java/org/hibernate/search/util/impl/integrationtest/backend/lucene/directory/TrackingDirectory.java b/util/internal/integrationtest/backend/lucene/src/main/java/org/hibernate/search/util/impl/integrationtest/backend/lucene/directory/TrackingDirectory.java index 0361e5aec59..558103cca08 100644 --- a/util/internal/integrationtest/backend/lucene/src/main/java/org/hibernate/search/util/impl/integrationtest/backend/lucene/directory/TrackingDirectory.java +++ b/util/internal/integrationtest/backend/lucene/src/main/java/org/hibernate/search/util/impl/integrationtest/backend/lucene/directory/TrackingDirectory.java @@ -76,8 +76,8 @@ public IndexInput openInput(String name, IOContext context) throws IOException { } @Override - public ChecksumIndexInput openChecksumInput(String name, IOContext context) throws IOException { - return new TrackingChecksumIndexInput( delegate.openChecksumInput( name, context ), tracker ); + public ChecksumIndexInput openChecksumInput(String name) throws IOException { + return new TrackingChecksumIndexInput( delegate.openChecksumInput( name ), tracker ); } @Override