aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java')
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java147
1 files changed, 73 insertions, 74 deletions
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java
index c2438bd82fc..09385f528fb 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java
@@ -8,14 +8,13 @@ import com.yahoo.vespa.model.application.validation.change.VespaConfigChangeActi
import com.yahoo.vespa.model.application.validation.change.VespaReindexAction;
import static com.yahoo.config.model.test.TestUtil.joinLines;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.List;
-import static org.junit.Assert.assertTrue;
-
public class IndexingScriptChangeValidatorTest {
private static class Fixture extends ContentClusterFixture {
@@ -72,153 +71,153 @@ public class IndexingScriptChangeValidatorTest {
}
@Test
- public void requireThatAddingIndexAspectRequireReindexing() throws Exception {
+ void requireThatAddingIndexAspectRequireReindexing() throws Exception {
new Fixture(FIELD + " { indexing: summary }",
- FIELD + " { indexing: index | summary }").
- assertValidation(expectedReindexingAction("add index aspect",
+ FIELD + " { indexing: index | summary }").
+ assertValidation(expectedReindexingAction("add index aspect",
"{ input f1 | summary f1; }",
"{ input f1 | tokenize normalize stem:\"BEST\" | index f1 | summary f1; }"));
}
@Test
- public void requireThatRemovingIndexAspectRequireReindexing() throws Exception {
+ void requireThatRemovingIndexAspectRequireReindexing() throws Exception {
new Fixture(FIELD + " { indexing: index | summary }",
- FIELD + " { indexing: summary }").
+ FIELD + " { indexing: summary }").
assertValidation(expectedReindexingAction("remove index aspect",
- "{ input f1 | tokenize normalize stem:\"BEST\" | index f1 | summary f1; }",
- "{ input f1 | summary f1; }"));
+ "{ input f1 | tokenize normalize stem:\"BEST\" | index f1 | summary f1; }",
+ "{ input f1 | summary f1; }"));
}
@Test
- public void requireThatChangingStemmingRequireReindexing() throws Exception {
+ void requireThatChangingStemmingRequireReindexing() throws Exception {
new Fixture(FIELD + " { indexing: index }",
- FIELD + " { indexing: index \n stemming: none }").
+ FIELD + " { indexing: index \n stemming: none }").
assertValidation(expectedReindexingAction("stemming: 'best' -> 'none'",
- "{ input f1 | tokenize normalize stem:\"BEST\" | index f1; }",
- "{ input f1 | tokenize normalize | index f1; }"));
+ "{ input f1 | tokenize normalize stem:\"BEST\" | index f1; }",
+ "{ input f1 | tokenize normalize | index f1; }"));
}
@Test
- public void requireThatChangingNormalizingRequireReindexing() throws Exception {
+ void requireThatChangingNormalizingRequireReindexing() throws Exception {
new Fixture(FIELD + " { indexing: index }",
- FIELD + " { indexing: index \n normalizing: none }").
+ FIELD + " { indexing: index \n normalizing: none }").
assertValidation(expectedReindexingAction("normalizing: 'ACCENT' -> 'NONE'",
- "{ input f1 | tokenize normalize stem:\"BEST\" | index f1; }",
- "{ input f1 | tokenize stem:\"BEST\" | index f1; }"));
+ "{ input f1 | tokenize normalize stem:\"BEST\" | index f1; }",
+ "{ input f1 | tokenize stem:\"BEST\" | index f1; }"));
}
@Test
- public void requireThatChangingMatchingRequireReindexing() throws Exception {
+ void requireThatChangingMatchingRequireReindexing() throws Exception {
new Fixture(FIELD + " { indexing: index \n match: exact }",
- FIELD + " { indexing: index \n match { gram \n gram-size: 3 } }").
+ FIELD + " { indexing: index \n match { gram \n gram-size: 3 } }").
assertValidation(expectedReindexingAction("matching: 'exact' -> 'gram (size 3)', normalizing: 'LOWERCASE' -> 'CODEPOINT'",
- "{ input f1 | exact | index f1; }",
- "{ input f1 | ngram 3 | index f1; }"));
+ "{ input f1 | exact | index f1; }",
+ "{ input f1 | ngram 3 | index f1; }"));
}
@Test
- public void requireThatSettingDynamicSummaryRequireReindexing() throws Exception {
+ void requireThatSettingDynamicSummaryRequireReindexing() throws Exception {
new Fixture(FIELD + " { indexing: summary }",
- FIELD + " { indexing: summary \n summary: dynamic }").
+ FIELD + " { indexing: summary \n summary: dynamic }").
assertValidation(expectedReindexingAction("summary field 'f1' transform: 'none' -> 'dynamicteaser'",
- "{ input f1 | summary f1; }",
- "{ input f1 | tokenize normalize stem:\"BEST\" | summary f1; }"));
+ "{ input f1 | summary f1; }",
+ "{ input f1 | tokenize normalize stem:\"BEST\" | summary f1; }"));
}
@Test
- public void requireThatMultipleChangesRequireReindexing() throws Exception {
- new Fixture(FIELD + " { indexing: index } " + FIELD_F2 + " { indexing: index }",
- FIELD + " { indexing: index \n stemming: none } " + FIELD_F2 + " { indexing: index \n normalizing: none }").
- assertValidation(Arrays.asList(expectedReindexingAction("f1", "stemming: 'best' -> 'none'",
- "{ input f1 | tokenize normalize stem:\"BEST\" | index f1; }",
- "{ input f1 | tokenize normalize | index f1; }"),
- expectedReindexingAction("f2", "normalizing: 'ACCENT' -> 'NONE'",
- "{ input f2 | tokenize normalize stem:\"BEST\" | index f2; }",
- "{ input f2 | tokenize stem:\"BEST\" | index f2; }")));
+ void requireThatMultipleChangesRequireReindexing() throws Exception {
+ new Fixture(FIELD + " { indexing: index } " + FIELD_F2 + " { indexing: index }",
+ FIELD + " { indexing: index \n stemming: none } " + FIELD_F2 + " { indexing: index \n normalizing: none }").
+ assertValidation(Arrays.asList(expectedReindexingAction("f1", "stemming: 'best' -> 'none'",
+ "{ input f1 | tokenize normalize stem:\"BEST\" | index f1; }",
+ "{ input f1 | tokenize normalize | index f1; }"),
+ expectedReindexingAction("f2", "normalizing: 'ACCENT' -> 'NONE'",
+ "{ input f2 | tokenize normalize stem:\"BEST\" | index f2; }",
+ "{ input f2 | tokenize stem:\"BEST\" | index f2; }")));
}
@Test
- public void requireThatAddingDocumentIndexFieldIsOk() throws Exception {
+ void requireThatAddingDocumentIndexFieldIsOk() throws Exception {
new Fixture("", "field f1 type string { indexing: index | summary }").
assertValidation();
}
@Test
- public void requireThatRemovingIndexFieldIsOk() throws Exception {
+ void requireThatRemovingIndexFieldIsOk() throws Exception {
new Fixture("field f1 type string { indexing: index | summary }", "").
assertValidation();
}
@Test
- public void requireThatAddingDocumentFieldIsOk() throws Exception {
+ void requireThatAddingDocumentFieldIsOk() throws Exception {
new Fixture("", FIELD + " { indexing: attribute | summary }").
assertValidation();
}
@Test
- public void requireThatAddingExtraFieldRequiresReindexing() throws Exception {
+ void requireThatAddingExtraFieldRequiresReindexing() throws Exception {
new Fixture(" field f1 type string { indexing: index }",
- " field f1 type string { indexing: index } } " +
- " field f2 type string { indexing: input f1 | summary ")
+ " field f1 type string { indexing: index } } " +
+ " field f2 type string { indexing: input f1 | summary ")
.assertValidation(VespaReindexAction.of(ClusterSpec.Id.from("test"),
- null,
- "Non-document field 'f2' added; this may be populated by reindexing"));
+ null,
+ "Non-document field 'f2' added; this may be populated by reindexing"));
}
@Test
- public void requireThatAddingSummaryAspectIsOk() throws Exception {
+ void requireThatAddingSummaryAspectIsOk() throws Exception {
new Fixture(FIELD + " { indexing: attribute }",
- FIELD + " { indexing: attribute | summary }").
+ FIELD + " { indexing: attribute | summary }").
assertValidation();
}
@Test
- public void requireThatSettingDynamicSummaryOnIndexFieldIsOk() throws Exception {
+ void requireThatSettingDynamicSummaryOnIndexFieldIsOk() throws Exception {
new Fixture(FIELD + " { indexing: index | summary }",
- FIELD + " { indexing: index | summary \n summary: dynamic }").
+ FIELD + " { indexing: index | summary \n summary: dynamic }").
assertValidation();
}
@Test
- public void requireThatOutputExpressionsAreIgnoredInAdvancedScript() throws Exception {
+ void requireThatOutputExpressionsAreIgnoredInAdvancedScript() throws Exception {
assertTrue(new ScriptFixture("{ input foo | switch { case \"audio\": input bar | index; case \"video\": input baz | index; default: 0 | index; }; }",
"{ input foo | switch { case \"audio\": input bar | attribute; case \"video\": input baz | attribute; default: 0 | attribute; }; }").
validate());
}
@Test
- public void requireThatNormalizeIsOk() throws Exception {
+ void requireThatNormalizeIsOk() throws Exception {
String entireSd = joinLines(
- "search test {",
- " document test {",
- " field inside type array<string> {",
- " indexing: summary",
- " }",
- " }",
- " field outside type array<string> {",
- " indexing: input inside | for_each { normalize } | index outside",
- " }",
- "}");
+ "search test {",
+ " document test {",
+ " field inside type array<string> {",
+ " indexing: summary",
+ " }",
+ " }",
+ " field outside type array<string> {",
+ " indexing: input inside | for_each { normalize } | index outside",
+ " }",
+ "}");
new Fixture(entireSd).assertValidation();
}
@Test
- public void requireThatNgramIsOk() throws Exception {
+ void requireThatNgramIsOk() throws Exception {
String entireSd = joinLines(
- "search test {",
- " document test {",
- " field inside type string {",
- " indexing: index",
- " match {",
- " gram",
- " gram-size: 3",
- " }",
- " }",
- " }",
- " field outside type string {",
- " indexing: input inside | ngram 2 | index outside",
- " }",
- "}");
+ "search test {",
+ " document test {",
+ " field inside type string {",
+ " indexing: index",
+ " match {",
+ " gram",
+ " gram-size: 3",
+ " }",
+ " }",
+ " }",
+ " field outside type string {",
+ " indexing: input inside | ngram 2 | index outside",
+ " }",
+ "}");
new Fixture(entireSd).assertValidation();
}