Class PageContentSearchConnector

java.lang.Object
io.meeds.social.cms.storage.elasticsearch.PageContentSearchConnector

public class PageContentSearchConnector extends Object
Searches pages previously indexed by PageContentIndexingConnector (index alias page_content_alias) for the unified search bar.
  • Constructor Summary

    Constructors
    Constructor
    Description
    PageContentSearchConnector(org.exoplatform.container.configuration.ConfigurationManager configurationManager, org.exoplatform.commons.search.es.client.ElasticSearchingClient client, org.exoplatform.portal.mop.service.LayoutService layoutService, org.exoplatform.services.resources.ResourceBundleManager resourceBundleManager, org.exoplatform.social.metadata.favorite.FavoriteService favoriteService, org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.space.spi.SpaceService spaceService, org.exoplatform.services.resources.LocaleConfigService localeConfigService, org.exoplatform.container.xml.InitParams initParams)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    findIndexedBlockIds(String pageStorageId)
     
    getById(String id, Locale locale)
    Fetches a single previously-indexed page by its storage id, regardless of whether any term matches it — used to hydrate a page that a user already bookmarked for display in their favorites list.
    search(String term, int offset, int limit, Locale locale, List<Long> spaceIds, boolean favorites)
     

    Methods inherited from class java.lang.Object

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

    • PageContentSearchConnector

      public PageContentSearchConnector(org.exoplatform.container.configuration.ConfigurationManager configurationManager, org.exoplatform.commons.search.es.client.ElasticSearchingClient client, org.exoplatform.portal.mop.service.LayoutService layoutService, org.exoplatform.services.resources.ResourceBundleManager resourceBundleManager, org.exoplatform.social.metadata.favorite.FavoriteService favoriteService, org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.space.spi.SpaceService spaceService, org.exoplatform.services.resources.LocaleConfigService localeConfigService, org.exoplatform.container.xml.InitParams initParams)
  • Method Details

    • search

      public List<PageSearchResult> search(String term, int offset, int limit, Locale locale, List<Long> spaceIds, boolean favorites)
      Parameters:
      term - the search term, mandatory
      offset - the result offset
      limit - the result limit
      locale - the user's locale, used to pick the excerpts' language
      spaceIds - the space ids to restrict results to, or null/empty for none
      favorites - whether to restrict results to the pages the current user bookmarked — the unified search bar's "Favorites" toggle appends it as a query parameter for every connector declaring favoritesEnabled, so it has to be honoured here rather than silently dropped
      Returns:
      the matching PageSearchResults
    • getById

      public PageSearchResult getById(String id, Locale locale)
      Fetches a single previously-indexed page by its storage id, regardless of whether any term matches it — used to hydrate a page that a user already bookmarked for display in their favorites list. Unlike search(java.lang.String, int, int, java.util.Locale, java.util.List<java.lang.Long>, boolean), there is no query term to highlight against, so the excerpt is a plain (non-highlighted) snippet of the user's own language content, falling back to the default content.
      Parameters:
      id - the page's storage id
      locale - the user's locale, used to pick the excerpt's language
      Returns:
      the matching PageSearchResult, or null if none was found or id isn't shaped like a block id
    • findIndexedBlockIds

      public List<String> findIndexedBlockIds(String pageStorageId)
      Parameters:
      pageStorageId - the storage id of the page to look up
      Returns:
      the ids of every content block currently indexed under the given page, regardless of whether a CMSSetting still binds them — used to detect blocks that were detached from the page (or the page itself renamed/never re-saved) so the caller can unindex them. Returns an empty list, without ever querying Elasticsearch, when pageStorageId isn't shaped like one (defends the same way getById(java.lang.String, java.util.Locale) does, in case this public method is ever reached with untrusted input).