public class AutocompletionSearchAction extends ServiceableAction
Modifier and Type | Field and Description |
---|---|
protected SearcherFactory |
_searcherFactory
The search factory
|
protected static int |
NB_MAX_RESULTS
The default max number of results
|
manager
EMPTY_MAP
Constructor and Description |
---|
AutocompletionSearchAction() |
Modifier and Type | Method and Description |
---|---|
private String |
_escapeQuery(String text) |
Map |
act(Redirector redirector,
SourceResolver resolver,
Map objectModel,
String source,
Parameters parameters) |
protected Map<String,Object> |
getContentHit(Content content)
Get the JSON representation of a content hit
|
protected AmetysObjectIterable<Page> |
getContentPages(String cType,
String siteName,
String lang,
String escapedQuery,
int limit)
Get the content pages matching the query
|
protected Map<String,Object> |
getPageHit(Page page)
Get the JSON representation of a page hit
|
protected AmetysObjectIterable<Content> |
getSkills(String escapedQuery,
String lang,
int limit)
Get the skills contents matching the query
|
void |
service(ServiceManager serviceManager) |
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
protected static final int NB_MAX_RESULTS
protected SearcherFactory _searcherFactory
public AutocompletionSearchAction()
public void service(ServiceManager serviceManager) 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
Exception
protected AmetysObjectIterable<Page> getContentPages(String cType, String siteName, String lang, String escapedQuery, int limit) throws Exception
cType
- The content type of pages to searchsiteName
- the site namelang
- the languageescapedQuery
- the querylimit
- the max number of resultsException
- if an error occurred during searchprotected AmetysObjectIterable<Content> getSkills(String escapedQuery, String lang, int limit) throws Exception
escapedQuery
- the querylang
- the languagelimit
- the max number of resultsException
- if an error occurred during searchprivate String _escapeQuery(String text)
protected Map<String,Object> getPageHit(Page page)
page
- the pageprotected Map<String,Object> getContentHit(Content content)
content
- the content