Class AutocompletionSearchAction
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.acting.AbstractAction
org.apache.cocoon.acting.ServiceableAction
org.ametys.plugins.odfweb.service.search.AutocompletionSearchAction
- All Implemented Interfaces:
Component
,LogEnabled
,Serviceable
,Action
Get the proposed program's pages and skills for auto-completion while beginning a search
-
Field Summary
Modifier and TypeFieldDescriptionprotected SearcherFactory
The search factoryprotected SearchServiceInstanceManager
Component for search serviceprotected static final int
The default max number of resultsFields inherited from class org.apache.cocoon.acting.ServiceableAction
manager
Fields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
_setRightCheckingMode
(SearcherFactory.Searcher searcher, RightCheckingMode rightCheckingMode) Set whether to check rights when searching,act
(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) getCatalogNames
(String zoneItemId) Get the configured catalog in search criteriagetContentHit
(Content content) Get the JSON representation of a content hitprotected AmetysObjectIterable<Content>
getContents
(String cType, String siteName, String lang, List<String> catalogNames, String escapedQuery, int limit, RightCheckingMode rightCheckingMode) Get the content pages matching the querygetPageHit
(Content content, String siteName, Page odfRootPage) Get the JSON representation of a page hitprotected RightCheckingMode
getRightCheckingMode
(String zoneItemId) Get the mode for checking rightsprotected AmetysObjectIterable<Content>
getSkills
(String escapedQuery, String lang, int limit, RightCheckingMode rightCheckingMode) Get the skills contents matching the queryvoid
service
(ServiceManager serviceManager) Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
NB_MAX_RESULTS
The default max number of results- See Also:
-
_searcherFactory
The search factory -
_searchServiceInstanceManager
Component for search service
-
-
Constructor Details
-
AutocompletionSearchAction
public AutocompletionSearchAction()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classServiceableAction
- Throws:
ServiceException
-
act
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception - Throws:
Exception
-
getCatalogNames
Get the configured catalog in search criteria- Parameters:
zoneItemId
- The id of zone item- Returns:
- the catalog's name
-
getRightCheckingMode
Get the mode for checking rights- Parameters:
zoneItemId
- the id of zone item- Returns:
- the mode for checking rights
-
getContents
protected AmetysObjectIterable<Content> getContents(String cType, String siteName, String lang, List<String> catalogNames, String escapedQuery, int limit, RightCheckingMode rightCheckingMode) throws Exception Get the content pages matching the query- Parameters:
cType
- The content type of pages to searchsiteName
- the site namelang
- the languagecatalogNames
- The name of catalog to take into account. Can be emptyescapedQuery
- the querylimit
- the max number of resultsrightCheckingMode
- the mode for checking rights- Returns:
- the matching pages
- Throws:
Exception
- if an error occurred during search
-
getSkills
protected AmetysObjectIterable<Content> getSkills(String escapedQuery, String lang, int limit, RightCheckingMode rightCheckingMode) throws Exception Get the skills contents matching the query- Parameters:
escapedQuery
- the querylang
- the languagelimit
- the max number of resultsrightCheckingMode
- the mode for checking rights- Returns:
- the matching contents
- Throws:
Exception
- if an error occurred during search
-
_setRightCheckingMode
protected void _setRightCheckingMode(SearcherFactory.Searcher searcher, RightCheckingMode rightCheckingMode) Set whether to check rights when searching,- Parameters:
searcher
- the searcherrightCheckingMode
- the the mode for checking rights
-
getPageHit
Get the JSON representation of a page hit- Parameters:
content
- the contentsiteName
- the current site nameodfRootPage
- the ODF root page. Can be null if search is configured for multiple catalogs- Returns:
- the page as json
-
getContentHit
Get the JSON representation of a content hit- Parameters:
content
- the content- Returns:
- the content as json
-