diff options
author | Geir Storli <geirstorli@yahoo.no> | 2017-08-22 14:21:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-22 14:21:49 +0200 |
commit | 3337be1ece9e5d3c3679780a46d46226e1842b55 (patch) | |
tree | 9c469879e5eee555f21a6a05f7a64eb484cb491f | |
parent | ec442090847f02930d4ad950aef1a9909fea17fc (diff) | |
parent | fa4465b46037aec257293a036292f2b1882efd9e (diff) |
Merge pull request #3185 from vespa-engine/vekterli/clear-summary-transform-for-reference-summary-fields
Clear summary transforms for reference summary fields
5 files changed, 48 insertions, 3 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/ReferenceFieldsProcessor.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/ReferenceFieldsProcessor.java index 2c5c237f840..f29d53d1c86 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/ReferenceFieldsProcessor.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/ReferenceFieldsProcessor.java @@ -29,6 +29,19 @@ public class ReferenceFieldsProcessor extends Processor { @Override public void process() { + clearSummaryAttributeAspectForConcreteFields(); + clearSummaryAttributeAspectForExplicitSummaryFields(); + } + + private void clearSummaryAttributeAspectForExplicitSummaryFields() { + for (DocumentSummary docSum : search.getSummaries().values()) { + docSum.getSummaryFields().stream() + .filter(summaryField -> summaryField.getDataType() instanceof ReferenceDataType) + .forEach(summaryField -> summaryField.setTransform(SummaryTransform.NONE)); + } + } + + private void clearSummaryAttributeAspectForConcreteFields() { for (SDField field : search.allConcreteFields()) { if (field.getDataType() instanceof ReferenceDataType) { removeFromAttributePrefetchSummaryClass(field); diff --git a/config-model/src/test/derived/importedfields/attributes.cfg b/config-model/src/test/derived/importedfields/attributes.cfg index 74348377ceb..62fe0052bc3 100644 --- a/config-model/src/test/derived/importedfields/attributes.cfg +++ b/config-model/src/test/derived/importedfields/attributes.cfg @@ -38,6 +38,26 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].name "b_ref_with_summary" +attribute[].datatype REFERENCE +attribute[].collectiontype SINGLE +attribute[].removeifzero false +attribute[].createifnonexistent false +attribute[].fastsearch false +attribute[].huge false +attribute[].sortascending true +attribute[].sortfunction UCA +attribute[].sortstrength PRIMARY +attribute[].sortlocale "" +attribute[].enablebitvectors false +attribute[].enableonlybitvector false +attribute[].fastaccess false +attribute[].arity 8 +attribute[].lowerbound -9223372036854775808 +attribute[].upperbound 9223372036854775807 +attribute[].densepostinglistthreshold 0.4 +attribute[].tensortype "" +attribute[].imported false attribute[].name "my_int_field" attribute[].datatype INT32 attribute[].collectiontype SINGLE diff --git a/config-model/src/test/derived/importedfields/child.sd b/config-model/src/test/derived/importedfields/child.sd index 75063be1d1d..703451c1293 100644 --- a/config-model/src/test/derived/importedfields/child.sd +++ b/config-model/src/test/derived/importedfields/child.sd @@ -3,6 +3,7 @@ search child { document child { field a_ref type reference<parent_a> { indexing: attribute } field b_ref type reference<parent_b> { indexing: attribute } + field b_ref_with_summary type reference<parent_b> { indexing: attribute | summary } } import field a_ref.int_field as my_int_field {} import field b_ref.string_field as my_string_field {} @@ -15,6 +16,7 @@ search child { document-summary mysummary { summary a_ref type reference<parent_a> {} + summary b_ref_with_summary type reference<parent_b> {} summary my_int_field type int {} summary my_string_field type string {} summary my_int_array_field type array<int> {} diff --git a/config-model/src/test/derived/importedfields/index-info.cfg b/config-model/src/test/derived/importedfields/index-info.cfg index b33091bff04..7cb53c480ce 100644 --- a/config-model/src/test/derived/importedfields/index-info.cfg +++ b/config-model/src/test/derived/importedfields/index-info.cfg @@ -15,6 +15,12 @@ indexinfo[].command[].indexname "b_ref" indexinfo[].command[].command "attribute" indexinfo[].command[].indexname "b_ref" indexinfo[].command[].command "word" +indexinfo[].command[].indexname "b_ref_with_summary" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "b_ref_with_summary" +indexinfo[].command[].command "attribute" +indexinfo[].command[].indexname "b_ref_with_summary" +indexinfo[].command[].command "word" indexinfo[].command[].indexname "rankfeatures" indexinfo[].command[].command "index" indexinfo[].command[].indexname "summaryfeatures" diff --git a/config-model/src/test/derived/importedfields/summary.cfg b/config-model/src/test/derived/importedfields/summary.cfg index 95a9c2bb318..17bb1fd1e23 100644 --- a/config-model/src/test/derived/importedfields/summary.cfg +++ b/config-model/src/test/derived/importedfields/summary.cfg @@ -1,16 +1,20 @@ -defaultsummaryid 1151071433 -classes[].id 1151071433 +defaultsummaryid 1294344677 +classes[].id 1294344677 classes[].name "default" +classes[].fields[].name "b_ref_with_summary" +classes[].fields[].type "longstring" classes[].fields[].name "rankfeatures" classes[].fields[].type "featuredata" classes[].fields[].name "summaryfeatures" classes[].fields[].type "featuredata" classes[].fields[].name "documentid" classes[].fields[].type "longstring" -classes[].id 665629335 +classes[].id 762794406 classes[].name "mysummary" classes[].fields[].name "a_ref" classes[].fields[].type "longstring" +classes[].fields[].name "b_ref_with_summary" +classes[].fields[].type "longstring" classes[].fields[].name "my_int_field" classes[].fields[].type "integer" classes[].fields[].name "my_string_field" |