summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-04-25 21:52:49 +0200
committerGitHub <noreply@github.com>2021-04-25 21:52:49 +0200
commit91c650721de600c34660141a17d8e101bffd69a8 (patch)
tree6b6b7585a3f2469157f8c7fff4aac2776390ab5e
parentfae3066f17edd78d752a06b442953636c0d9b55c (diff)
parent4bad6997d0ee13c46a15c6404402ddc2a797db17 (diff)
Merge pull request #17587 from vespa-engine/balder/allow-btree-index-to-be-cased
Allow btree index to be case sensitiv.
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/processing/DictionaryProcessor.java4
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/DictionaryTestCase.java8
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidatorTest.java8
3 files changed, 5 insertions, 15 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/DictionaryProcessor.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/DictionaryProcessor.java
index ba3baa3147a..1f07e3159da 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/DictionaryProcessor.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/DictionaryProcessor.java
@@ -43,10 +43,6 @@ public class DictionaryProcessor extends Processor {
if (dictionary.getMatch() != Case.CASED) {
fail(search, field, "hash dictionary require cased match");
}
- } else {
- if (dictionary.getMatch() != Case.UNCASED) {
- fail(search, field, "btree dictionary require uncased match");
- }
}
if (! dictionary.getMatch().equals(attribute.getCase())) {
fail(search, field, "Dictionary casing '" + dictionary.getMatch() + "' does not match field match casing '" + attribute.getCase() + "'");
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/DictionaryTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/DictionaryTestCase.java
index 47122ccac88..df0d58d3c8a 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/DictionaryTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/DictionaryTestCase.java
@@ -138,11 +138,7 @@ public class DictionaryTestCase {
}
@Test
public void testStringBtreeCasedSettings() throws ParseException {
- try {
- verifyStringDictionaryControl(Dictionary.Type.BTREE, Case.CASED, Case.CASED, "dictionary { btree\ncased\n}");
- } catch (IllegalArgumentException e) {
- assertEquals("For search 'test', field 'n1': btree dictionary require uncased match", e.getMessage());
- }
+ verifyStringDictionaryControl(Dictionary.Type.BTREE, Case.CASED, Case.CASED, "dictionary { btree\ncased\n}", "match:cased");
}
@Test
public void testStringHashSettings() throws ParseException {
@@ -186,7 +182,7 @@ public class DictionaryTestCase {
try {
verifyStringDictionaryControl(Dictionary.Type.BTREE_AND_HASH, Case.CASED, Case.CASED, "dictionary { btree\nhash\ncased\n}");
} catch (IllegalArgumentException e) {
- assertEquals("For search 'test', field 'n1': btree dictionary require uncased match", e.getMessage());
+ assertEquals("For search 'test', field 'n1': Dictionary casing 'CASED' does not match field match casing 'UNCASED'", e.getMessage());
}
}
@Test
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidatorTest.java
index cd8afa404da..2cf8069c988 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidatorTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidatorTest.java
@@ -3,7 +3,6 @@ package com.yahoo.vespa.model.application.validation.change.search;
import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.vespa.model.application.validation.change.VespaConfigChangeAction;
-import org.junit.Ignore;
import org.junit.Test;
import java.util.List;
@@ -93,11 +92,10 @@ public class AttributeChangeValidatorTest {
"Field 'f1' changed: remove attribute 'fast-access'"));
}
- // TODO Not testable until one dictionary type supports both cased/uncased
- @Ignore
+ @Test
public void changing_uncased2cased_require_restart() throws Exception {
- new Fixture("field f1 type string { indexing: attribute\n attribute: fast-search\n dictionary { hash\ncased}\nmatch:cased}",
- "field f1 type string { indexing: attribute\n attribute: fast-search\n dictionary{ btree} }").
+ new Fixture("field f1 type string { indexing: attribute\n attribute: fast-search\n dictionary { btree\ncased}\nmatch:cased}",
+ "field f1 type string { indexing: attribute\n attribute: fast-search\n dictionary{ btree\nuncased}\nmatch:uncased }").
assertValidation(newRestartAction(ClusterSpec.Id.from("test"),
"Field 'f1' changed: change property 'dictionary: cased/uncased' from 'CASED' to 'UNCASED'"));
}