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
|
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 SolrPageRightIndexer |
_solrPageRightIndexer
The Solr page right indexer.
|
protected SolrResourceIndexer |
_solrResourceIndexer
Solr Ametys resources indexer
|
protected TagProviderExtensionPoint |
_tagProviderEP
The tag provider extension point.
|
static String |
ROLE
The avalon role.
|
ANCESTOR_IDS, CONTENT_IDS, CONTENT_INTERESTING_DATES, DATE_FOR_SORTING, DATES_FACET, LASTNAME_FOR_SORTING, LONG_TITLE, ORPHAN, PAGE_DEPTH, PAGE_ID, PAGE_IDS, PAGE_TYPE, PRIVACY, SECTION_PAGE_TITLE, SERVICE_IDS, SHARED, SITE_NAME, SITEMAP_NAME, TEMPLATE, TITLE, TITLE_FOR_SORTING, TYPE_PAGE, TYPE_PAGE_RESOURCE
ACL_READ_ALLOW_ANONYMOUS, ACL_READ_ALLOW_ANY_CONNECTED_USER, ACL_READ_ALLOWED_GROUPS, ACL_READ_ALLOWED_USERS, ACL_READ_DENIED_GROUPS, ACL_READ_DENIED_USERS, ALL_CONTENT_TYPES, ALL_MIXIN_TYPES, ALL_TAGS, CONTENT_COMMENTS, CONTENT_COMMENTS_NONVALIDATED, CONTENT_COMMENTS_VALIDATED, CONTENT_CREATOR, CONTENT_LANGUAGE, CONTENT_LANGUAGES, CONTENT_LAST_CONTRIBUTOR, CONTENT_NAME, 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, LAST_MAJOR_VALIDATION, LAST_MODIFIED, LAST_VALIDATION, LENGTH, MIME_TYPES, MIXIN_TYPES, PATH, REPEATER_ENTRY_POSITION, RESOURCE_CREATOR, RESOURCE_DATE, RESOURCE_LAST_MODIFIED, RESOURCE_ROOT_ID, SUB_CONTENT, TAGS, TITLE_SORT, TYPE_CONTENT, 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 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.
|
private void |
_indexPage(Page page,
String workspaceName,
boolean indexRecursively,
boolean indexAttachments) |
protected void |
_indexPageAccess(Page page,
SolrInputDocument document)
Index the page access.
|
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.
|
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 SolrPageRightIndexer _solrPageRightIndexer
protected AdditionalPropertyIndexerExtensionPoint _additionalPropertiesIndexerEP
protected TagProviderExtensionPoint _tagProviderEP
protected ServiceExtensionPoint _serviceExtensionPoint
protected AmetysObjectResolver _ametysObjectResolver
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 Exception
pageId
- the page to be indexed.workspaceName
- the workspace where to indexindexRecursively
- to also process children pages.indexAttachments
- to index page attachmentscommit
- Commit the indexationException
- if an error occurs during indexation.private void _indexPage(Page page, String workspaceName, boolean indexRecursively, boolean indexAttachments) throws Exception
Exception
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 pageprotected 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 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 serverprotected void _indexPageAccess(Page page, SolrInputDocument document) throws Exception
page
- The page.document
- The document.Exception
- If an error occurs while indexing.public 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 Exception
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 SolrException
- if an error occurs during index update.