Skip to content

Commit

Permalink
HSEARCH-5010 Upgrade to Lucene 9.9-SNAPSHOT
Browse files Browse the repository at this point in the history
  • Loading branch information
marko-bekhta committed Nov 10, 2023
1 parent a47f8c2 commit 8d79f91
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.DoubleComparator;

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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -129,11 +130,11 @@ public IndexableField createSortedDocValuesField(String absoluteFieldPath, Doubl

@Override
public FieldComparator<Double> 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 );
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -129,11 +130,11 @@ public IndexableField createSortedDocValuesField(String absoluteFieldPath, Float

@Override
public FieldComparator<Float> 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 );
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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<Integer> {
Expand Down Expand Up @@ -122,10 +123,10 @@ public IndexableField createSortedDocValuesField(String absoluteFieldPath, Integ

@Override
public FieldComparator<Integer> 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 );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<Long> {
Expand Down Expand Up @@ -122,10 +123,10 @@ public IndexableField createSortedDocValuesField(String absoluteFieldPath, Long

@Override
public FieldComparator<Long> 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 );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<E extends Number> {
Expand Down Expand Up @@ -54,6 +55,6 @@ Facets createRangeFacetCounts(String absoluteFieldPath,
IndexableField createSortedDocValuesField(String absoluteFieldPath, E numericValue);

FieldComparator<E> createFieldComparator(String absoluteFieldPath, int numHits,
E missingValue, boolean reversed, boolean enableSkipping, MultiValueMode multiValueMode,
E missingValue, boolean reversed, Pruning pruning, MultiValueMode multiValueMode,
NestedDocsProvider nestedDocsProvider);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<E extends Number> extends LuceneFieldComparatorSource {
Expand All @@ -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 );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion build/parents/build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

<!-- >>> Lucene -->
<!-- When upgrading Lucene, make sure to align the dependency to com.carrotsearch.hppc (see below) -->
<version.org.apache.lucene>9.8.0</version.org.apache.lucene>
<version.org.apache.lucene>9.9.0-SNAPSHOT</version.org.apache.lucene>
<javadoc.org.apache.lucene.tag>${parsed-version.org.apache.lucene.majorVersion}_${parsed-version.org.apache.lucene.minorVersion}_${parsed-version.org.apache.lucene.incrementalVersion}</javadoc.org.apache.lucene.tag>
<javadoc.org.apache.lucene.core.url>https://lucene.apache.org/core/${javadoc.org.apache.lucene.tag}/core/</javadoc.org.apache.lucene.core.url>
<javadoc.org.apache.lucene.analyzers-common.url>https://lucene.apache.org/core/${javadoc.org.apache.lucene.tag}/analyzers-common/</javadoc.org.apache.lucene.analyzers-common.url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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" );
}
}
Expand Down

0 comments on commit 8d79f91

Please sign in to comment.