Class Resolver
- java.lang.Object
-
- com.yahoo.component.AbstractComponent
-
- com.yahoo.search.pagetemplates.engine.Resolver
-
- All Implemented Interfaces:
com.yahoo.component.Component
,com.yahoo.component.Deconstructable
,java.lang.Comparable<com.yahoo.component.Component>
- Direct Known Subclasses:
DeterministicResolver
,RandomResolver
public abstract class Resolver extends com.yahoo.component.AbstractComponent
Superclass of page template choice resolvers.Subclasses overrides one of the two resolve methods to either resolve each choices individually or look at all choices at once.
All subclasses of this must be multithread safe. I.e multiple calls may be made to resolve at the same time from different threads.
- Author:
- bratseth
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Resolution
resolve(Choice pageTemplate, Query query, Result result)
Override this to resolve choices.void
resolve(Choice choice, Query query, Result result, Resolution resolution)
Override this to resolve each choice independently.void
resolve(MapChoice choice, Query query, Result result, Resolution resolution)
Override this to resolve each map choice independently.
-
-
-
Method Detail
-
resolve
public Resolution resolve(Choice pageTemplate, Query query, Result result)
Override this to resolve choices. Before retuning this method must resolve the given choice between a set of page templates and all choices found recursively within the chosen page template. It is permissible but not required to add solutions also to choices present within those templates which are not chosen.This default implementation creates a Resolution and calls
resolve(choice/mapChoice,query,result,resolution)
first on the given page template choice, then on each choice found in that temnplate. This provides a simple API to resolvers which make each choice independently.- Parameters:
pageTemplate
- the choice of page templates to resolve - a choice containing singleton lists of PageTemplate elementsquery
- the query, from which information useful for correct resolution can be foundresult
- the result, from which further information useful for correct resolution can be found- Returns:
- the resolution of the choices contained in the given page template
-
resolve
public void resolve(Choice choice, Query query, Result result, Resolution resolution)
Override this to resolve each choice independently. This default implementation does nothing.- Parameters:
choice
- the choice to resolvequery
- the query for which this should be resolved, typically used to extract featuresresult
- the result for which this should be resolved, typically used to extract featuresresolution
- the set of resolutions made so far, to which this should be added:resolution.addChoiceResolution(choice,chosenAlternativeIndex)
-
resolve
public void resolve(MapChoice choice, Query query, Result result, Resolution resolution)
Override this to resolve each map choice independently. This default implementation does nothing.- Parameters:
choice
- the choice to resolvequery
- the query for which this should be resolved, typically used to extract featuresresult
- the result for which this should be resolved, typically used to extract featuresresolution
- the set of resolutions made so far, to which this should be added:resolution.addMapChoiceResolution(choice,chosenMapping)
-
-