Class PageContentIndexingConnector
- All Implemented Interfaces:
org.exoplatform.container.component.ComponentPlugin
- a content block document per block bound to the page through a
CMSSettingwhose type is backed by a registeredPageContentBlockPlugin— generic across content-block types, no knowledge of any specific addon (e.g. Notes' Single Note View). A page can carry more than one block (e.g. several Single Note View blocks placed in different sections of the same page); each one is indexed as its own document, so that unified search returns one result per block rather than a single blended excerpt for the whole page. Its id is<page's storage id>_<block hash>(buildBlockId(java.lang.String, io.meeds.social.cms.model.CMSSetting, java.util.Map<java.lang.String, io.meeds.social.cms.storage.elasticsearch.PageContentIndexingConnector.ResolvedPage>)). - a bare page document — the page's title, name and site, no
content — for a page carrying no live content block at all, so
that a page like "Spaces" or "Tasks" can still be found by name by a user
who doesn't know how to reach it. Its id is the page's storage id itself
(
page_<numeric DB id>), and it exists only while the page is reachable from a navigation node: a search result that leads nowhere is worse than none.
queueLiveBlockDocuments(org.exoplatform.portal.config.model.Page, java.util.List<io.meeds.social.cms.model.CMSSetting>, boolean)): every one of them on a creation, so
that a full reindex started before the content-block plugins were
registered (a reindex-on-upgrade runs at Kernel start, the plugins arrive
with their addon's Spring context) still ends up with every block indexed;
only the ones the index lacks on a refresh (update(java.lang.String)), so that a
page saved outside the Layout addon gets its blocks indexed without a
save through it indexing them twice.
"Live" is a purely structural rule — a
CMSSetting whose widget still sits on the page's layout, see
PageContentBlockUtils — so that every path deciding what the index
holds evaluates it identically, from layout alone. Its one blind spot: a
page whose only block's widget is still there but whose content is gone
(e.g. the note it displayed was deleted) has no document of either kind
until the widget is removed from the page.
Neither id is PageKey.format(), which can exceed the 50-character
limit of the ES_INDEXING_QUEUE.ENTITY_ID column, nor the setting's
own name, which can be arbitrarily long — and the page id portion stays
stable across page/site renames, unlike the formatted key.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe ES field listing the language tags a block actually has content for (the default/no-language content isn't listed — it's always thecontentfield).static final StringThe ES connector/entity type name for indexed page documents.Fields inherited from class org.exoplatform.commons.search.index.impl.ElasticIndexingServiceConnector
currentIndex, indexAlias, mapping, previousIndex, previousIndices, reindexOnUpgrade, replicas, shardsFields inherited from class org.exoplatform.commons.search.index.IndexingServiceConnector
connectorName, enableFields inherited from class org.exoplatform.container.component.BaseComponentPlugin
desc, name -
Constructor Summary
ConstructorsConstructorDescriptionPageContentIndexingConnector(io.meeds.social.cms.service.PageContentBlockPluginService pluginService, PageContentSearchConnector searchConnector, io.meeds.social.cms.service.CMSService cmsService, org.exoplatform.portal.mop.service.LayoutService layoutService, org.exoplatform.services.resources.LocaleConfigService localeConfigService, io.meeds.social.cms.service.PageUrlResolverService urlResolverService, org.exoplatform.container.xml.InitParams initParams) -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildBlockId(String pageStorageId, String contentType, String settingName) static StringcontentFieldName(String lang) org.exoplatform.commons.search.domain.DocumentBuilds a document from scratch — a full reindex, or a page or site that just came to exist.getAllIds(int offset, int limit) Every content block id first, then the storage id of every page of the store — the two lists are laid end to end, so that a batch spanning the boundary still comes back full: ElasticIndexingOperationProcessor#reindexAll loops while the returned batch size equals the batch size it asked for, so a batch coming back even one id short — after it has already queued a DELETE_ALL — ends the reindex and leaves every remaining document unindexed.static booleanisDraftPage(org.exoplatform.portal.mop.page.PageKey pageKey) A page currently being edited as a draft is cloned by the Layout addon as either a whole draft site (SiteType.DRAFT) or, within the same site, a page named<original>_draft_<username>— neither is a published page and must not be indexed.static booleanisIndexableSite(org.exoplatform.portal.mop.SiteKey siteKey) static booleanstatic longparsePageId(String blockId) org.exoplatform.commons.search.domain.DocumentRefreshes a document that a listener already knows about.Methods inherited from class org.exoplatform.commons.search.index.impl.ElasticIndexingServiceConnector
delete, getAttachmentProcessor, getCurrentIndex, getIndexAlias, getPipelineName, getPreviousIndex, getPreviousIndices, getReindexPipelineName, getReplicas, getShards, isNeedIngestPipeline, isReindexOnUpgrade, setPreviousIndex, setReplicas, setShardsMethods inherited from class org.exoplatform.commons.search.index.IndexingServiceConnector
isEnable, setEnableMethods inherited from class org.exoplatform.container.component.BaseComponentPlugin
getDescription, getName, setDescription, setName
-
Field Details
-
TYPE
The ES connector/entity type name for indexed page documents.- See Also:
-
CONTENT_LANGUAGES_FIELD
The ES field listing the language tags a block actually has content for (the default/no-language content isn't listed — it's always thecontentfield). Lets the search side apply its "only excerpt in the searching user's own language" rule without having to pull every language's full text back in_source.- See Also:
-
-
Constructor Details
-
PageContentIndexingConnector
public PageContentIndexingConnector(io.meeds.social.cms.service.PageContentBlockPluginService pluginService, PageContentSearchConnector searchConnector, io.meeds.social.cms.service.CMSService cmsService, org.exoplatform.portal.mop.service.LayoutService layoutService, org.exoplatform.services.resources.LocaleConfigService localeConfigService, io.meeds.social.cms.service.PageUrlResolverService urlResolverService, org.exoplatform.container.xml.InitParams initParams)
-
-
Method Details
-
getConnectorName
- Specified by:
getConnectorNamein classorg.exoplatform.commons.search.index.IndexingServiceConnector
-
getMapping
- Overrides:
getMappingin classorg.exoplatform.commons.search.index.impl.ElasticIndexingServiceConnector
-
getAllIds
Every content block id first, then the storage id of every page of the store — the two lists are laid end to end, so that a batch spanning the boundary still comes back full: ElasticIndexingOperationProcessor#reindexAll loops while the returned batch size equals the batch size it asked for, so a batch coming back even one id short — after it has already queued a DELETE_ALL — ends the reindex and leaves every remaining document unindexed.The page portion is paged by the store itself, in its own deterministic order (site type, site name, page name), and is not filtered here: drafts, pages of sites nobody navigates, pages carrying content blocks or unreachable ones are all decided in
create(String), which returnsnullfor them. Filtering before paging would need the whole page table loaded on every batch call, filtering after it would shorten batches; a disqualified id costs one queued operation that indexes nothing, which is cheap.- Specified by:
getAllIdsin classorg.exoplatform.commons.search.index.IndexingServiceConnector
-
create
Builds a document from scratch — a full reindex, or a page or site that just came to exist. Besides the document itself, a bare page document requested this way for a page that turns out to carry live content blocks queues every one of those blocks' own indexing (seequeueLiveBlockDocuments(org.exoplatform.portal.config.model.Page, java.util.List<io.meeds.social.cms.model.CMSSetting>, boolean)): nothing else may ever reach them, and the index cannot be asked which ones it holds at that moment.- Specified by:
createin classorg.exoplatform.commons.search.index.IndexingServiceConnector
-
update
Refreshes a document that a listener already knows about. Unlikecreate(java.lang.String), a bare page document refreshed for a page carrying live blocks queues only the blocks the index does not hold yet (seequeueLiveBlockDocuments(org.exoplatform.portal.config.model.Page, java.util.List<io.meeds.social.cms.model.CMSSetting>, boolean)): the ones it holds are being refreshed by the listener that owns them, or need no refresh at all.- Specified by:
updatein classorg.exoplatform.commons.search.index.IndexingServiceConnector
-
contentFieldName
- Parameters:
lang- language tag, empty string for the default/no-language content- Returns:
- the ES field name holding that language's content
-
isPageDocumentId
- Parameters:
id- an indexed document id- Returns:
- whether
iddesignates a bare page document (a page storage id carrying no block hash) rather than a content block one
-
isDraftPage
public static boolean isDraftPage(org.exoplatform.portal.mop.page.PageKey pageKey) A page currently being edited as a draft is cloned by the Layout addon as either a whole draft site (SiteType.DRAFT) or, within the same site, a page named<original>_draft_<username>— neither is a published page and must not be indexed.- Parameters:
pageKey- the page key to check- Returns:
trueif the page is a draft
-
isIndexableSite
public static boolean isIndexableSite(org.exoplatform.portal.mop.SiteKey siteKey) - Parameters:
siteKey- a site key- Returns:
- whether the site is one users reach through a navigation, i.e. whose pages may surface as bare page documents
-
buildBlockId
- Parameters:
pageStorageId- the storage id of the page carrying the blockcontentType- the content block's content typesettingName- the content block's setting name- Returns:
- the document id for the content block named
settingName(of typecontentType) bound to the page whose storage id ispageStorageId.
-
parsePageId
- Parameters:
blockId- a content block document id (buildBlockId) or a plain page storage id — either way, the leadingpage_<numeric DB id>portion is parsed out.- Returns:
- the numeric storage id of the page carrying the block.
-