blob: 7d28ae85ad10eaa4f9e050cbf629c42772e63663 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.query.ranking;
import com.yahoo.search.query.Ranking;
import com.yahoo.search.query.profile.types.FieldDescription;
import com.yahoo.search.query.profile.types.FieldType;
import com.yahoo.search.query.profile.types.QueryProfileType;
import java.util.Objects;
/**
* The global-phase ranking settings of this query.
*
* @author arnej
*/
public class GlobalPhase implements Cloneable {
/** The type representing the property arguments consumed by this */
private static final QueryProfileType argumentType;
static {
argumentType = new QueryProfileType(Ranking.GLOBAL_PHASE);
argumentType.setStrict(true);
argumentType.setBuiltin(true);
argumentType.addField(new FieldDescription(Ranking.RERANKCOUNT, FieldType.integerType));
argumentType.freeze();
}
public static QueryProfileType getArgumentType() { return argumentType; }
private Integer rerankCount = null;
/**
* Sets the number of hits for which the global-phase function will be evaluated.
* When set, this overrides the setting in the rank profile.
*/
public void setRerankCount(int rerankCount) { this.rerankCount = rerankCount; }
/** Returns the rerank-count that will be used, or null if not set */
public Integer getRerankCount() { return rerankCount; }
@Override
public int hashCode() {
return Objects.hashCode(this.rerankCount);
}
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o instanceof GlobalPhase other) {
if ( ! Objects.equals(this.rerankCount, other.rerankCount)) return false;
return true;
}
return false;
}
@Override
public GlobalPhase clone() {
try {
GlobalPhase clone = (GlobalPhase)super.clone();
clone.rerankCount = this.rerankCount;
return clone;
}
catch (CloneNotSupportedException e) {
throw new RuntimeException("Won't happen", e);
}
}
}
|