public class SearchAction extends ServiceableAction implements Contextualizable
Modifier and Type | Field and Description |
---|---|
protected ContentTypeExtensionPoint |
_contentTypeExtensionPoint
The ContentType Manager
|
protected Context |
_context
The avalon context
|
protected JSONUtils |
_jsonUtils
The JSON utilities.
|
protected ContentSearcherFactory |
_searcherFactory
The searcher factory.
|
protected SearchUIModelExtensionPoint |
_searchModelManager
The search model manager
|
protected ServerCommHelper |
_serverCommHelper
The server comm helper
|
static String |
QUERY_ERROR
Name of request attribute for storing the query error, if any.
|
static String |
SEARCH_CONTENTS
Name of request attribute for storing contents' ids
|
static String |
SEARCH_MODEL
Name of request attribute for storing the search model
|
static String |
SEARCH_RESULTS
Name of request attribute for storing search results
|
manager
EMPTY_MAP
Constructor and Description |
---|
SearchAction() |
Modifier and Type | Method and Description |
---|---|
Map |
act(Redirector redirector,
SourceResolver resolver,
Map objectModel,
String source,
Parameters parameters) |
void |
contextualize(Context context) |
protected void |
doSearch(Request request,
SearchUIModel model,
int offset,
int maxResults,
Map<String,Object> jsParameters,
Map<String,Object> contextualParameters)
Do the search and set the results in request attributes.
|
protected int |
getMaxResults(SearchUIModel uiModel,
Map<String,Object> jsParameters,
Map<String,Object> contextualParameters)
Get the max number of results
|
protected int |
getOffset(Map<String,Object> jsParameters)
Get the index of search
|
protected SearchUIModel |
getSearchUIModel(Map<String,Object> jsParameters,
Map<String,Object> contextualParameters)
Get the search UI model
|
protected List<Sort> |
getSort(String sortString)
Get the sort criteria from a sort string.
|
void |
service(ServiceManager smanager) |
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
public static final String SEARCH_CONTENTS
public static final String SEARCH_RESULTS
public static final String SEARCH_MODEL
public static final String QUERY_ERROR
protected SearchUIModelExtensionPoint _searchModelManager
protected ContentTypeExtensionPoint _contentTypeExtensionPoint
protected ServerCommHelper _serverCommHelper
protected ContentSearcherFactory _searcherFactory
protected JSONUtils _jsonUtils
public SearchAction()
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
public void service(ServiceManager smanager) throws ServiceException
service
in interface Serviceable
service
in class ServiceableAction
ServiceException
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception
protected void doSearch(Request request, SearchUIModel model, int offset, int maxResults, Map<String,Object> jsParameters, Map<String,Object> contextualParameters) throws Exception
request
- The request. The results or contents' id have to be set in request attributesmodel
- The search UI modeloffset
- The index of searchmaxResults
- The max resultsjsParameters
- The JS parameterscontextualParameters
- The contextual parametersException
- if the search failedprotected SearchUIModel getSearchUIModel(Map<String,Object> jsParameters, Map<String,Object> contextualParameters)
jsParameters
- The JS parameterscontextualParameters
- The contextual parametersprotected int getOffset(Map<String,Object> jsParameters)
jsParameters
- The JS parametersprotected int getMaxResults(SearchUIModel uiModel, Map<String,Object> jsParameters, Map<String,Object> contextualParameters)
uiModel
- The search UI modeljsParameters
- The JS parameterscontextualParameters
- The contextual parameters