Class PageContentSearchConnector
java.lang.Object
io.meeds.social.cms.storage.elasticsearch.PageContentSearchConnector
Searches pages previously indexed by
PageContentIndexingConnector
(index alias page_content_alias) for the unified search bar.-
Constructor Summary
ConstructorsConstructorDescriptionPageContentSearchConnector(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 TypeMethodDescriptionfindIndexedBlockIds(String pageStorageId) 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.
-
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, mandatoryoffset- the result offsetlimit- the result limitlocale- the user's locale, used to pick the excerpts' languagespaceIds- the space ids to restrict results to, ornull/empty for nonefavorites- 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 declaringfavoritesEnabled, so it has to be honoured here rather than silently dropped- Returns:
- the matching
PageSearchResults
-
getById
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. Unlikesearch(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 idlocale- the user's locale, used to pick the excerpt's language- Returns:
- the matching
PageSearchResult, ornullif none was found oridisn't shaped like a block id
-
findIndexedBlockIds
- 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
CMSSettingstill 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, whenpageStorageIdisn't shaped like one (defends the same waygetById(java.lang.String, java.util.Locale)does, in case this public method is ever reached with untrusted input).
-