public class SearchJsonReader extends ServiceableReader
Modifier and Type | Field and Description |
---|---|
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)
Convert the query results to a JSON object
|
protected void |
convertResults2JsonObject(Map<String,Object> results2Json,
SearchResults<Content> results,
SearchUIModel model)
Convert the query results to a JSON object
|
void |
generate() |
protected Map<String,Object> |
getContentData(Content content,
ContentValuesExtractorFactory.SearchModelContentValuesExtractor extractor,
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,
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,
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,
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 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) throws ProcessingException
results2Json
- the JSON object to fill.results
- the query resultsmodel
- the search modelProcessingException
- If an error occurs.protected void convertContents2JsonObject(Map<String,Object> results2Json, List<String> contentIds, SearchUIModel model) throws ProcessingException
results2Json
- the JSON object to fill.contentIds
- the ids of contentsmodel
- the search modelProcessingException
- If an error occurs.protected void setContents(Map<String,Object> searchResults, SearchResults<Content> results, SearchUIModel model, 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.contextualParameters
- the search contextual parameters.protected int setContents(Map<String,Object> searchResults, List<String> contentIds, SearchUIModel model, Map<String,Object> contextualParameters)
searchResults
- the search results to populate.contentIds
- the id of desired contentsmodel
- the search model.contextualParameters
- the search contextual parameters.protected Map<String,Object> getContentData(Content content, ContentValuesExtractorFactory.SearchModelContentValuesExtractor extractor, Map<String,Object> contextualParameters)
content
- The content.extractor
- The content values extractor which generates.contextualParameters
- The search contextual parameters.protected void setFacets(Map<String,Object> searchResults, Map<String,Map<String,Integer>> facetResults, SearchUIModel model, 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.contextualParameters
- the search contextual parameters.