Skip to content

Commit cc6a7ac

Browse files
committed
[DE-399] added support for ConsolidationPolicy#minScore()
1 parent 6ce90db commit cc6a7ac

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

Diff for: src/main/java/com/arangodb/entity/arangosearch/ConsolidationPolicy.java

+16-2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public class ConsolidationPolicy {
3535
private Long segmentsMax;
3636
private Long segmentsBytesMax;
3737
private Long segmentsBytesFloor;
38+
private Long minScore;
3839

3940

4041
public ConsolidationPolicy() {
@@ -139,16 +140,29 @@ public ConsolidationPolicy segmentsBytesFloor(final Long segmentsBytesFloor) {
139140
return this;
140141
}
141142

143+
public Long getMinScore() {
144+
return minScore;
145+
}
146+
147+
/**
148+
* @param minScore Filter out consolidation candidates with a score less than this. (default: 0)
149+
* @return this
150+
*/
151+
public ConsolidationPolicy minScore(final Long minScore) {
152+
this.minScore = minScore;
153+
return this;
154+
}
155+
142156
@Override
143157
public boolean equals(Object o) {
144158
if (this == o) return true;
145159
if (o == null || getClass() != o.getClass()) return false;
146160
ConsolidationPolicy that = (ConsolidationPolicy) o;
147-
return type == that.type && Objects.equals(threshold, that.threshold) && Objects.equals(segmentThreshold, that.segmentThreshold) && Objects.equals(segmentsMin, that.segmentsMin) && Objects.equals(segmentsMax, that.segmentsMax) && Objects.equals(segmentsBytesMax, that.segmentsBytesMax) && Objects.equals(segmentsBytesFloor, that.segmentsBytesFloor);
161+
return type == that.type && Objects.equals(threshold, that.threshold) && Objects.equals(segmentThreshold, that.segmentThreshold) && Objects.equals(segmentsMin, that.segmentsMin) && Objects.equals(segmentsMax, that.segmentsMax) && Objects.equals(segmentsBytesMax, that.segmentsBytesMax) && Objects.equals(segmentsBytesFloor, that.segmentsBytesFloor) && Objects.equals(minScore, that.minScore);
148162
}
149163

150164
@Override
151165
public int hashCode() {
152-
return Objects.hash(type, threshold, segmentThreshold, segmentsMin, segmentsMax, segmentsBytesMax, segmentsBytesFloor);
166+
return Objects.hash(type, threshold, segmentThreshold, segmentsMin, segmentsMax, segmentsBytesMax, segmentsBytesFloor, minScore);
153167
}
154168
}

Diff for: src/main/java/com/arangodb/internal/velocypack/VPackDeserializers.java

+1
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ protected static FieldLink deserializeField(final Entry<String, VPackSlice> fiel
317317
consolidate.segmentsMax(vpack.get("segmentsMax").getAsLong());
318318
consolidate.segmentsBytesMax(vpack.get("segmentsBytesMax").getAsLong());
319319
consolidate.segmentsBytesFloor(vpack.get("segmentsBytesFloor").getAsLong());
320+
consolidate.minScore(vpack.get("minScore").getAsLong());
320321
}
321322
return consolidate;
322323
};

Diff for: src/test/java/com/arangodb/InvertedIndexTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ private InvertedIndexOptions createOptions(String analyzerName) {
103103
.segmentsMax(44L)
104104
.segmentsBytesMax(55555L)
105105
.segmentsBytesFloor(666L)
106+
.minScore(77L)
106107
)
107108
.writebufferIdle(44L)
108109
.writebufferActive(55L)

0 commit comments

Comments
 (0)