Class SearchManagerImpl

java.lang.Object
io.vertigo.datafactory.impl.search.SearchManagerImpl
All Implemented Interfaces:
io.vertigo.core.node.component.Activeable, io.vertigo.core.node.component.Component, io.vertigo.core.node.component.CoreComponent, io.vertigo.core.node.component.Manager, SearchManager

public final class SearchManagerImpl extends Object implements SearchManager, io.vertigo.core.node.component.Activeable
Standard implementation of the search index manager.
Author:
dchallas, npiedeloup
  • Constructor Details

    • SearchManagerImpl

      @Inject public SearchManagerImpl(SearchServicesPlugin searchServicesPlugin, io.vertigo.core.locale.LocaleManager localeManager, io.vertigo.core.analytics.AnalyticsManager analyticsManager)
      Constructor.
      Parameters:
      searchServicesPlugin - the searchServicesPlugin
      localeManager - the localeManager
      analyticsManager - the analyticsManager
  • Method Details

    • start

      public void start()
      Specified by:
      start in interface io.vertigo.core.node.component.Activeable
    • stop

      public void stop()
      Specified by:
      stop in interface io.vertigo.core.node.component.Activeable
    • putAll

      public <S extends io.vertigo.datamodel.data.model.KeyConcept, I extends io.vertigo.datamodel.data.model.DataObject> void putAll(SearchIndexDefinition indexDefinition, Collection<SearchIndex<S,I>> indexCollection)
      Add multiple resources to the index. If the items were already in the index they are replaced.
      Specified by:
      putAll in interface SearchManager
      Type Parameters:
      S - Type of the keyConcept indexed
      I - Type of the object representing the index
      Parameters:
      indexDefinition - Index type
      indexCollection - List of objects to push into the index
    • put

      public <S extends io.vertigo.datamodel.data.model.KeyConcept, I extends io.vertigo.datamodel.data.model.DataObject> void put(SearchIndexDefinition indexDefinition, SearchIndex<S,I> index)
      Add a resource to the index. If the item was already in the index it is replaced.
      Specified by:
      put in interface SearchManager
      Type Parameters:
      S - Type of the keyConcept indexed
      I - Type of the object representing the index
      Parameters:
      indexDefinition - Index type
      index - Object to push into the index
    • loadList

      public <R extends io.vertigo.datamodel.data.model.DataObject> FacetedQueryResult<R,SearchQuery> loadList(SearchIndexDefinition indexDefinition, SearchQuery searchQuery, io.vertigo.datamodel.data.model.DtListState listState)
      Retrieve the result of a query.
      Specified by:
      loadList in interface SearchManager
      Type Parameters:
      R - Type of the object returned by the search
      Parameters:
      indexDefinition - Index type
      searchQuery - Initial criteria
      listState - List state (sorting and pagination)
      Returns:
      Result matching the query
    • loadList

      public <R extends io.vertigo.datamodel.data.model.DataObject> FacetedQueryResult<R,SearchQuery> loadList(List<SearchIndexDefinition> indexDefinitions, SearchQuery searchQuery, io.vertigo.datamodel.data.model.DtListState listState)
      Retrieve the result of a query.
      Specified by:
      loadList in interface SearchManager
      Type Parameters:
      R - Type of the object returned by the search
      Parameters:
      searchQuery - Initial criteria
      listState - List state (sorting and pagination)
      Returns:
      Result matching the query
    • count

      public long count(SearchIndexDefinition indexDefinition)
      Specified by:
      count in interface SearchManager
      Parameters:
      indexDefinition - Index type
      Returns:
      Number of indexed documents
    • remove

      public <S extends io.vertigo.datamodel.data.model.KeyConcept> void remove(SearchIndexDefinition indexDefinition, io.vertigo.datamodel.data.model.UID<S> uri)
      Delete a resource from the index.
      Specified by:
      remove in interface SearchManager
      Type Parameters:
      S - Type of the keyConcept indexed
      Parameters:
      indexDefinition - Index type
      uri - UID of the resource to delete
    • removeAll

      public void removeAll(SearchIndexDefinition indexDefinition, ListFilter listFilter)
      Delete data matching a filter.
      Specified by:
      removeAll in interface SearchManager
      Parameters:
      indexDefinition - Index type
      listFilter - Filter of items to delete
    • findFirstIndexDefinitionByKeyConcept

      public SearchIndexDefinition findFirstIndexDefinitionByKeyConcept(Class<? extends io.vertigo.datamodel.data.model.KeyConcept> keyConceptClass)
      Find IndexDefinition for a keyConcept. It must be one and only one IndexDefinition.
      Specified by:
      findFirstIndexDefinitionByKeyConcept in interface SearchManager
      Parameters:
      keyConceptClass - keyConcept class
      Returns:
      SearchIndexDefinition for this keyConcept (not null)
    • markAsDirty

      public void markAsDirty(List<io.vertigo.datamodel.data.model.UID<? extends io.vertigo.datamodel.data.model.KeyConcept>> keyConceptUris)
      Mark a UID list as dirty. Index entries for these elements will be reindexed. Reindexing is asynchronous; strategy depends on plugin parameters.
      Specified by:
      markAsDirty in interface SearchManager
      Parameters:
      keyConceptUris - UID of keyConcept marked as dirty.
    • waitForRefresh

      public void waitForRefresh(Class<? extends io.vertigo.datamodel.data.model.KeyConcept> keyConceptClass)
      Wait for the end of the refresh of the index corresponding to the keyConcept class.
      Specified by:
      waitForRefresh in interface SearchManager
      Parameters:
      keyConceptClass - keyConcept class
    • getReindexAllProgress

      public OptionalLong getReindexAllProgress(SearchIndexDefinition indexDefinition)
      Get progress of a complete reindex of an index.
      Specified by:
      getReindexAllProgress in interface SearchManager
      Parameters:
      indexDefinition - Index type
      Returns:
      Progress of reindex, empty if no complete reindex in progress
    • reindexAll

      public WritableFuture<Long> reindexAll(SearchIndexDefinition searchIndexDefinition)
      Launch a full reindex of an index.
      Specified by:
      reindexAll in interface SearchManager
      Parameters:
      searchIndexDefinition - Index type
      Returns:
      Future of number elements indexed
    • reindexAllModified

      public WritableFuture<Long> reindexAllModified(SearchIndexDefinition searchIndexDefinition)
      Launch a full reindex of an index, checking modified data to limit updates (based on a version field).
      Specified by:
      reindexAllModified in interface SearchManager
      Returns:
      Future of number elements indexed
    • reindexDelta

      public WritableFuture<Long> reindexDelta(SearchIndexDefinition searchIndexDefinition)
      Launch a delta reindex of an index based on a version field (like lastModified or version). Last value of this version field is stored into the index (as metadata).
      Specified by:
      reindexDelta in interface SearchManager
      Returns:
      Future of number elements indexed
    • putMetaData

      public void putMetaData(SearchIndexDefinition indexDefinition, String dataPath, Serializable dataValue)
      Add metadata to the index. If the item was already in the index it is replaced.
      Specified by:
      putMetaData in interface SearchManager
      Parameters:
      indexDefinition - Index type
      dataPath - Metadata key
      dataValue - Metadata value
    • getMetaData

      public Serializable getMetaData(SearchIndexDefinition indexDefinition, String dataPath)
      Read metadata from the index.
      Specified by:
      getMetaData in interface SearchManager
      Parameters:
      indexDefinition - Index type
      dataPath - Metadata key
      Returns:
      Metadata value, null if no data
    • onEvent

      public void onEvent(io.vertigo.datastore.entitystore.StoreEvent storeEvent)
      Receive Store event.
      Parameters:
      storeEvent - Store event