no.sesat.search.mode.config
Class CommandConfig

java.lang.Object
  extended by no.sesat.search.mode.config.CommandConfig
All Implemented Interfaces:
Serializable, BaseSearchConfiguration, SearchConfiguration, SearchConfiguration.ModesW3cDomDeserialiser
Direct Known Subclasses:
AbstractWebServiceSearchConfiguration, AbstractXmlSearchConfiguration, FastCommandConfig, MathCommandConfig, MobileCommandConfig, NewsMyNewsCommandConfig, PropertiesCommandConfig, SolrCommandConfig, StaticCommandConfig, StockCommandConfig

public class CommandConfig
extends Object
implements BaseSearchConfiguration, SearchConfiguration.ModesW3cDomDeserialiser

A common base class for search configurations. TODO rename to BaseSearchConfiguration since it is directly used by default commands in modes.xml

Version:
$Id: CommandConfig.java 7225 2009-04-09 00:32:20Z ssmiweve $
See Also:
Serialized Form

Nested Class Summary
static interface CommandConfig.Controller
           
 
Nested classes/interfaces inherited from interface no.sesat.search.mode.config.SearchConfiguration
SearchConfiguration.ModesW3cDomDeserialiser
 
Field Summary
protected static int DEFAULT_DOCUMENTS_TO_RETURN
           
 
Fields inherited from interface no.sesat.search.mode.config.SearchConfiguration
DEFAULT_PAGING_PARAMETER, DEFAULT_USER_SORT_PARAMETER
 
Constructor Summary
CommandConfig()
           
 
Method Summary
 void addQueryTransformer(QueryTransformerConfig queryTransformer)
          Adds a QueryTransformerConfig to the list of transformeres.
 void addResultField(String... fieldName)
           
 void addResultFields(String[] resultFieldArray)
           
 void addResultHandler(ResultHandlerConfig handler)
          Adds a ResultHandlerConfig to the list of handlers.
 void clearFieldFilters()
          Remove all fieldFilters.
 void clearQueryTransformers()
           
 void clearResultHandlers()
          Remove all result handlers.
 Map<String,String> getFieldFilterMap()
          Getter for property fieldFilters.
 String getId()
          Returns the name of this configuration.
 QueryTransformerConfig getInitialQueryTransformer()
           
 String getName()
           
 String getPagingParameter()
          Return the parameter key that any associated ResultPagingNavigationController should use to fetch the offset value.
 QueryBuilderConfig getQueryBuilder()
           
 String getQueryParameter()
           
 List<QueryTransformerConfig> getQueryTransformers()
          Returns a (defensive copy) list of QueryTransformerConfig that should be applied to the query before it is sent to the search command.
 Map<String,String> getResultFieldMap()
           
 String[] getResultFields()
           
 List<ResultHandlerConfig> getResultHandlers()
          Returns a (defensive copy) list of ResultHandlerConfig that should act on the search result.
 int getResultsToReturn()
          Returns the number of results to return.
 String getStatisticalName()
           
 String getUserSortParameter()
          Getter for the userSortParameter property.
 boolean isAlwaysRun()
           
 boolean isAsynchronous()
          Is the command used asynchronously, for example by ajax calls.
 boolean isRunBlank()
           
protected  Collection<Navigator> parseNavigators(Element navsE)
          Deprecated. Use FacetedCommandConfigUtility.parseNavigators(Element) instead.
 SearchConfiguration readSearchConfiguration(Element element, SearchConfiguration inherit, SearchModeFactory.Context context)
          Apply the attributes found in element to 'this'.
 void setAlwaysRun(boolean enable)
           
 void setAsynchronous(boolean asynchronous)
           
 void setFieldFilters(String[] fieldFilters)
          Syntax: field-filters="size, nyhetskilde AS newssource" Just "size" will be the same as writing "size AS size"
 void setId(String id)
           
 void setInitialQueryTransformer(QueryTransformerConfig initialQueryTransformer)
           
 void setPagingParameter(String pagingParameter)
           
 void setQueryBuilder(QueryBuilderConfig queryBuilderConfig)
           
 void setQueryParameter(String useParameterAsQuery)
           
 void setResultsToReturn(int no)
           
 void setRunBlank(boolean enable)
           
 void setStatisticalName(String name)
           
 void setUserSortParameter(String userSortParameter)
          Setter for the userSortParameter property.
 String toString()
           
 String toStringLong()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_DOCUMENTS_TO_RETURN

protected static final int DEFAULT_DOCUMENTS_TO_RETURN
See Also:
Constant Field Values
Constructor Detail

CommandConfig

public CommandConfig()
Method Detail

getQueryTransformers

public final List<QueryTransformerConfig> getQueryTransformers()
Returns a (defensive copy) list of QueryTransformerConfig that should be applied to the query before it is sent to the search command. The list is also unmodifiable.

Specified by:
getQueryTransformers in interface BaseSearchConfiguration
Returns:
queryTransfomer

addQueryTransformer

public final void addQueryTransformer(QueryTransformerConfig queryTransformer)
Description copied from interface: BaseSearchConfiguration
Adds a QueryTransformerConfig to the list of transformeres.

Specified by:
addQueryTransformer in interface BaseSearchConfiguration
Parameters:
queryTransformer - The query transformer to add.

getResultHandlers

public final List<ResultHandlerConfig> getResultHandlers()
Description copied from interface: BaseSearchConfiguration
Returns a (defensive copy) list of ResultHandlerConfig that should act on the search result.

Specified by:
getResultHandlers in interface BaseSearchConfiguration
Returns:
The list of handlers.

addResultHandler

public final void addResultHandler(ResultHandlerConfig handler)
Description copied from interface: BaseSearchConfiguration
Adds a ResultHandlerConfig to the list of handlers.

Specified by:
addResultHandler in interface BaseSearchConfiguration
Parameters:
handler - The handler to add.

getName

public final String getName()
Specified by:
getName in interface SearchConfiguration

getId

public final String getId()
Description copied from interface: SearchConfiguration
Returns the name of this configuration.

Specified by:
getId in interface SearchConfiguration
Returns:
the name of the configuration.

setId

public final void setId(String id)
Parameters:
id - Name for this configuration.

addResultField

public final void addResultField(String... fieldName)
Specified by:
addResultField in interface SearchConfiguration

addResultFields

public final void addResultFields(String[] resultFieldArray)
Parameters:
resultFieldArray - Result fields to add.

getResultFields

public final String[] getResultFields()

getResultFieldMap

public final Map<String,String> getResultFieldMap()
Specified by:
getResultFieldMap in interface SearchConfiguration
Returns:

getResultsToReturn

public final int getResultsToReturn()
Description copied from interface: SearchConfiguration
Returns the number of results to return.

Specified by:
getResultsToReturn in interface SearchConfiguration
Returns:

setResultsToReturn

public final void setResultsToReturn(int no)

getQueryParameter

public String getQueryParameter()
Specified by:
getQueryParameter in interface SearchConfiguration
Returns:

isAlwaysRun

public boolean isAlwaysRun()
Specified by:
isAlwaysRun in interface SearchConfiguration
Returns:
true if the command should always run.

setAlwaysRun

public void setAlwaysRun(boolean enable)
Parameters:
enable -

isRunBlank

public boolean isRunBlank()
Specified by:
isRunBlank in interface SearchConfiguration
Returns:
true if the command should run when query string is blank.

setRunBlank

public void setRunBlank(boolean enable)
Parameters:
enable -

setQueryParameter

public void setQueryParameter(String useParameterAsQuery)
Parameters:
useParameterAsQuery -

getStatisticalName

public String getStatisticalName()
Specified by:
getStatisticalName in interface SearchConfiguration
Returns:
The statistical name.

setStatisticalName

public void setStatisticalName(String name)
Parameters:
name -

isAsynchronous

public boolean isAsynchronous()
Description copied from interface: SearchConfiguration
Is the command used asynchronously, for example by ajax calls.

Specified by:
isAsynchronous in interface SearchConfiguration
Returns:

setAsynchronous

public void setAsynchronous(boolean asynchronous)
Parameters:
asynchronous -

setFieldFilters

public void setFieldFilters(String[] fieldFilters)
Syntax: field-filters="size, nyhetskilde AS newssource" Just "size" will be the same as writing "size AS size"

Parameters:
fieldFilters - Array of field filters.

getFieldFilterMap

public Map<String,String> getFieldFilterMap()
Getter for property fieldFilters.

Specified by:
getFieldFilterMap in interface SearchConfiguration
Returns:
Value of property fieldFilters.

clearQueryTransformers

public void clearQueryTransformers()
Specified by:
clearQueryTransformers in interface BaseSearchConfiguration

clearResultHandlers

public void clearResultHandlers()
Description copied from interface: BaseSearchConfiguration
Remove all result handlers.

Specified by:
clearResultHandlers in interface BaseSearchConfiguration

clearFieldFilters

public void clearFieldFilters()
Description copied from interface: SearchConfiguration
Remove all fieldFilters.

Specified by:
clearFieldFilters in interface SearchConfiguration

getQueryBuilder

public QueryBuilderConfig getQueryBuilder()
Specified by:
getQueryBuilder in interface BaseSearchConfiguration

setQueryBuilder

public void setQueryBuilder(QueryBuilderConfig queryBuilderConfig)
Specified by:
setQueryBuilder in interface BaseSearchConfiguration

getInitialQueryTransformer

public QueryTransformerConfig getInitialQueryTransformer()
Specified by:
getInitialQueryTransformer in interface BaseSearchConfiguration

setInitialQueryTransformer

public void setInitialQueryTransformer(QueryTransformerConfig initialQueryTransformer)
Specified by:
setInitialQueryTransformer in interface BaseSearchConfiguration

getPagingParameter

public String getPagingParameter()
Description copied from interface: SearchConfiguration
Return the parameter key that any associated ResultPagingNavigationController should use to fetch the offset value. Defaults to "offset". Typically used when multiple ResultPagingNavigationControllers are to be configured on the one mode.

Specified by:
getPagingParameter in interface SearchConfiguration
Returns:

setPagingParameter

public void setPagingParameter(String pagingParameter)
Parameters:
pagingParameter - the paginParameter
See Also:
getPagingParameter()

readSearchConfiguration

public SearchConfiguration readSearchConfiguration(Element element,
                                                   SearchConfiguration inherit,
                                                   SearchModeFactory.Context context)
Description copied from interface: SearchConfiguration.ModesW3cDomDeserialiser
Apply the attributes found in element to 'this'. If some attributes are not found in element then try to fetch them from inherit and set them on 'this'.

Specified by:
readSearchConfiguration in interface SearchConfiguration.ModesW3cDomDeserialiser
Returns:
The newly read configuration (chaining pattern)

toStringLong

public String toStringLong()

toString

public String toString()
Overrides:
toString in class Object

getUserSortParameter

public String getUserSortParameter()
Getter for the userSortParameter property.

Specified by:
getUserSortParameter in interface SearchConfiguration
Returns:
the userSortParameter value

setUserSortParameter

public void setUserSortParameter(String userSortParameter)
Setter for the userSortParameter property.

Parameters:
userSortParameter - the new userSortParameter value

parseNavigators

protected final Collection<Navigator> parseNavigators(Element navsE)
Deprecated. Use FacetedCommandConfigUtility.parseNavigators(Element) instead.

Currently only used by the fast subclasses but hopefully open to all one day. *

Parameters:
navsE - w3c dom elements to deserialise
Returns:
collection of Navigators


Copyright © 2005-2009 Schibsted ASA. All Rights Reserved.