Class PageContentIndexingConnector

java.lang.Object
org.exoplatform.container.component.BaseComponentPlugin
org.exoplatform.commons.search.index.IndexingServiceConnector
org.exoplatform.commons.search.index.impl.ElasticIndexingServiceConnector
io.meeds.social.cms.storage.elasticsearch.PageContentIndexingConnector
All Implemented Interfaces:
org.exoplatform.container.component.ComponentPlugin

public class PageContentIndexingConnector extends org.exoplatform.commons.search.index.impl.ElasticIndexingServiceConnector
Indexes a portal Page's content blocks bound through a CMSSetting whose type is backed by a registered PageContentBlockPlugin — generic across content-block types, no knowledge of any specific addon (e.g. Notes' Single Note View).

A page can carry more than one content 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.

The document id is <page's numeric storage id>_<block hash> (not 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) — the page id portion stays stable across page/site renames, unlike the formatted key.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The ES field listing the language tags a block actually has content for (the default/no-language content isn't listed — it's always the content field).
    static final String
    The ES connector/entity type name for indexed page content blocks.

    Fields inherited from class org.exoplatform.commons.search.index.impl.ElasticIndexingServiceConnector

    currentIndex, indexAlias, mapping, previousIndex, previousIndices, reindexOnUpgrade, replicas, shards

    Fields inherited from class org.exoplatform.commons.search.index.IndexingServiceConnector

    connectorName, enable

    Fields inherited from class org.exoplatform.container.component.BaseComponentPlugin

    desc, name
  • Constructor Summary

    Constructors
    Constructor
    Description
    PageContentIndexingConnector(io.meeds.social.cms.service.PageContentBlockPluginService pluginService, 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 Type
    Method
    Description
    static String
    buildBlockId(String pageStorageId, String contentType, String settingName)
     
    static String
     
    org.exoplatform.commons.search.domain.Document
     
    getAllIds(int offset, int limit)
     
     
     
    static long
     
    org.exoplatform.commons.search.domain.Document
     

    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, setShards

    Methods inherited from class org.exoplatform.commons.search.index.IndexingServiceConnector

    isEnable, setEnable

    Methods inherited from class org.exoplatform.container.component.BaseComponentPlugin

    getDescription, getName, setDescription, setName

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • TYPE

      public static final String TYPE
      The ES connector/entity type name for indexed page content blocks.
      See Also:
    • CONTENT_LANGUAGES_FIELD

      public static final String 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 the content field). 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, 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

      public String getConnectorName()
      Specified by:
      getConnectorName in class org.exoplatform.commons.search.index.IndexingServiceConnector
    • getMapping

      public String getMapping()
      Overrides:
      getMapping in class org.exoplatform.commons.search.index.impl.ElasticIndexingServiceConnector
    • getAllIds

      public List<String> getAllIds(int offset, int limit)
      Specified by:
      getAllIds in class org.exoplatform.commons.search.index.IndexingServiceConnector
    • create

      public org.exoplatform.commons.search.domain.Document create(String id)
      Specified by:
      create in class org.exoplatform.commons.search.index.IndexingServiceConnector
    • update

      public org.exoplatform.commons.search.domain.Document update(String id)
      Specified by:
      update in class org.exoplatform.commons.search.index.IndexingServiceConnector
    • contentFieldName

      public static String contentFieldName(String lang)
      Parameters:
      lang - language tag, empty string for the default/no-language content
      Returns:
      the ES field name holding that language's content
    • buildBlockId

      public static String buildBlockId(String pageStorageId, String contentType, String settingName)
      Parameters:
      pageStorageId - the storage id of the page carrying the block
      contentType - the content block's content type
      settingName - the content block's setting name
      Returns:
      the document id for the content block named settingName (of type contentType) bound to the page whose storage id is pageStorageId.
    • parsePageId

      public static long parsePageId(String blockId)
      Parameters:
      blockId - a content block document id (buildBlockId) or a plain page storage id — either way, the leading page_<numeric DB id> portion is parsed out.
      Returns:
      the numeric storage id of the page carrying the block.