Package org.ametys.web.frontoffice
Class SearchResourcesGenerator
-
- All Implemented Interfaces:
SolrFieldNames
,SolrWebFieldNames
,Poolable
,Recyclable
,Disposable
,Component
,Contextualizable
,LogEnabled
,Serviceable
,Generator
,SitemapModelComponent
,XMLProducer
public class SearchResourcesGenerator extends AbstractSearchGenerator
Generates the results of a search performed on front office
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.ametys.web.frontoffice.AbstractSearchGenerator
AbstractSearchGenerator.AttributeFacetField, AbstractSearchGenerator.ContentTypeFacetField, AbstractSearchGenerator.FacetField
-
-
Field Summary
Fields Modifier and Type Field Description protected DublinCoreMetadataProvider
_dcProvider
DublinCore providerprotected static String[]
AUDIO_MIMETYPE
MIME types for audio filesprotected static String[]
IMAGE_MIMETYPE
MIME types for imagesprotected static String[]
PDF_MIMETYPE
MIME types for pdfprotected static String[]
PRES_MIMETYPE
MIME types for presentationprotected static String[]
SPREADSHEET_MIMETYPE
MIME types for spreadsheetsprotected static String[]
TEXT_MIMETYPE
MIME types for text documentsprotected static String[]
VIDEO_MIMETYPE
MIME types for videos-
Fields inherited from class org.ametys.web.frontoffice.AbstractSearchGenerator
_contentTypesHelper, _context, _cTypeExtPt, _resolver, _searcherFactory, _searchHelper, _siteManager, _tagExtPt, _TEXTFIELD_PATTERN, _uriResolverEP, DOCUMENT_TYPE_IS_PAGE_RESOURCE_FACET_NAME
-
Fields inherited from class org.apache.cocoon.generation.ServiceableGenerator
manager
-
Fields inherited from class org.apache.cocoon.generation.AbstractGenerator
objectModel, parameters, resolver, source
-
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
-
Fields inherited from interface org.ametys.cms.content.indexing.solr.SolrFieldNames
ACL_INIT_VALUE_ALLOWED_GROUPS, ACL_INIT_VALUE_ALLOWED_USERS, ACL_INIT_VALUE_ANONYMOUS, ACL_INIT_VALUE_ANYCONNECTED, ACL_INIT_VALUE_DENIED_GROUPS, ACL_INIT_VALUE_DENIED_USERS, ALL_CONTENT_TYPES, ALL_MIXIN_TYPES, ALL_TAGS, ATTACHMENT_CONTENT_ID, CONTENT_COMMENTS, CONTENT_COMMENTS_NONVALIDATED, CONTENT_COMMENTS_VALIDATED, CONTENT_CREATOR, CONTENT_LANGUAGE, CONTENT_LANGUAGES, CONTENT_LAST_CONTRIBUTOR, CONTENT_NAME, CONTENT_OUTGOING_REFEERENCES_RESOURCE_IDS, CONTENT_TITLES, CONTENT_TYPE_RESOURCE, CONTENT_TYPES, CONTENT_VISIBLE_ATTACHMENT_RESOURCE_IDS, CREATION_DATE, DC_CONTRIBUTOR, DC_COVERAGE, DC_CREATOR, DC_DATE, DC_DESCRIPTION, DC_FORMAT, DC_IDENTIFIER, DC_LANGUAGE, DC_PUBLISHER, DC_RELATION, DC_RIGHTS, DC_SOURCE, DC_SUBJECT, DC_TITLE, DC_TYPE, DOCUMENT_TYPE, EXCERPT, FILENAME, FIRST_VALIDATION, FULL_EXACT_WS, FULL_GENERAL, FULL_PREFIX, FULL_STEMMED_PREFIX, ID, IS_AMETYS_OBJECT, LAST_MAJOR_VALIDATION, LAST_MODIFIED, LAST_VALIDATION, LENGTH, MIME_TYPES, MIXIN_TYPES, PATH, PSEUDO_CONTENT_TYPE_VALUE_RESOURCE, PSEUDO_CONTENT_TYPES, REPEATER_ENTRY_POSITION, RESOURCE_ANCESTOR_AND_SELF_IDS, RESOURCE_ANCESTOR_IDS, RESOURCE_CREATOR, RESOURCE_DATE, RESOURCE_LAST_MODIFIED, RESOURCE_MIME_TYPE_GROUP, RESOURCE_ROOT_ID, SIMPLE_CONTENT_PARENTS, SUB_CONTENT, TAGS, TITLE, TITLE_SORT, TYPE_CONTENT, TYPE_CONTENT_ATTACHMENT_RESOURCE, TYPE_CONTENT_ATTRIBUTE_RESOURCE, TYPE_REPEATER, TYPE_RESOURCE, TYPE_WF_ENTRY, TYPE_WF_STEP, WORKFLOW_CURRENT_STEPS, WORKFLOW_CURRENT_STEPS_DV, WORKFLOW_ENTRY_STATE, WORKFLOW_HISTORY_STEPS, WORKFLOW_HISTORY_STEPS_DV, WORKFLOW_NAME, WORKFLOW_REF, WORKFLOW_REF_DV, WORKFLOW_STEP, WORKFLOW_STEP_ACTIONID, WORKFLOW_STEP_CALLER, WORKFLOW_STEP_DUEDATE, WORKFLOW_STEP_FINISHDATE, WORKFLOW_STEP_ID, WORKFLOW_STEP_OWNER, WORKFLOW_STEP_STARTDATE, WORKFLOW_STEP_STATUS
-
Fields inherited from interface org.ametys.web.indexing.solr.SolrWebFieldNames
ATTACHMENT_PAGE_ID, CONTENT_IDS, CONTENT_INTERESTING_DATES, DATE_FOR_SORTING, DATES_FACET, FACETABLE_CONTENT_FIELD_PREFIX, LASTNAME_FOR_SORTING, ORPHAN, PAGE_ANCESTOR_IDS, PAGE_CONTENT_TYPES, PAGE_DEPTH, PAGE_IDS, PAGE_LONG_TITLE, PAGE_OUTGOING_REFEERENCES_RESOURCE_IDS, PAGE_PARENT_ID, PAGE_TITLE, PAGE_TYPE, PAGE_VISIBLE_ATTACHMENT_RESOURCE_IDS, PRIVACY, SECTION_PAGE_TITLE, SERVICE_IDS, SHARED, SITE_NAME, SITE_TYPE, SITEMAP_NAME, TEMPLATE, TYPE_PAGE, TYPE_PAGE_RESOURCE
-
-
Constructor Summary
Constructors Constructor Description SearchResourcesGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Collection<String>
getDocumentTypes(Request request)
Get the document types.protected Map<String,AbstractSearchGenerator.FacetField>
getFacets(Request request)
Get the facets from request parametersprotected Map<String,List<String>>
getFacetValues(Request request, Collection<String> siteNames, String language)
Get the facet valuesprotected Collection<String>
getFields()
Get the searchable fieldsprotected Collection<Query>
getFilterQueries(Request request, Collection<String> siteNames, String language)
Get the filter queries from the request parameters.protected List<Sort>
getPrimarySortFields(Request request)
Get the primary sort fieldsprotected Query
getQuery(Request request, Collection<String> siteNames, String language)
Get the query from request parametersprotected Set<FrontOfficeSearcherFactory.QueryFacet>
getQueryFacets(Request request)
Get the facet.queriesprotected Collection<String>
getQueryFacetValues(Request request)
Get the facet.query valuesprotected Sort
getSortField(Request request)
Get the sort fieldprotected void
saxFormFields(Request request, String siteName, String lang)
SAX the form search criteriaprotected void
saxFormValues(Request request, int start, int offset)
SAX the form search criteria valuesprotected void
saxHits(SearchResults<AmetysObject> results, int start, int maxResults)
SAX the result hitsvoid
service(ServiceManager smanager)
-
Methods inherited from class org.ametys.web.frontoffice.AbstractSearchGenerator
_additionalSearchProcessing, _checkRights, contextualize, generate, getDocumentTypesQuery, getPageIndex, getSearchMode, getZoneItem, isInputValid, saxAdditionalInfos, saxAdditionalInfosOnPageHit, saxContent, saxFacets, saxFormParameters, saxPageHit, saxPagination, saxResourceHit, saxRichTextExcerpt, saxServiceIdentifiers, saxSort, search, search, useFacets
-
Methods inherited from class org.apache.cocoon.generation.ServiceableGenerator
dispose
-
Methods inherited from class org.apache.cocoon.generation.AbstractGenerator
recycle, setup
-
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
-
-
-
-
Field Detail
-
IMAGE_MIMETYPE
protected static final String[] IMAGE_MIMETYPE
MIME types for images
-
VIDEO_MIMETYPE
protected static final String[] VIDEO_MIMETYPE
MIME types for videos
-
AUDIO_MIMETYPE
protected static final String[] AUDIO_MIMETYPE
MIME types for audio files
-
PDF_MIMETYPE
protected static final String[] PDF_MIMETYPE
MIME types for pdf
-
TEXT_MIMETYPE
protected static final String[] TEXT_MIMETYPE
MIME types for text documents
-
PRES_MIMETYPE
protected static final String[] PRES_MIMETYPE
MIME types for presentation
-
SPREADSHEET_MIMETYPE
protected static final String[] SPREADSHEET_MIMETYPE
MIME types for spreadsheets
-
_dcProvider
protected DublinCoreMetadataProvider _dcProvider
DublinCore provider
-
-
Constructor Detail
-
SearchResourcesGenerator
public SearchResourcesGenerator()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractSearchGenerator
- Throws:
ServiceException
-
getQuery
protected Query getQuery(Request request, Collection<String> siteNames, String language) throws IllegalArgumentException
Description copied from class:AbstractSearchGenerator
Get the query from request parameters- Specified by:
getQuery
in classAbstractSearchGenerator
- Parameters:
request
- The requestsiteNames
- The site names.language
- The language- Returns:
- The query object.
- Throws:
IllegalArgumentException
- If the search field is invalid.
-
getFilterQueries
protected Collection<Query> getFilterQueries(Request request, Collection<String> siteNames, String language) throws IllegalArgumentException
Description copied from class:AbstractSearchGenerator
Get the filter queries from the request parameters.- Specified by:
getFilterQueries
in classAbstractSearchGenerator
- Parameters:
request
- The request.siteNames
- The site names.language
- The language.- Returns:
- A collection of filter queries.
- Throws:
IllegalArgumentException
- If a search field is invalid.
-
getDocumentTypes
protected Collection<String> getDocumentTypes(Request request)
Description copied from class:AbstractSearchGenerator
Get the document types.- Specified by:
getDocumentTypes
in classAbstractSearchGenerator
- Parameters:
request
- The request.- Returns:
- the document types to search.
-
getFields
protected Collection<String> getFields()
Description copied from class:AbstractSearchGenerator
Get the searchable fields- Specified by:
getFields
in classAbstractSearchGenerator
- Returns:
- The fields
-
getFacets
protected Map<String,AbstractSearchGenerator.FacetField> getFacets(Request request) throws IllegalArgumentException
Description copied from class:AbstractSearchGenerator
Get the facets from request parameters- Specified by:
getFacets
in classAbstractSearchGenerator
- Parameters:
request
- The request- Returns:
- The facet fields
- Throws:
IllegalArgumentException
- If the search field is invalid.
-
getQueryFacets
protected Set<FrontOfficeSearcherFactory.QueryFacet> getQueryFacets(Request request)
Description copied from class:AbstractSearchGenerator
Get the facet.queries- Specified by:
getQueryFacets
in classAbstractSearchGenerator
- Parameters:
request
- The request- Returns:
- The facet.queries
-
getFacetValues
protected Map<String,List<String>> getFacetValues(Request request, Collection<String> siteNames, String language) throws IllegalArgumentException
Description copied from class:AbstractSearchGenerator
Get the facet values- Specified by:
getFacetValues
in classAbstractSearchGenerator
- Parameters:
request
- The requestsiteNames
- The site nameslanguage
- The language- Returns:
- The facet values
- Throws:
IllegalArgumentException
-
getQueryFacetValues
protected Collection<String> getQueryFacetValues(Request request)
Description copied from class:AbstractSearchGenerator
Get the facet.query values- Specified by:
getQueryFacetValues
in classAbstractSearchGenerator
- Parameters:
request
- The request- Returns:
- The facet.query values
-
saxHits
protected void saxHits(SearchResults<AmetysObject> results, int start, int maxResults) throws SAXException, IOException
Description copied from class:AbstractSearchGenerator
SAX the result hits- Specified by:
saxHits
in classAbstractSearchGenerator
- Parameters:
results
- The search results.start
- The start indexmaxResults
- The number of results to generate.- Throws:
SAXException
- If an error occurs while SAXingIOException
- If there is a low-level IO error
-
getSortField
protected Sort getSortField(Request request)
Description copied from class:AbstractSearchGenerator
Get the sort field- Specified by:
getSortField
in classAbstractSearchGenerator
- Parameters:
request
- The request- Returns:
- The sort field or null to sort by score
-
getPrimarySortFields
protected List<Sort> getPrimarySortFields(Request request)
Description copied from class:AbstractSearchGenerator
Get the primary sort fields- Specified by:
getPrimarySortFields
in classAbstractSearchGenerator
- Parameters:
request
- The request- Returns:
- the list additional sort fields or empty list.
-
saxFormFields
protected void saxFormFields(Request request, String siteName, String lang) throws SAXException
Description copied from class:AbstractSearchGenerator
SAX the form search criteria- Specified by:
saxFormFields
in classAbstractSearchGenerator
- Parameters:
request
- The requestsiteName
- The current site namelang
- The current language- Throws:
SAXException
- if an error occurs while SAXing
-
saxFormValues
protected void saxFormValues(Request request, int start, int offset) throws SAXException
Description copied from class:AbstractSearchGenerator
SAX the form search criteria values- Specified by:
saxFormValues
in classAbstractSearchGenerator
- Parameters:
request
- The requeststart
- The start indexoffset
- The number of results- Throws:
SAXException
- if an error occurs while SAXing
-
-