public class SearchJsonReader extends ServiceableReader
Modifier and Type | Field and Description |
---|---|
protected ContentHelper |
_contentHelper
The content helper
|
protected ContentTypesHelper |
_contentTypesHelper
The content types helper.
|
protected JSONUtils |
_jsonUtils
JSON utils
|
protected AmetysObjectResolver |
_resolver
The Ametys object resolver
|
protected ServerCommHelper |
_serverCommHelper
The serverComm helper
|
private ContentValuesExtractorFactory |
_valuesExtractorFactory |
manager
objectModel, out, parameters, resolver, source
Constructor and Description |
---|
SearchJsonReader() |
Modifier and Type | Method and Description |
---|---|
protected void |
convertContents2JsonObject(Map<String,Object> results2Json,
List<String> contentIds,
SearchUIModel model,
Locale defaultLocale)
Convert the query results to a JSON object
|
protected void |
convertResults2JsonObject(Map<String,Object> results2Json,
SearchResults<Content> results,
SearchUIModel model,
Locale defaultLocale)
Convert the query results to a JSON object
|
void |
generate() |
protected Map<String,Object> |
getContentData(Content content,
ContentValuesExtractorFactory.SearchModelContentValuesExtractor extractor,
Locale defaultLocale,
Map<String,Object> contextualParameters)
Generate standard content data.
|
String |
getMimeType() |
void |
service(ServiceManager smanager) |
protected int |
setContents(Map<String,Object> searchResults,
List<String> contentIds,
SearchUIModel model,
Locale defaultLocale,
Map<String,Object> contextualParameters)
Extract the desired contents and set them in the search results.
|
protected void |
setContents(Map<String,Object> searchResults,
SearchResults<Content> results,
SearchUIModel model,
Locale defaultLocale,
Map<String,Object> contextualParameters)
Extract the desired contents from the
SearchResults object and set them in the search results. |
protected void |
setFacets(Map<String,Object> searchResults,
Map<String,Map<String,Integer>> facetResults,
SearchUIModel model,
Locale locale,
Map<String,Object> contextualParameters)
Set the facet results in the search results.
|
getLastModified, recycle, setOutputStream, setup, shouldSetContentLength
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
protected JSONUtils _jsonUtils
protected ServerCommHelper _serverCommHelper
protected ContentTypesHelper _contentTypesHelper
protected ContentHelper _contentHelper
protected AmetysObjectResolver _resolver
private ContentValuesExtractorFactory _valuesExtractorFactory
public SearchJsonReader()
public void service(ServiceManager smanager) throws ServiceException
service
in interface Serviceable
service
in class ServiceableReader
ServiceException
public String getMimeType()
getMimeType
in interface SitemapOutputComponent
getMimeType
in class AbstractReader
public void generate() throws IOException, SAXException, ProcessingException
protected void convertResults2JsonObject(Map<String,Object> results2Json, SearchResults<Content> results, SearchUIModel model, Locale defaultLocale) throws ProcessingException
results2Json
- the JSON object to fill.results
- the query resultsmodel
- the search modeldefaultLocale
- the default locale for localized values if content's language is null.ProcessingException
- If an error occurs.protected void convertContents2JsonObject(Map<String,Object> results2Json, List<String> contentIds, SearchUIModel model, Locale defaultLocale) throws ProcessingException
results2Json
- the JSON object to fill.contentIds
- the ids of contentsmodel
- the search modeldefaultLocale
- the default locale for localized values if content's language is null.ProcessingException
- If an error occurs.protected void setContents(Map<String,Object> searchResults, SearchResults<Content> results, SearchUIModel model, Locale defaultLocale, Map<String,Object> contextualParameters)
SearchResults
object and set them in the search results.searchResults
- the search results to populate.results
- the SearchResults
.model
- the search model.defaultLocale
- the default locale for localized values if content's language is null.contextualParameters
- the search contextual parameters.protected int setContents(Map<String,Object> searchResults, List<String> contentIds, SearchUIModel model, Locale defaultLocale, Map<String,Object> contextualParameters)
searchResults
- the search results to populate.contentIds
- the id of desired contentsmodel
- the search model.defaultLocale
- the default locale for localized values if content's language is null.contextualParameters
- the search contextual parameters.protected Map<String,Object> getContentData(Content content, ContentValuesExtractorFactory.SearchModelContentValuesExtractor extractor, Locale defaultLocale, Map<String,Object> contextualParameters)
content
- The content.extractor
- The content values extractor which generates.defaultLocale
- the default locale for localized values if content's language is null.contextualParameters
- The search contextual parameters.protected void setFacets(Map<String,Object> searchResults, Map<String,Map<String,Integer>> facetResults, SearchUIModel model, Locale locale, Map<String,Object> contextualParameters)
searchResults
- the search results.facetResults
- the facet results as a Map<column name, Map<value, result count>>.model
- the search model.locale
- the locale for localized valuescontextualParameters
- the search contextual parameters.