summaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/searchdefinition
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2019-05-02 11:49:24 +0200
committerGeir Storli <geirst@verizonmedia.com>2019-05-02 11:49:24 +0200
commit3ad304534d9d3b8b9fe04f66a83b4fa28ccb0334 (patch)
tree4b7ab1b6681563a398bc110cfa18b73631b07de2 /config-model/src/main/java/com/yahoo/searchdefinition
parentb3c22361baac22c64df66f6574ea99d21dcdd652 (diff)
Add flag to trigger use of experimental posting list format for an index field.
Diffstat (limited to 'config-model/src/main/java/com/yahoo/searchdefinition')
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/Index.java11
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexSchema.java7
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/IndexOperation.java8
3 files changed, 25 insertions, 1 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/Index.java b/config-model/src/main/java/com/yahoo/searchdefinition/Index.java
index 1620c90acd1..d7e9e0da081 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/Index.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/Index.java
@@ -56,6 +56,9 @@ public class Index implements Cloneable, Serializable {
/** The boolean index definition, if set */
private BooleanIndexDefinition boolIndex;
+ // TODO: Remove when experimental posting list format is made default
+ private boolean experimentalPostingListFormat = false;
+
public Index(String name) {
this(name, false);
}
@@ -181,4 +184,12 @@ public class Index implements Cloneable, Serializable {
boolIndex = def;
}
+ public void setExperimentalPostingListFormat(boolean value) {
+ experimentalPostingListFormat = value;
+ }
+
+ public boolean useExperimentalPostingListFormat() {
+ return experimentalPostingListFormat;
+ }
+
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexSchema.java b/config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexSchema.java
index f8766afbc7b..6f6e97a0876 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexSchema.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexSchema.java
@@ -113,7 +113,8 @@ public class IndexSchema extends Derived implements IndexschemaConfig.Producer {
.datatype(IndexschemaConfig.Indexfield.Datatype.Enum.valueOf(f.getType()))
.prefix(f.hasPrefix())
.phrases(f.hasPhrases())
- .positions(f.hasPositions());
+ .positions(f.hasPositions())
+ .experimentalpostinglistformat(f.useExperimentalPostingListFormat());
if (!f.getCollectionType().equals("SINGLE")) {
ifB.collectiontype(IndexschemaConfig.Indexfield.Collectiontype.Enum.valueOf(f.getCollectionType()));
}
@@ -174,6 +175,8 @@ public class IndexSchema extends Derived implements IndexschemaConfig.Producer {
private boolean phrases = false; // TODO dead, but keep a while to ensure config compatibility?
private boolean positions = true;// TODO dead, but keep a while to ensure config compatibility?
private BooleanIndexDefinition boolIndex = null;
+ // TODO: Remove when experimental posting list format is made default
+ private boolean experimentalPostingListFormat = false;
public IndexField(String name, Index.Type type, DataType sdFieldType) {
this.name = name;
@@ -183,6 +186,7 @@ public class IndexSchema extends Derived implements IndexschemaConfig.Producer {
public void setIndexSettings(com.yahoo.searchdefinition.Index index) {
if (type.equals(Index.Type.TEXT)) {
prefix = index.isPrefix();
+ experimentalPostingListFormat = index.useExperimentalPostingListFormat();
}
sdType = index.getType();
boolIndex = index.getBooleanIndexDefiniton();
@@ -205,6 +209,7 @@ public class IndexSchema extends Derived implements IndexschemaConfig.Producer {
public boolean hasPrefix() { return prefix; }
public boolean hasPhrases() { return phrases; }
public boolean hasPositions() { return positions; }
+ public boolean useExperimentalPostingListFormat() { return experimentalPostingListFormat; }
public BooleanIndexDefinition getBooleanIndexDefinition() {
return boolIndex;
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/IndexOperation.java b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/IndexOperation.java
index 6df4ca2a6e1..459bb247e5f 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/IndexOperation.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/IndexOperation.java
@@ -29,6 +29,8 @@ public class IndexOperation implements FieldOperation {
private OptionalLong lowerBound = OptionalLong.empty();
private OptionalLong upperBound = OptionalLong.empty();
private OptionalDouble densePostingListThreshold = OptionalDouble.empty();
+ // TODO: Remove when experimental posting list format is made default
+ private Optional<Boolean> experimentalPostingListFormat = Optional.empty();
public String getIndexName() {
return indexName;
@@ -87,6 +89,9 @@ public class IndexOperation implements FieldOperation {
index.setBooleanIndexDefiniton(
new BooleanIndexDefinition(arity, lowerBound, upperBound, densePostingListThreshold));
}
+ if (experimentalPostingListFormat.isPresent()) {
+ index.setExperimentalPostingListFormat(experimentalPostingListFormat.get());
+ }
}
public Type getType() {
@@ -112,5 +117,8 @@ public class IndexOperation implements FieldOperation {
public void setDensePostingListThreshold(double densePostingListThreshold) {
this.densePostingListThreshold = OptionalDouble.of(densePostingListThreshold);
}
+ public void setExperimentalPostingListFormat(boolean value) {
+ experimentalPostingListFormat = Optional.of(value);
+ }
}