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 Summary
ConstructorsConstructorDescriptionSearchManagerImpl(SearchServicesPlugin searchServicesPlugin, io.vertigo.core.locale.LocaleManager localeManager, io.vertigo.core.analytics.AnalyticsManager analyticsManager) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionlongcount(SearchIndexDefinition indexDefinition) findFirstIndexDefinitionByKeyConcept(Class<? extends io.vertigo.datamodel.data.model.KeyConcept> keyConceptClass) Find IndexDefinition for a keyConcept.getMetaData(SearchIndexDefinition indexDefinition, String dataPath) Read metadata from the index.getReindexAllProgress(SearchIndexDefinition indexDefinition) Get progress of a complete reindex of an index.<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.<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.voidmarkAsDirty(List<io.vertigo.datamodel.data.model.UID<? extends io.vertigo.datamodel.data.model.KeyConcept>> keyConceptUris) Mark a UID list as dirty.voidonEvent(io.vertigo.datastore.entitystore.StoreEvent storeEvent) Receive Store event.<S extends io.vertigo.datamodel.data.model.KeyConcept,I extends io.vertigo.datamodel.data.model.DataObject>
voidput(SearchIndexDefinition indexDefinition, SearchIndex<S, I> index) Add a resource to the index.<S extends io.vertigo.datamodel.data.model.KeyConcept,I extends io.vertigo.datamodel.data.model.DataObject>
voidputAll(SearchIndexDefinition indexDefinition, Collection<SearchIndex<S, I>> indexCollection) Add multiple resources to the index.voidputMetaData(SearchIndexDefinition indexDefinition, String dataPath, Serializable dataValue) Add metadata to the index.reindexAll(SearchIndexDefinition searchIndexDefinition) Launch a full reindex of an index.reindexAllModified(SearchIndexDefinition searchIndexDefinition) Launch a full reindex of an index, checking modified data to limit updates (based on a version field).reindexDelta(SearchIndexDefinition searchIndexDefinition) Launch a delta reindex of an index based on a version field (like lastModified or version).<S extends io.vertigo.datamodel.data.model.KeyConcept>
voidremove(SearchIndexDefinition indexDefinition, io.vertigo.datamodel.data.model.UID<S> uri) Delete a resource from the index.voidremoveAll(SearchIndexDefinition indexDefinition, ListFilter listFilter) Delete data matching a filter.voidstart()voidstop()voidwaitForRefresh(Class<? extends io.vertigo.datamodel.data.model.KeyConcept> keyConceptClass) Wait for the end of the refresh of the index corresponding to the keyConcept class.
-
Constructor Details
-
SearchManagerImpl
@Inject public SearchManagerImpl(SearchServicesPlugin searchServicesPlugin, io.vertigo.core.locale.LocaleManager localeManager, io.vertigo.core.analytics.AnalyticsManager analyticsManager) Constructor.- Parameters:
searchServicesPlugin- the searchServicesPluginlocaleManager- the localeManageranalyticsManager- the analyticsManager
-
-
Method Details
-
start
public void start()- Specified by:
startin interfaceio.vertigo.core.node.component.Activeable
-
stop
public void stop()- Specified by:
stopin interfaceio.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:
putAllin interfaceSearchManager- Type Parameters:
S- Type of the keyConcept indexedI- Type of the object representing the index- Parameters:
indexDefinition- Index typeindexCollection- 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:
putin interfaceSearchManager- Type Parameters:
S- Type of the keyConcept indexedI- Type of the object representing the index- Parameters:
indexDefinition- Index typeindex- 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:
loadListin interfaceSearchManager- Type Parameters:
R- Type of the object returned by the search- Parameters:
indexDefinition- Index typesearchQuery- Initial criterialistState- 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:
loadListin interfaceSearchManager- Type Parameters:
R- Type of the object returned by the search- Parameters:
searchQuery- Initial criterialistState- List state (sorting and pagination)- Returns:
- Result matching the query
-
count
- Specified by:
countin interfaceSearchManager- 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:
removein interfaceSearchManager- Type Parameters:
S- Type of the keyConcept indexed- Parameters:
indexDefinition- Index typeuri- UID of the resource to delete
-
removeAll
Delete data matching a filter.- Specified by:
removeAllin interfaceSearchManager- Parameters:
indexDefinition- Index typelistFilter- 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:
findFirstIndexDefinitionByKeyConceptin interfaceSearchManager- 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:
markAsDirtyin interfaceSearchManager- 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:
waitForRefreshin interfaceSearchManager- Parameters:
keyConceptClass- keyConcept class
-
getReindexAllProgress
Get progress of a complete reindex of an index.- Specified by:
getReindexAllProgressin interfaceSearchManager- Parameters:
indexDefinition- Index type- Returns:
- Progress of reindex, empty if no complete reindex in progress
-
reindexAll
Launch a full reindex of an index.- Specified by:
reindexAllin interfaceSearchManager- Parameters:
searchIndexDefinition- Index type- Returns:
- Future of number elements indexed
-
reindexAllModified
Launch a full reindex of an index, checking modified data to limit updates (based on a version field).- Specified by:
reindexAllModifiedin interfaceSearchManager- Returns:
- Future of number elements indexed
-
reindexDelta
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:
reindexDeltain interfaceSearchManager- 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:
putMetaDatain interfaceSearchManager- Parameters:
indexDefinition- Index typedataPath- Metadata keydataValue- Metadata value
-
getMetaData
Read metadata from the index.- Specified by:
getMetaDatain interfaceSearchManager- Parameters:
indexDefinition- Index typedataPath- 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
-