Class SolrResourceIndexer
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.cms.content.indexing.solr.SolrResourceIndexer
- All Implemented Interfaces:
SolrFieldNames
,LogEnabled
,Component
,Serviceable
public class SolrResourceIndexer
extends AbstractLogEnabled
implements Component, Serviceable, SolrFieldNames
Solr resource indexer.
Populate a Solr input document with the following fields:
- id
- resource id
- type
- with
"document"
value - full
- resource content
-
Field Summary
Modifier and TypeFieldDescriptionprotected LanguagesManager
The language manager.protected SolrIndexer
The solr indexerprotected Tika
The Tika instance.static final String
The avalon role.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_NONVALIDATED, CONTENT_COMMENTS_VALIDATED, CONTENT_CREATOR, CONTENT_FIRST_VALIDATOR, CONTENT_LANGUAGE, CONTENT_LANGUAGES, CONTENT_LAST_CONTRIBUTOR, CONTENT_LAST_MAJOR_VALIDATOR, CONTENT_LAST_VALIDATOR, CONTENT_NAME, CONTENT_OUTGOING_REFEERENCES_RESOURCE_IDS, CONTENT_TITLES, CONTENT_TYPE_RESOURCE, CONTENT_TYPES, CONTENT_VISIBLE_ATTACHMENT_RESOURCE_IDS, CREATION_DATE, DATE_FOR_SORTING, DATES_FACET, 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, EXACT_WS_OPERATOR, EXCERPT, FILENAME, FULL, ID, ID_DV, IS_AMETYS_OBJECT, LANGUAGE_SEPARATOR, LAST_MODIFIED, 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, STEMMED_OPERATOR, SUB_CONTENT, SYSTEM_FULL, 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_ACTIONID, WORKFLOW_STEP_CALLER, WORKFLOW_STEP_DUEDATE, WORKFLOW_STEP_FINISHDATE, WORKFLOW_STEP_ID, WORKFLOW_STEP_OWNER, WORKFLOW_STEP_STARTDATE, WORKFLOW_STEP_STATUS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
_populateDatesOfPage
(Resource resource, org.apache.solr.common.SolrInputDocument document) Populate the solr input document with dates from the resourcevoid
indexDublinCoreMetadata
(DublinCoreAwareAmetysObject object, org.apache.solr.common.SolrInputDocument document) Index Dublin core metadata.protected void
indexFulltextValue
(org.apache.solr.common.SolrInputDocument document, String text, String language) Index a full-text value.void
indexResource
(Resource resource, org.apache.solr.common.SolrInputDocument document, String documentType) Index a resource.void
indexResource
(Resource resource, org.apache.solr.common.SolrInputDocument document, String documentType, String language) Index a resource.void
indexResource
(Resource resource, org.apache.solr.common.SolrInputDocument document, String documentType, String language, TraversableAmetysObject resourceRoot) Index a resource.void
indexResource
(Resource resource, org.apache.solr.common.SolrInputDocument document, String documentType, TraversableAmetysObject resourceRoot) Index a resource.void
indexResourceCollection
(ResourceCollection resourceCollection, org.apache.solr.common.SolrInputDocument document, String language) Index a collection of resources.void
indexResourceContent
(Resource resource, org.apache.solr.common.SolrInputDocument document, String language) Index a resource content (text in case of a document, and Dublin Core metadata).void
service
(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The avalon role. -
_tika
The Tika instance. -
_langManager
The language manager. -
_solrIndexer
The solr indexer
-
-
Constructor Details
-
SolrResourceIndexer
public SolrResourceIndexer()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
indexResource
public void indexResource(Resource resource, org.apache.solr.common.SolrInputDocument document, String documentType) throws Exception Index a resource.- Parameters:
resource
- The resource to index.document
- The Solr document to index into.documentType
- The document type of the resource- Throws:
Exception
- if an error occurs.
-
indexResource
public void indexResource(Resource resource, org.apache.solr.common.SolrInputDocument document, String documentType, String language) throws Exception Index a resource.- Parameters:
resource
- The resource to index.document
- The Solr document to index into.documentType
- The document type of the resourcelanguage
- The query language.- Throws:
Exception
- if an error occurs.
-
indexResource
public void indexResource(Resource resource, org.apache.solr.common.SolrInputDocument document, String documentType, TraversableAmetysObject resourceRoot) throws Exception Index a resource.- Parameters:
resource
- The resource to index.document
- The Solr document to index into.documentType
- The document type of the resourceresourceRoot
- The resource root, can be null. When null, it will have to be computed.- Throws:
Exception
- if an error occurs.
-
indexResource
public void indexResource(Resource resource, org.apache.solr.common.SolrInputDocument document, String documentType, String language, TraversableAmetysObject resourceRoot) throws Exception Index a resource.- Parameters:
resource
- The resource to index.document
- The Solr document to index into.documentType
- The document type of the resourcelanguage
- The language, can be null.resourceRoot
- The resource root, can be null. When null, it will have to be computed.- Throws:
Exception
- if an error occurs.
-
_populateDatesOfPage
protected void _populateDatesOfPage(Resource resource, org.apache.solr.common.SolrInputDocument document) Populate the solr input document with dates from the resource- Parameters:
resource
- The resourcedocument
- The Solr document
-
indexResourceCollection
public void indexResourceCollection(ResourceCollection resourceCollection, org.apache.solr.common.SolrInputDocument document, String language) throws Exception Index a collection of resources.- Parameters:
resourceCollection
- the resource collection to index.document
- The document to index into.language
- The current language.- Throws:
Exception
- if an error occurs while indexing.
-
indexResourceContent
public void indexResourceContent(Resource resource, org.apache.solr.common.SolrInputDocument document, String language) Index a resource content (text in case of a document, and Dublin Core metadata).- Parameters:
resource
- The resource to index.document
- The document to index into.language
- The current language, can be null.
-
indexFulltextValue
protected void indexFulltextValue(org.apache.solr.common.SolrInputDocument document, String text, String language) Index a full-text value.- Parameters:
document
- The document to index into.text
- The text to index.language
- The content language, can be null.
-
indexDublinCoreMetadata
public void indexDublinCoreMetadata(DublinCoreAwareAmetysObject object, org.apache.solr.common.SolrInputDocument document) Index Dublin core metadata.- Parameters:
object
- theDublinCoreAwareAmetysObject
holding Dublin Core metadata.document
- the solr input document to populate.
-