Class OSessionIndexManager
java.lang.Object
com.orientechnologies.orient.core.db.record.OProxedResource<OIndexManagerAbstract>
com.orientechnologies.orient.core.index.OSessionIndexManager
- All Implemented Interfaces:
OIndexManager
public class OSessionIndexManager
extends OProxedResource<OIndexManagerAbstract>
implements OIndexManager
-
Field Summary
Fields inherited from class com.orientechnologies.orient.core.db.record.OProxedResource
database, delegate -
Constructor Summary
ConstructorsConstructorDescriptionOSessionIndexManager(OIndexManagerAbstract iDelegate, ODatabaseDocumentInternal iDatabase) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddClusterToIndex(String clusterName, String indexName) Adds a cluster to tracked cluster list of specified index.booleanareIndexed(String className, String... fields) booleanareIndexed(String className, Collection<String> fields) Indicates whether given fields are contained as first key fields in class indexes.booleanChecks if indexes should be automatically recreated.voidcreate()createIndex(String iName, String iType, OIndexDefinition indexDefinition, int[] clusterIdsToIndex, OProgressListener progressListener, ODocument metadata) Creates a new index with default algorithm.createIndex(String iName, String iType, OIndexDefinition iIndexDefinition, int[] iClusterIdsToIndex, OProgressListener progressListener, ODocument metadata, String algorithm) Creates a new index.delegate()Drop index with specified name.booleanexistsIndex(String iName) Checks if index with specified name exists in database.getClassAutoShardingIndex(String className) Returns the auto-sharding index defined for the class, if any.getClassIndex(String className, String indexName) Searches for index for a specified class with specified name.getClassIndexes(String className) Gets indexes for a specified class (excluding indexes for sub-classes).voidgetClassIndexes(String className, Collection<OIndex> indexes) Gets indexes for a specified class (excluding indexes for sub-classes).getClassInvolvedIndexes(String className, String... fields) Returns list of indexes that contain passed in fields names as their first keys.getClassInvolvedIndexes(String className, Collection<String> fields) Returns list of indexes that contain passed in fields names as their first keys.voidgetClassRawIndexes(String name, Collection<OIndex> indexes) getClassUniqueIndex(String className) Returns the unique index for a class, if any.Deprecated.IMPORTANT!Return a dictionary index.Index by specified name.Collection<? extends OIndex>Returns all indexes registered in database.voidload()voidDrops all indexes and creates them from scratch.reload()Force reloading of indexes.voidRemoves index from class-property map.voidremoveClusterFromIndex(String clusterName, String indexName) Removes a cluster from tracked cluster list of specified index.voidsetDefaultClusterName(String defaultClusterName) Sets the new default cluster.voidBlocks current thread till indexes will be restored.
-
Constructor Details
-
OSessionIndexManager
-
-
Method Details
-
load
public void load() -
reload
Force reloading of indexes. -
create
public void create() -
getIndexes
Description copied from interface:OIndexManagerReturns all indexes registered in database.- Specified by:
getIndexesin interfaceOIndexManager- Returns:
- list of registered indexes.
-
getIndex
Description copied from interface:OIndexManagerIndex by specified name.- Specified by:
getIndexin interfaceOIndexManager- Parameters:
iName- name of index- Returns:
- index if one registered in database or null otherwise.
-
existsIndex
Description copied from interface:OIndexManagerChecks if index with specified name exists in database.- Specified by:
existsIndexin interfaceOIndexManager- Parameters:
iName- name of index.- Returns:
- true if index with specified name exists, false otherwise.
-
createIndex
public OIndex createIndex(String iName, String iType, OIndexDefinition indexDefinition, int[] clusterIdsToIndex, OProgressListener progressListener, ODocument metadata) Description copied from interface:OIndexManagerCreates a new index with default algorithm.- Specified by:
createIndexin interfaceOIndexManager- Parameters:
iName- - name of indexiType- - index type. Specified by plugged index factories.indexDefinition- metadata that describes index structureclusterIdsToIndex- ids of clusters that index should track for changes.progressListener- listener to track task progress.metadata- document with additional properties that can be used by index engine.- Returns:
- a newly created index instance
-
createIndex
public OIndex createIndex(String iName, String iType, OIndexDefinition iIndexDefinition, int[] iClusterIdsToIndex, OProgressListener progressListener, ODocument metadata, String algorithm) Description copied from interface:OIndexManagerCreates a new index.May require quite a long time if big amount of data should be indexed.
- Specified by:
createIndexin interfaceOIndexManager- Parameters:
iName- name of indexiType- index type. Specified by plugged index factories.iIndexDefinition- metadata that describes index structureiClusterIdsToIndex- ids of clusters that index should track for changes.progressListener- listener to track task progress.metadata- document with additional properties that can be used by index engine.algorithm- tip to an index factory what algorithm to use- Returns:
- a newly created index instance
-
getConfiguration
Deprecated.Description copied from interface:OIndexManagerReturns a record where configurations are saved.IMPORTANT! Only for internal usage.
- Specified by:
getConfigurationin interfaceOIndexManager- Returns:
- a document that used to store index configurations.
-
dropIndex
Description copied from interface:OIndexManagerDrop index with specified name. Do nothing if such index does not exists.- Specified by:
dropIndexin interfaceOIndexManager- Parameters:
iIndexName- the name of index to drop- Returns:
- this
-
getDefaultClusterName
Description copied from interface:OIndexManagerIMPORTANT! Only for internal usage.- Specified by:
getDefaultClusterNamein interfaceOIndexManager- Returns:
- name of default cluster.
-
setDefaultClusterName
Description copied from interface:OIndexManagerSets the new default cluster.IMPORTANT! Only for internal usage.
- Specified by:
setDefaultClusterNamein interfaceOIndexManager- Parameters:
defaultClusterName- name of new default cluster
-
getDictionary
Description copied from interface:OIndexManagerReturn a dictionary index. Could be helpful to store different kinds of configurations.- Specified by:
getDictionaryin interfaceOIndexManager- Returns:
- a dictionary
-
getClassInvolvedIndexes
Description copied from interface:OIndexManagerReturns list of indexes that contain passed in fields names as their first keys. Order of fields does not matter.All indexes sorted by their count of parameters in ascending order. If there are indexes for the given set of fields in super class they will be taken into account.
- Specified by:
getClassInvolvedIndexesin interfaceOIndexManager- Parameters:
className- name of class which is indexed.fields- Field names.- Returns:
- list of indexes that contain passed in fields names as their first keys.
-
getClassInvolvedIndexes
Description copied from interface:OIndexManagerReturns list of indexes that contain passed in fields names as their first keys. Order of fields does not matter.All indexes sorted by their count of parameters in ascending order. If there are indexes for the given set of fields in super class they will be taken into account.
- Specified by:
getClassInvolvedIndexesin interfaceOIndexManager- Parameters:
className- name of class which is indexed.fields- Field names.- Returns:
- list of indexes that contain passed in fields names as their first keys.
-
areIndexed
Description copied from interface:OIndexManagerIndicates whether given fields are contained as first key fields in class indexes. Order of fields does not matter. If there are indexes for the given set of fields in super class they will be taken into account.- Specified by:
areIndexedin interfaceOIndexManager- Parameters:
className- name of class which containfields.fields- Field names.- Returns:
trueif given fields are contained as first key fields in class indexes.
-
areIndexed
- Specified by:
areIndexedin interfaceOIndexManager- Parameters:
className- name of class which containfields.fields- Field names.- Returns:
trueif given fields are contained as first key fields in class indexes.- See Also:
-
getClassIndexes
Description copied from interface:OIndexManagerGets indexes for a specified class (excluding indexes for sub-classes).- Specified by:
getClassIndexesin interfaceOIndexManager- Parameters:
className- name of class which is indexed.- Returns:
- a set of indexes related to specified class
-
getClassIndexes
Description copied from interface:OIndexManagerGets indexes for a specified class (excluding indexes for sub-classes).- Specified by:
getClassIndexesin interfaceOIndexManager- Parameters:
className- name of class which is indexed.indexes- Collection of indexes where to add all the indexes
-
getClassIndex
Description copied from interface:OIndexManagerSearches for index for a specified class with specified name.- Specified by:
getClassIndexin interfaceOIndexManager- Parameters:
className- name of class which is indexed.indexName- name of index.- Returns:
- an index instance or null if such does not exist.
-
getClassUniqueIndex
Description copied from interface:OIndexManagerReturns the unique index for a class, if any.- Specified by:
getClassUniqueIndexin interfaceOIndexManager
-
getClassAutoShardingIndex
Description copied from interface:OIndexManagerReturns the auto-sharding index defined for the class, if any.- Specified by:
getClassAutoShardingIndexin interfaceOIndexManager- Parameters:
className- Class name
-
recreateIndexes
public void recreateIndexes()Description copied from interface:OIndexManagerDrops all indexes and creates them from scratch.- Specified by:
recreateIndexesin interfaceOIndexManager
-
waitTillIndexRestore
public void waitTillIndexRestore()Description copied from interface:OIndexManagerBlocks current thread till indexes will be restored.- Specified by:
waitTillIndexRestorein interfaceOIndexManager
-
autoRecreateIndexesAfterCrash
public boolean autoRecreateIndexesAfterCrash()Description copied from interface:OIndexManagerChecks if indexes should be automatically recreated.IMPORTANT! Only for internal usage.
- Specified by:
autoRecreateIndexesAfterCrashin interfaceOIndexManager- Returns:
- true if crash is happened and database configured to automatically recreate indexes after crash.
-
addClusterToIndex
Description copied from interface:OIndexManagerAdds a cluster to tracked cluster list of specified index.IMPORTANT! Only for internal usage.
- Specified by:
addClusterToIndexin interfaceOIndexManager- Parameters:
clusterName- cluster to add.indexName- name of index.
-
removeClusterFromIndex
Description copied from interface:OIndexManagerRemoves a cluster from tracked cluster list of specified index.IMPORTANT! Only for internal usage.
- Specified by:
removeClusterFromIndexin interfaceOIndexManager- Parameters:
clusterName- cluster to remove.indexName- name of index.
-
removeClassPropertyIndex
Description copied from interface:OIndexManagerRemoves index from class-property map.IMPORTANT! Only for internal usage.
- Specified by:
removeClassPropertyIndexin interfaceOIndexManager- Parameters:
idx- index to remove.
-
getClassRawIndexes
-
delegate
-