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
public class AutocompletionSearchAction extends ServiceableAction
Get the proposed program's pages and skills for auto-completion while beginning a search 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected SearcherFactory_searcherFactoryThe search factoryprotected static intNB_MAX_RESULTSThe default max number of 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 AutocompletionSearchAction() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private String_escapeQuery(String text)Mapact(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters)protected Map<String,Object>getContentHit(Content content)Get the JSON representation of a content hitprotected AmetysObjectIterable<Page>getContentPages(String cType, String siteName, String lang, String escapedQuery, int limit)Get the content pages matching the queryprotected Map<String,Object>getPageHit(Page page)Get the JSON representation of a page hitprotected AmetysObjectIterable<Content>getSkills(String escapedQuery, String lang, int limit)Get the skills contents matching the queryvoidservice(ServiceManager serviceManager)- 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger 
 - 
 
 - 
 
- 
- 
Field Detail
- 
NB_MAX_RESULTS
protected static final int NB_MAX_RESULTS
The default max number of results- See Also:
 - Constant Field Values
 
 
- 
_searcherFactory
protected SearcherFactory _searcherFactory
The search factory 
 - 
 
- 
Constructor Detail
- 
AutocompletionSearchAction
public AutocompletionSearchAction()
 
 - 
 
- 
Method Detail
- 
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
 servicein interfaceServiceable- Overrides:
 servicein classServiceableAction- Throws:
 ServiceException
 
- 
act
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception
- Throws:
 Exception
 
- 
getContentPages
protected AmetysObjectIterable<Page> getContentPages(String cType, String siteName, String lang, String escapedQuery, int limit) throws Exception
Get the content pages matching the query- Parameters:
 cType- The content type of pages to searchsiteName- the site namelang- the languageescapedQuery- the querylimit- the max number of results- Returns:
 - the matching pages
 - Throws:
 Exception- if an error occurred during search
 
- 
getSkills
protected AmetysObjectIterable<Content> getSkills(String escapedQuery, String lang, int limit) throws Exception
Get the skills contents matching the query- Parameters:
 escapedQuery- the querylang- the languagelimit- the max number of results- Returns:
 - the matching contents
 - Throws:
 Exception- if an error occurred during search
 
- 
_escapeQuery
private String _escapeQuery(String text)
 
- 
getPageHit
protected Map<String,Object> getPageHit(Page page)
Get the JSON representation of a page hit- Parameters:
 page- the page- Returns:
 - the page as json
 
 
- 
getContentHit
protected Map<String,Object> getContentHit(Content content)
Get the JSON representation of a content hit- Parameters:
 content- the content- Returns:
 - the content as json
 
 
 - 
 
 -