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 PageVisibleAttachmentIndexerExtensionPoint |
_pageVisibleAttachmentIndexerEP
The extension point for PageVisibleAttachmentIndexers
|
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_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
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_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
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 |
_getFirstDate(Page page,
Function<Content,Date> dateRetriever)
Computes a "first date" of a page, using the simple and naive following algorithm:
From all the dates from each of its contents, keep the lowest of them. |
protected Date |
_getFirstValidationDate(Page page)
Computes the first validation date of a page.
|
protected Date |
_getLastDate(Page page,
Function<Content,Date> dateRetriever)
Computes a "last date" of a page, using the simple and naive following algorithm:
From all the dates from each of its contents, keep the greatest of them. |
protected Date |
_getLastMajorValidationDate(Page page)
Computes the last major validation date of a page.
|
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,
SolrClient solrClient) |
private void |
_indexPageAttachment(Resource resource,
Page page,
SolrClient solrClient) |
private void |
_indexPageAttachments(ResourceCollection collection,
Page page,
SolrClient solrClient) |
protected void |
_indexPageDocument(Page page,
SolrInputDocument document,
String workspaceName,
SolrClient solrClient)
Index a populated solr input document of type Page.
|
protected void |
_indexResourceDocument(Resource resource,
SolrInputDocument document,
SolrClient solrClient)
Index a populated solr input document of type Resource.
|
private void |
_indexStringFields(SolrInputDocument document,
String documentId,
String fieldName,
String fieldValue,
String language) |
private void |
_indexVisibleAttachments(Page page,
SolrInputDocument document) |
protected void |
_populateAdditionalProperties(Page page,
SolrInputDocument document)
Populate the solr input document by adding fields to index.
|
protected void |
_populateDatesOfPage(Page page,
SolrInputDocument document)
Populate the solr input document with dates from the page
|
private void |
_populatePageAttachmentDocument(Resource resource,
SolrInputDocument document,
Page page) |
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)
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 |
indexPage(String pageId,
String workspaceName,
boolean indexRecursively,
boolean indexAttachments,
SolrClient solrClient)
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)
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)
De-index a page (and optionally its children pages).
|
getLogger, setLogger
protected SolrClientProvider _solrClientProvider
protected SolrIndexer _solrIndexer
protected SolrContentIndexer _solrContentIndexer
protected SolrResourceIndexer _solrResourceIndexer
protected PageVisibleAttachmentIndexerExtensionPoint _pageVisibleAttachmentIndexerEP
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) throws IndexingException
pageId
- the page to be indexed.workspaceName
- the workspace where to indexindexRecursively
- to also process children pages.indexAttachments
- to index page attachmentsIndexingException
- if an error occurs during indexation.public void indexPage(String pageId, String workspaceName, boolean indexRecursively, boolean indexAttachments, SolrClient solrClient) throws IndexingException
pageId
- the page to be indexed.workspaceName
- the workspace where to indexindexRecursively
- to also process children pages.indexAttachments
- to index page attachmentssolrClient
- The solr client to useIndexingException
- if an error occurs during indexation.private void _indexPage(Page page, String workspaceName, boolean indexRecursively, boolean indexAttachments, SolrClient solrClient) 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 _indexVisibleAttachments(Page page, SolrInputDocument document)
protected void _populateDatesOfPage(Page page, SolrInputDocument document)
page
- The pagedocument
- The Solr documentprivate 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 _getFirstValidationDate(Page page)
page
- the page.null
.protected Date _getLastValidationDate(Page page)
page
- the page.null
.protected Date _getLastMajorValidationDate(Page page)
page
- the page.null
.protected Date _getLastDate(Page page, Function<Content,Date> dateRetriever)
page
- the page.dateRetriever
- The function to retrieve a Date from a Content of the Pagenull
.protected Date _getFirstDate(Page page, Function<Content,Date> dateRetriever)
page
- the page.dateRetriever
- The function to retrieve a Date from a Content of the Pagenull
.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 pageprivate void _indexPageAttachments(ResourceCollection collection, Page page, SolrClient solrClient) throws Exception
Exception
public void indexPageAttachment(Resource resource, Page page) throws Exception
private void _indexPageAttachment(Resource resource, Page page, SolrClient solrClient) throws Exception
Exception
private void _populatePageAttachmentDocument(Resource resource, SolrInputDocument document, Page page) throws Exception
Exception
protected void _indexPageDocument(Page page, SolrInputDocument document, String workspaceName, SolrClient solrClient) throws SolrServerException, IOException
page
- the page from which the input document is createddocument
- the input document to add to the solr indexworkspaceName
- The workspace namesolrClient
- The solr client to useSolrServerException
- if there is an error on the Solr serverIOException
- if there is a communication error with the serverprotected void _indexResourceDocument(Resource resource, SolrInputDocument document, SolrClient solrClient) throws SolrServerException, IOException
resource
- the resource from which the input document is createddocument
- the input documentsolrClient
- The solr client to useSolrServerException
- 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) 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 attachmentsException
- 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) throws IndexingException
pageId
- The page ID.workspaceName
- The workspace where to work inreindexRecursively
- also reindex child pages if requested.reindexAttachments
- also reindex page attachmentsIndexingException
- if an error occurs during index update.