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
,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
-
Field Summary
Fields inherited from class com.yahoo.component.AbstractComponent
isDeconstructable
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionOverride 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.Methods inherited from class com.yahoo.component.AbstractComponent
clone, compareTo, deconstruct, getClassName, getId, getIdString, hasInitializedId, initId, isDeconstructable, setIsDeconstructable, toString
-
Constructor Details
-
Resolver
-
Resolver
public Resolver(com.yahoo.component.ComponentId id) -
Resolver
protected Resolver()
-
-
Method Details
-
resolve
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
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
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)
-