Package org.ametys.cms.search.solr
Class SolrQuerySearchAction
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.apache.cocoon.acting.AbstractAction
-
- org.apache.cocoon.acting.ServiceableAction
-
- org.ametys.cms.search.cocoon.SearchAction
-
- org.ametys.cms.search.solr.SolrQuerySearchAction
-
- All Implemented Interfaces:
Component,Contextualizable,LogEnabled,Serviceable,Action
public class SolrQuerySearchAction extends SearchAction
Execute a solr query with custom columns and facets.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classSolrQuerySearchAction.SearchValuesObject representing search values.
-
Field Summary
Fields Modifier and Type Field Description protected ColumnHelper_columnHelperThe helper for columnsprotected ContentTypesHelper_contentTypesHelperThe content types helper.-
Fields inherited from class org.ametys.cms.search.cocoon.SearchAction
_contentTypeExtensionPoint, _context, _getQueryFromJSONHelper, _queryBuilder, _searcherFactory, _searchModelManager, _serverCommHelper, QUERY_ERROR, SEARCH_CONTENTS, SEARCH_LOCALE, SEARCH_MODEL, SEARCH_RESULTS
-
Fields inherited from class org.apache.cocoon.acting.ServiceableAction
manager
-
Fields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP
-
-
Constructor Summary
Constructors Constructor Description SolrQuerySearchAction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoSearch(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 ContentSearcherFactory.SimpleContentSearchergetContentSearcher(SolrQuerySearchAction.SearchValues searchValues, int offset, int maxResults, Collection<String> facets, List<Sort> sorts)Get the content search from the search valuesprotected StringgetQueryString(SolrQuerySearchAction.SearchValues searchValues)Get the query string from the search values.protected SearchResults<Content>getResults(SolrQuerySearchAction.SearchValues searchValues, int offset, int maxResults, Collection<String> facets, List<Sort> sorts)Create the searcher and execute it from the search values.protected SolrQuerySearchAction.SearchValuesgetSearchValues(Map<String,Object> jsParameters)Get the object representing search values from the JS parameters.voidservice(ServiceManager serviceManager)-
Methods inherited from class org.ametys.cms.search.cocoon.SearchAction
act, contextualize, getMaxResults, getOffset, getSearchUIModel, getSort
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_contentTypesHelper
protected ContentTypesHelper _contentTypesHelper
The content types helper.
-
_columnHelper
protected ColumnHelper _columnHelper
The helper for columns
-
-
Constructor Detail
-
SolrQuerySearchAction
public SolrQuerySearchAction()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classSearchAction- Throws:
ServiceException
-
doSearch
protected void doSearch(Request request, SearchUIModel model, int offset, int maxResults, Map<String,Object> jsParameters, Map<String,Object> contextualParameters) throws Exception
Description copied from class:SearchActionDo the search and set the results in request attributes.- Overrides:
doSearchin classSearchAction- Parameters:
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 parameters- Throws:
Exception- if the search failed
-
getSearchValues
protected SolrQuerySearchAction.SearchValues getSearchValues(Map<String,Object> jsParameters)
Get the object representing search values from the JS parameters.- Parameters:
jsParameters- The JS parameters- Returns:
- an object representing the search values
-
getQueryString
protected String getQueryString(SolrQuerySearchAction.SearchValues searchValues) throws QuerySyntaxException
Get the query string from the search values.- Parameters:
searchValues- The search values- Returns:
- the query string
- Throws:
QuerySyntaxException- if an error occurs
-
getResults
protected SearchResults<Content> getResults(SolrQuerySearchAction.SearchValues searchValues, int offset, int maxResults, Collection<String> facets, List<Sort> sorts) throws Exception
Create the searcher and execute it from the search values.- Parameters:
searchValues- The search valuesoffset- The offsetmaxResults- The max number of resultsfacets- Facets renamed for Solrsorts- The sorts- Returns:
- the search results
- Throws:
Exception- if an error occurs
-
getContentSearcher
protected ContentSearcherFactory.SimpleContentSearcher getContentSearcher(SolrQuerySearchAction.SearchValues searchValues, int offset, int maxResults, Collection<String> facets, List<Sort> sorts)
Get the content search from the search values- Parameters:
searchValues- The search valuesoffset- The offsetmaxResults- The max number of resultsfacets- Facets renamed for Solrsorts- The sorts- Returns:
- the content searcher
-
-