diff options
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/pagetemplates/result/SectionHitGroup.java')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/pagetemplates/result/SectionHitGroup.java | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/pagetemplates/result/SectionHitGroup.java b/container-search/src/main/java/com/yahoo/search/pagetemplates/result/SectionHitGroup.java new file mode 100644 index 00000000000..00f6c6350fc --- /dev/null +++ b/container-search/src/main/java/com/yahoo/search/pagetemplates/result/SectionHitGroup.java @@ -0,0 +1,52 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.search.pagetemplates.result; + +import com.yahoo.search.pagetemplates.model.Renderer; +import com.yahoo.search.pagetemplates.model.Source; +import com.yahoo.search.result.HitGroup; + +import java.util.ArrayList; +import java.util.List; + +/** + * A hit group corresponding to a section - contains some additional information + * in proper getters and setters which is used during rendering. + * + * @author <a href="mailto:bratseth@yahoo-inc.com">Jon Bratseth</a> + */ +public class SectionHitGroup extends HitGroup { + + private static final long serialVersionUID = -9048845836777953538L; + private List<Source> sources=new ArrayList<>(0); + private List<Renderer> renderers=new ArrayList<>(0); + private final String displayId; + + private boolean leaf=false; + + public SectionHitGroup(String id) { + super(id); + if (id.startsWith("section:section_")) + displayId=null; // Don't display section ids when not named explicitly + else + displayId=id; + types().add("section"); + } + + @Override + public String getDisplayId() { return displayId; } + + /** + * Returns the live, modifiable list of sources which are not fetched by the framework but should + * instead be included in the result + */ + public List<Source> sources() { return sources; } + + /** Returns the live, modifiable list of renderers in this section */ + public List<Renderer> renderers() { return renderers; } + + /** Returns whether this is a leaf section containing no subsections */ + public boolean isLeaf() { return leaf; } + + public void setLeaf(boolean leaf) { this.leaf=leaf; } + +} |