public class SolrPageIndexer extends AbstractLogEnabled implements Component, Serviceable, SolrWebFieldNames, Contextualizable
Modifier and Type | Field and Description |
---|---|
protected AdditionalPropertyIndexerExtensionPoint |
_additionalPropertiesIndexerEP
The additional property indexer extension point.
|
protected AmetysObjectResolver |
_ametysObjectResolver
The Ametys object resolver
|
protected Context |
_context
The avalon context
|
private ContentTypesHelper |
_cTypesHelper |
protected ServiceExtensionPoint |
_serviceExtensionPoint
The service extension point.
|
protected SolrClientProvider |
_solrClientProvider
The Solr client provider
|
protected SolrContentIndexer |
_solrContentIndexer
Solr Ametys contents indexer
|
protected SolrIndexer |
_solrIndexer
The Solr indexer
|
protected SolrResourceIndexer |
_solrResourceIndexer
Solr Ametys resources indexer
|
protected TagProviderExtensionPoint |
_tagProviderEP
The tag provider extension point.
|
static String |
ROLE
The avalon role.
|
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_TITLE, PAGE_TYPE, PRIVACY, SECTION_PAGE_TITLE, SERVICE_IDS, SHARED, SITE_NAME, SITE_TYPE, SITEMAP_NAME, TEMPLATE, TYPE_PAGE, TYPE_PAGE_RESOURCE
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, 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, 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, REPEATER_ENTRY_POSITION, RESOURCE_ANCESTOR_IDS, RESOURCE_CREATOR, RESOURCE_DATE, RESOURCE_LAST_MODIFIED, RESOURCE_ROOT_ID, SIMPLE_CONTENT_PARENTS, SUB_CONTENT, TAGS, TITLE, TITLE_SORT, TYPE_CONTENT, TYPE_CONTENT_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
Constructor and Description |
---|
SolrPageIndexer() |
Modifier and Type | Method and Description |
---|---|
protected void |
_findAndIndexFacetableField(String[] pathSegments,
String lang,
CompositeMetadata metadata,
MetadataDefinition definition,
IndexingField field,
SolrInputDocument pageDocument)
Index the facetable fields of a content into the page solr document
|
protected Date |
_getLastModificationDate(Page page)
Computes the last modification date of a page.
|
protected Date |
_getLastValidationDate(Page page)
Computes the last validation date of a page.
|
protected Set<String> |
_getTagsWithAncestors(Page page)
Get all the page tags with their ancestors.
|
protected void |
_indexFacetableField(Content content,
SolrInputDocument document)
Index the facetable fields of a content into the page solr document
|
private void |
_indexPage(Page page,
String workspaceName,
boolean indexRecursively,
boolean indexAttachments) |
private void |
_indexPageAttachment(Resource resource,
SolrInputDocument document,
Page page) |
protected void |
_indexPageDocument(Page page,
SolrInputDocument document,
String workspaceName)
Index a populated solr input document of type Page.
|
protected void |
_indexResourceDocument(Resource resource,
SolrInputDocument document)
Index a populated solr input document of type Resource.
|
private void |
_indexStringFields(SolrInputDocument document,
String documentId,
String fieldName,
String fieldValue,
String language) |
protected void |
_populateAdditionalProperties(Page page,
SolrInputDocument document)
Populate the solr input document by adding fields to index.
|
protected void |
_populatePageContentsDocument(Page page,
SolrInputDocument document)
Index the content of the page.
|
protected void |
_populatePageDocument(Page page,
SolrInputDocument document)
Populate the solr input document by adding fields to index.
|
protected void |
_unindexPageDocument(String pageId,
String workspaceName,
boolean unindexRecursively,
boolean unindexAttachments)
Deindex a document of type Page.
|
void |
contextualize(Context context) |
void |
indexPage(String pageId,
boolean indexRecursively,
boolean indexAttachments)
Index a page and eventually its children, recursively, in all workspaces and commit
By default, children pages will be actually indexed if indexRecursively is true and if those pages are not already indexed. |
void |
indexPage(String pageId,
String workspaceName,
boolean indexRecursively,
boolean indexAttachments,
boolean commit)
Index a page and eventually its children, recursively.
By default, children pages will be actually indexed if indexRecursively is true and if those pages are not already indexed. |
void |
indexPageAttachment(Resource resource,
Page page)
Index a page attachment
|
void |
indexPageAttachments(ResourceCollection collection,
Page page)
Index page attachments as new entries in the index.
|
void |
reindexPage(String pageId,
boolean reindexRecursively,
boolean reindexAttachments)
Reindex a page by its ID for all workspaces and commit
|
void |
reindexPage(String pageId,
String workspaceName,
boolean reindexRecursively,
boolean reindexAttachments,
boolean commit)
Reindex a page by its ID.
|
void |
service(ServiceManager manager) |
void |
unindexPage(String pageId,
boolean unindexRecursively,
boolean unindexAttachments)
Un-index a page by its ID for all workspaces and commit
|
void |
unindexPage(String pageId,
String workspaceName,
boolean unindexRecursively,
boolean unindexAttachments,
boolean commit)
De-index a page (and optionally its children pages).
|
getLogger, setLogger
protected SolrClientProvider _solrClientProvider
protected SolrIndexer _solrIndexer
protected SolrContentIndexer _solrContentIndexer
protected SolrResourceIndexer _solrResourceIndexer
protected AdditionalPropertyIndexerExtensionPoint _additionalPropertiesIndexerEP
protected TagProviderExtensionPoint _tagProviderEP
protected ServiceExtensionPoint _serviceExtensionPoint
protected AmetysObjectResolver _ametysObjectResolver
private ContentTypesHelper _cTypesHelper
public SolrPageIndexer()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
public void indexPage(String pageId, boolean indexRecursively, boolean indexAttachments) throws Exception
pageId
- the page to be indexed.indexRecursively
- to also process children pages.indexAttachments
- to index page attachmentsException
- if an error occurs during indexation.public void indexPage(String pageId, String workspaceName, boolean indexRecursively, boolean indexAttachments, boolean commit) throws IndexingException
pageId
- the page to be indexed.workspaceName
- the workspace where to indexindexRecursively
- to also process children pages.indexAttachments
- to index page attachmentscommit
- Commit the indexationIndexingException
- if an error occurs during indexation.private void _indexPage(Page page, String workspaceName, boolean indexRecursively, boolean indexAttachments) throws IndexingException
IndexingException
protected void _populatePageDocument(Page page, SolrInputDocument document) throws Exception
page
- the page to index.document
- the solr input documentException
- if something goes wrong when processing the indexation of the pageprivate void _indexStringFields(SolrInputDocument document, String documentId, String fieldName, String fieldValue, String language)
protected Set<String> _getTagsWithAncestors(Page page)
page
- The page.protected void _populatePageContentsDocument(Page page, SolrInputDocument document) throws Exception
page
- the page to index.document
- the document to populate.Exception
- if an error occurs.protected void _indexFacetableField(Content content, SolrInputDocument document)
content
- The contentdocument
- The main page solr document.protected void _findAndIndexFacetableField(String[] pathSegments, String lang, CompositeMetadata metadata, MetadataDefinition definition, IndexingField field, SolrInputDocument pageDocument)
pathSegments
- The path of metadatalang
- The languagemetadata
- The parent composite metadatadefinition
- The metadata definitionfield
- The indexing fieldpageDocument
- The Solr page documentprotected Date _getLastModificationDate(Page page)
page
- the page.null
.protected Date _getLastValidationDate(Page page)
page
- the page.null
.protected void _populateAdditionalProperties(Page page, SolrInputDocument document) throws Exception
page
- the page to index.document
- the solr input documentException
- if something goes wrong when processing the indexation of the pagepublic void indexPageAttachments(ResourceCollection collection, Page page) throws Exception
collection
- the collection of attachmentspage
- the page whose attachments will be indexedException
- if something goes wrong when indexing the attachments of the pagepublic void indexPageAttachment(Resource resource, Page page) throws Exception
private void _indexPageAttachment(Resource resource, SolrInputDocument document, Page page) throws Exception
Exception
protected void _indexPageDocument(Page page, SolrInputDocument document, String workspaceName) throws SolrServerException, IOException
page
- the page from which the input document is createddocument
- the input document to add to the solr indexworkspaceName
- The workspace nameSolrServerException
- if there is an error on the Solr serverIOException
- if there is a communication error with the serverprotected void _indexResourceDocument(Resource resource, SolrInputDocument document) throws SolrServerException, IOException
resource
- the resource from which the input document is createddocument
- the input documentSolrServerException
- if there is an error on the serverIOException
- if there is a communication error with the serverpublic void unindexPage(String pageId, boolean unindexRecursively, boolean unindexAttachments) throws Exception
pageId
- The page ID.unindexRecursively
- also unindex child pages if requested.unindexAttachments
- also unindex page attachmentsException
- if an error occurs during index update.public void unindexPage(String pageId, String workspaceName, boolean unindexRecursively, boolean unindexAttachments, boolean commit) throws Exception
pageId
- the page to be de-indexed.workspaceName
- The workspace where to work inunindexRecursively
- also unindex child pages if requested.unindexAttachments
- also unindex page attachmentscommit
- Commit the operator to SolrException
- if an error occurs during index update.protected void _unindexPageDocument(String pageId, String workspaceName, boolean unindexRecursively, boolean unindexAttachments) throws SolrServerException, IOException, QuerySyntaxException
pageId
- the id of the page to deindexworkspaceName
- The workspace nameunindexRecursively
- also unindex child pages if requested.unindexAttachments
- also unindex page attachmentsSolrServerException
- if there is an error on the serverIOException
- if there is a communication error with the serverQuerySyntaxException
- if the uri query can't be built because of a syntax error.public void reindexPage(String pageId, boolean reindexRecursively, boolean reindexAttachments) throws Exception
pageId
- The page ID.reindexRecursively
- also reindex child pages if requested.reindexAttachments
- also reindex page attachmentsException
- if an error occurs during index update.public void reindexPage(String pageId, String workspaceName, boolean reindexRecursively, boolean reindexAttachments, boolean commit) throws IndexingException
pageId
- The page ID.workspaceName
- The workspace where to work inreindexRecursively
- also reindex child pages if requested.reindexAttachments
- also reindex page attachmentscommit
- Commit the operator to SolrIndexingException
- if an error occurs during index update.