diff options
author | Arne Juul <arnej@yahooinc.com> | 2022-09-01 13:38:29 +0000 |
---|---|---|
committer | Arne Juul <arnej@yahooinc.com> | 2022-09-01 13:41:47 +0000 |
commit | 9e0becc037f73ae345a9f96ecaa155e799ca5b64 (patch) | |
tree | 034aca5bfb84b4a333402e445810bb7f16c38392 /container-search/src/main/java/com/yahoo/search/yql/FieldFiller.java | |
parent | a5a7789218d9fb5a569eb8f3feec6747f9ec2ca3 (diff) |
try harder to avoid disk access
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/yql/FieldFiller.java')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/yql/FieldFiller.java | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/yql/FieldFiller.java b/container-search/src/main/java/com/yahoo/search/yql/FieldFiller.java index db44e13c27e..833c1251a7b 100644 --- a/container-search/src/main/java/com/yahoo/search/yql/FieldFiller.java +++ b/container-search/src/main/java/com/yahoo/search/yql/FieldFiller.java @@ -60,24 +60,27 @@ public class FieldFiller extends Searcher { @Override public void fill(Result result, String summaryClass, Execution execution) { - execution.fill(result, summaryClass); - Set<String> summaryFields = result.getQuery().getPresentation().getSummaryFields(); - - if (summaryFields.isEmpty() || summaryClass == null || - result.getQuery().properties().getBoolean(FIELD_FILLER_DISABLE)) { + if (summaryFields.isEmpty() || result.getQuery().properties().getBoolean(FIELD_FILLER_DISABLE)) { + // no special handling: + execution.fill(result, summaryClass); return; } - - if (intersectionOfAttributes.containsAll(summaryFields)) { - if (! SORTABLE_ATTRIBUTES_SUMMARY_CLASS.equals(summaryClass)) { - execution.fill(result, SORTABLE_ATTRIBUTES_SUMMARY_CLASS); + if (summaryClass != null) { + // always fill requested class: + execution.fill(result, summaryClass); + if (hasAll(summaryFields, summaryClass, result.getQuery().getModel().getRestrict())) { + // no more was needed: + return; } + } + // we need more: + if (intersectionOfAttributes.containsAll(summaryFields)) { + // only attributes needed: + execution.fill(result, SORTABLE_ATTRIBUTES_SUMMARY_CLASS); } else { - // Yes, summaryClass may be SORTABLE_ATTRIBUTES_SUMMARY_CLASS here - if ( ! hasAll(summaryFields, summaryClass, result.getQuery().getModel().getRestrict())) { - execution.fill(result, null); - } + // fetch all summary fields: + execution.fill(result, null); } } |