diff options
7 files changed, 100 insertions, 7 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/IndexingValues.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/IndexingValues.java index 72777b7dfb4..7bc12dec331 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/IndexingValues.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/IndexingValues.java @@ -51,9 +51,9 @@ public class IndexingValues extends Processor { protected boolean shouldConvert(Expression exp) { if (exp instanceof OutputExpression && mutatedBy != null) { throw newProcessException(search, field, - "Indexing expression '" + mutatedBy + "' modifies the value of the " + - "document field '" + field.getName() + "'. This is no longer supported -- " + - "declare such fields outside the document."); + "Indexing expression '" + mutatedBy + "' attempts to modify the value of the " + + "document field '" + field.getName() + "'. Use a field outside the document " + + "block instead."); } if (exp instanceof InputExpression && ((InputExpression)exp).getFieldName().equals(field.getName())) { mutatedBy = null; diff --git a/config-model/src/test/derived/lowercase/ilscripts.cfg b/config-model/src/test/derived/lowercase/ilscripts.cfg new file mode 100644 index 00000000000..0cf56eb43e0 --- /dev/null +++ b/config-model/src/test/derived/lowercase/ilscripts.cfg @@ -0,0 +1,9 @@ +maxtermoccurrences 100 +fieldmatchmaxlength 1000000 +ilscript[].doctype "lowercase" +ilscript[].docfield[] "single_field_source" +ilscript[].docfield[] "array_field_source" +ilscript[].content[] "clear_state | guard { input array_field_source | for_each { lowercase } | for_each { tokenize normalize stem:\"BEST\" } | summary array_field | index array_field; }" +ilscript[].content[] "clear_state | guard { input single_field_source | lowercase | tokenize normalize stem:\"BEST\" | summary single_field | index single_field; }" +ilscript[].content[] "input array_field_source | passthrough array_field_source" +ilscript[].content[] "input single_field_source | passthrough single_field_source"
\ No newline at end of file diff --git a/config-model/src/test/derived/lowercase/index-info.cfg b/config-model/src/test/derived/lowercase/index-info.cfg new file mode 100644 index 00000000000..b94125de79d --- /dev/null +++ b/config-model/src/test/derived/lowercase/index-info.cfg @@ -0,0 +1,41 @@ +indexinfo[].name "lowercase" +indexinfo[].command[].indexname "sddocname" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "sddocname" +indexinfo[].command[].command "word" +indexinfo[].command[].indexname "single_field_source" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "single_field_source" +indexinfo[].command[].command "type string" +indexinfo[].command[].indexname "array_field_source" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "array_field_source" +indexinfo[].command[].command "multivalue" +indexinfo[].command[].indexname "array_field_source" +indexinfo[].command[].command "type Array<string>" +indexinfo[].command[].indexname "array_field" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "array_field" +indexinfo[].command[].command "lowercase" +indexinfo[].command[].indexname "array_field" +indexinfo[].command[].command "multivalue" +indexinfo[].command[].indexname "array_field" +indexinfo[].command[].command "stem:BEST" +indexinfo[].command[].indexname "array_field" +indexinfo[].command[].command "normalize" +indexinfo[].command[].indexname "array_field" +indexinfo[].command[].command "plain-tokens" +indexinfo[].command[].indexname "array_field" +indexinfo[].command[].command "type Array<string>" +indexinfo[].command[].indexname "single_field" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "single_field" +indexinfo[].command[].command "lowercase" +indexinfo[].command[].indexname "single_field" +indexinfo[].command[].command "stem:BEST" +indexinfo[].command[].indexname "single_field" +indexinfo[].command[].command "normalize" +indexinfo[].command[].indexname "single_field" +indexinfo[].command[].command "plain-tokens" +indexinfo[].command[].indexname "single_field" +indexinfo[].command[].command "type string"
\ No newline at end of file diff --git a/config-model/src/test/derived/lowercase/lowercase.sd b/config-model/src/test/derived/lowercase/lowercase.sd new file mode 100644 index 00000000000..de8c7ad729e --- /dev/null +++ b/config-model/src/test/derived/lowercase/lowercase.sd @@ -0,0 +1,21 @@ +schema lowercase { + + document lowercase { + + field single_field_source type string { + } + + field array_field_source type array<string> { + } + + } + + field single_field type string { + indexing: input single_field_source | lowercase | summary | index + } + + field array_field type array<string> { + indexing: input array_field_source | for_each { lowercase } | summary | index + } + +}
\ No newline at end of file diff --git a/config-model/src/test/examples/indexrewrite.sd b/config-model/src/test/examples/indexrewrite.sd index c7d038a719a..c9fa7a1530a 100644 --- a/config-model/src/test/examples/indexrewrite.sd +++ b/config-model/src/test/examples/indexrewrite.sd @@ -1,19 +1,21 @@ # Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. search indexrewrite { + document indexrewrite { field title_src type string { - } } + field title type string { indexing: input title_src | lowercase | normalize | tokenize | index - # index-to: title, titleabstract, default indexing-rewrite: none rank-type: about stemming: none alias: headline } + field title_s type string { indexing: input title_src | summary } + } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/LowercaseTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/LowercaseTestCase.java new file mode 100644 index 00000000000..253bb2f4f00 --- /dev/null +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/LowercaseTestCase.java @@ -0,0 +1,19 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.searchdefinition.derived; + +import com.yahoo.searchdefinition.parser.ParseException; +import org.junit.Test; + +import java.io.IOException; + +/** + * @author bratseth + */ +public class LowercaseTestCase extends AbstractExportingTestCase { + + @Test + public void testDeriving() throws IOException, ParseException { + assertCorrectDeriving("lowercase"); + } + +} diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/IndexingValuesTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/IndexingValuesTestCase.java index a1c454da822..823ad556b1d 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/IndexingValuesTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/IndexingValuesTestCase.java @@ -23,7 +23,8 @@ public class IndexingValuesTestCase { public void requireThatInputOtherFieldThrows() throws IOException, ParseException { assertBuildFails("src/test/examples/indexing_input_other_field.sd", "For search 'indexing_input_other_field', field 'bar': Indexing expression 'input foo' " + - "modifies the value of the document field 'bar'. This is no longer supported -- declare " + - "such fields outside the document."); + "attempts to modify the value of the document field 'bar'. " + + "Use a field outside the document block instead."); } + } |