SMILA (incubation) API documentation

org.eclipse.smila.search.api.helper
Class QueryParameterAccessor

java.lang.Object
  extended by org.eclipse.smila.processing.parameters.ParameterAccessor
      extended by org.eclipse.smila.search.api.helper.QueryParameterAccessor
Direct Known Subclasses:
SolrQueryParameterAccessor

public class QueryParameterAccessor
extends ParameterAccessor

access to Query parameters as defined in the SMILA search API. Sets the parameter attribute to null, i.e. parameters are expected at root level. See description of Search API at http://wiki.eclipse.org/SMILA/Documentation/Search


Field Summary
 
Fields inherited from class org.eclipse.smila.processing.parameters.ParameterAccessor
_blackboard, _config, _parametersAttribute, _recordId, DEFAULT_PARAMETERS_ATTRIBUTE
 
Constructor Summary
QueryParameterAccessor(Blackboard blackboard, AnyMap configuration, java.lang.String queryRecordId)
          create accessor for given blackboard and request record.
QueryParameterAccessor(Blackboard blackboard, java.lang.String queryRecordId)
          create accessor for given blackboard and request record.
 
Method Summary
 AnyMap getFilter(java.lang.String attributeName)
           
 java.util.Iterator<java.lang.String> getFilterAttributeNames()
           
 java.util.LinkedHashMap<java.lang.String,AnyMap> getFilters()
           
 java.util.List<AnyMap> getGroupByConfig()
           
 java.util.List<java.lang.String> getHighlightAttributeNames()
           
 java.lang.String getIndexName()
          get the value of indexName parameter.
 java.lang.String getLanguage()
          get the value of language parameter.
 int getMaxCount()
          get the value of result size parameter.
 int getOffset()
          get the value of result offset parameter.
 java.lang.String getQuery()
          access to predefined parameters as supported in the search API.
 java.util.List<Value> getQueryAttributeValues(java.lang.String name)
           
 java.lang.String getQueryRequired()
          access to predefined parameters as supported in the search API.
 Any getRankingConfig()
           
 java.util.List<java.lang.String> getResultAttributes()
          Get the values (names of attributes) of resultAttributes parameter.
 java.util.Iterator<java.lang.String> getSortByAttributeNames()
          get iterator on names of attributes that have an order-by parameter set.
 java.util.LinkedHashMap<java.lang.String,QueryConstants.SortOrder> getSortByConfig()
           
 QueryConstants.SortOrder getSortOrder(java.lang.String attributeName)
          get sort order for an attribute.
 double getThreshold()
          get the value of threshold parameter.
 boolean hasFilters()
           
 boolean hasQueryAttribute(java.lang.String name)
           
 boolean hasQueryAttributes()
           
 ParameterAccessor setCurrentRecord(java.lang.String queryRecordId)
          set the ID of the record to read parameters from.
 ParameterAccessor setPipeletConfiguration(AnyMap config)
          set the configuration of the current pipelet, to read fallback values for missing parameters.
 
Methods inherited from class org.eclipse.smila.processing.parameters.ParameterAccessor
getBooleanParameter, getFloatParameter, getIntParameter, getParameter, getParameterAny, getParameterAttribute, getParameters, getRequiredBooleanParameter, getRequiredFloatParameter, getRequiredIntParameter, getRequiredParameter, getRequiredParameters, getSubParameter, getSubParameters, setParameterAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryParameterAccessor

public QueryParameterAccessor(Blackboard blackboard,
                              java.lang.String queryRecordId)
create accessor for given blackboard and request record.

Parameters:
blackboard - blackboard instance.
queryRecordId - search request record

QueryParameterAccessor

public QueryParameterAccessor(Blackboard blackboard,
                              AnyMap configuration,
                              java.lang.String queryRecordId)
create accessor for given blackboard and request record.

Parameters:
blackboard - blackboard instance.
configuration - pipelet configuration
queryRecordId - search request record
Method Detail

setCurrentRecord

public ParameterAccessor setCurrentRecord(java.lang.String queryRecordId)
set the ID of the record to read parameters from.

Overrides:
setCurrentRecord in class ParameterAccessor
Parameters:
queryRecordId - current record to proces.
Returns:
"this", make it easier to use this method immediately after constructor.

setPipeletConfiguration

public ParameterAccessor setPipeletConfiguration(AnyMap config)
set the configuration of the current pipelet, to read fallback values for missing parameters.

Overrides:
setPipeletConfiguration in class ParameterAccessor
Parameters:
config - pipelet configuration.
Returns:
"this", make it easier to use this method immediately after constructor

getQuery

public java.lang.String getQuery()
access to predefined parameters as supported in the search API.

Returns:
textual query string. null, if none is set.

getQueryRequired

public java.lang.String getQueryRequired()
                                  throws MissingParameterException
access to predefined parameters as supported in the search API.

Returns:
textual query string.
Throws:
MissingParameterException - if query is not set.

hasQueryAttributes

public boolean hasQueryAttributes()
Returns:
true, if the request contains a fielded query instead of a simple query string.

hasQueryAttribute

public boolean hasQueryAttribute(java.lang.String name)
Parameters:
name - attribute name
Returns:
true, if the request contains a fielded query with the given attribute.

getQueryAttributeValues

public java.util.List<Value> getQueryAttributeValues(java.lang.String name)
Parameters:
name - query attribute name
Returns:
values of query attribute.

getMaxCount

public int getMaxCount()
get the value of result size parameter. Default value is 10.

Returns:
value of result size parameter.

getOffset

public int getOffset()
get the value of result offset parameter. Default value is 0.

Returns:
value of result offset parameter

getThreshold

public double getThreshold()
get the value of threshold parameter. Default value is 0.0.

Returns:
value of threshold parameter

getLanguage

public java.lang.String getLanguage()
get the value of language parameter. Default value is null

Returns:
value of language parameter

getIndexName

public java.lang.String getIndexName()
get the value of indexName parameter. Default value is null

Returns:
value of indexName parameter

getResultAttributes

public java.util.List<java.lang.String> getResultAttributes()
Get the values (names of attributes) of resultAttributes parameter. Default value is an empty list.

Returns:
values of resultAttributes parameter

getSortByConfig

public java.util.LinkedHashMap<java.lang.String,QueryConstants.SortOrder> getSortByConfig()
Returns:
sortby configs by attribute

getSortByAttributeNames

public java.util.Iterator<java.lang.String> getSortByAttributeNames()
get iterator on names of attributes that have an order-by parameter set. Order of iteration is order of precedence in ordering.

Returns:
names of attributes to be ordered.

getSortOrder

public QueryConstants.SortOrder getSortOrder(java.lang.String attributeName)
get sort order for an attribute.

Parameters:
attributeName - attribute name
Returns:
order for attribute, if specified, or null else.

getHighlightAttributeNames

public java.util.List<java.lang.String> getHighlightAttributeNames()
Returns:
iterator on names of attributes mentioned in highlight config.

getFilters

public java.util.LinkedHashMap<java.lang.String,AnyMap> getFilters()
Returns:
filters by attribute

hasFilters

public boolean hasFilters()
Returns:
true if query has filters on attributes.

getFilterAttributeNames

public java.util.Iterator<java.lang.String> getFilterAttributeNames()
Returns:
iterator on names of attributes for which filters are defined

getFilter

public AnyMap getFilter(java.lang.String attributeName)
Parameters:
attributeName - filter attribute name
Returns:
attribute filter. Null, if no filter is set.

getRankingConfig

public Any getRankingConfig()
Returns:
content of ranking parameter.

getGroupByConfig

public java.util.List<AnyMap> getGroupByConfig()
Returns:
content of groupby parameter

SMILA (incubation) API documentation