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
  • Constructor Details

  • Method Details

    • load

      public void load()
    • reload

      public OSessionIndexManager reload()
      Force reloading of indexes.
    • create

      public void create()
    • getIndexes

      public Collection<? extends OIndex> getIndexes()
      Description copied from interface: OIndexManager
      Returns all indexes registered in database.
      Specified by:
      getIndexes in interface OIndexManager
      Returns:
      list of registered indexes.
    • getIndex

      public OIndex getIndex(String iName)
      Description copied from interface: OIndexManager
      Index by specified name.
      Specified by:
      getIndex in interface OIndexManager
      Parameters:
      iName - name of index
      Returns:
      index if one registered in database or null otherwise.
    • existsIndex

      public boolean existsIndex(String iName)
      Description copied from interface: OIndexManager
      Checks if index with specified name exists in database.
      Specified by:
      existsIndex in interface OIndexManager
      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: OIndexManager
      Creates a new index with default algorithm.
      Specified by:
      createIndex in interface OIndexManager
      Parameters:
      iName - - name of index
      iType - - index type. Specified by plugged index factories.
      indexDefinition - metadata that describes index structure
      clusterIdsToIndex - 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: OIndexManager
      Creates a new index.

      May require quite a long time if big amount of data should be indexed.

      Specified by:
      createIndex in interface OIndexManager
      Parameters:
      iName - name of index
      iType - index type. Specified by plugged index factories.
      iIndexDefinition - metadata that describes index structure
      iClusterIdsToIndex - 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 public ODocument getConfiguration()
      Deprecated.
      Description copied from interface: OIndexManager
      Returns a record where configurations are saved.

      IMPORTANT! Only for internal usage.

      Specified by:
      getConfiguration in interface OIndexManager
      Returns:
      a document that used to store index configurations.
    • dropIndex

      public OIndexManager dropIndex(String iIndexName)
      Description copied from interface: OIndexManager
      Drop index with specified name. Do nothing if such index does not exists.
      Specified by:
      dropIndex in interface OIndexManager
      Parameters:
      iIndexName - the name of index to drop
      Returns:
      this
    • getDefaultClusterName

      public String getDefaultClusterName()
      Description copied from interface: OIndexManager
      IMPORTANT! Only for internal usage.
      Specified by:
      getDefaultClusterName in interface OIndexManager
      Returns:
      name of default cluster.
    • setDefaultClusterName

      public void setDefaultClusterName(String defaultClusterName)
      Description copied from interface: OIndexManager
      Sets the new default cluster.

      IMPORTANT! Only for internal usage.

      Specified by:
      setDefaultClusterName in interface OIndexManager
      Parameters:
      defaultClusterName - name of new default cluster
    • getDictionary

      public ODictionary<ORecord> getDictionary()
      Description copied from interface: OIndexManager
      Return a dictionary index. Could be helpful to store different kinds of configurations.
      Specified by:
      getDictionary in interface OIndexManager
      Returns:
      a dictionary
    • getClassInvolvedIndexes

      public Set<OIndex> getClassInvolvedIndexes(String className, Collection<String> fields)
      Description copied from interface: OIndexManager
      Returns 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:
      getClassInvolvedIndexes in interface OIndexManager
      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

      public Set<OIndex> getClassInvolvedIndexes(String className, String... fields)
      Description copied from interface: OIndexManager
      Returns 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:
      getClassInvolvedIndexes in interface OIndexManager
      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

      public boolean areIndexed(String className, Collection<String> fields)
      Description copied from interface: OIndexManager
      Indicates 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:
      areIndexed in interface OIndexManager
      Parameters:
      className - name of class which contain fields.
      fields - Field names.
      Returns:
      true if given fields are contained as first key fields in class indexes.
    • areIndexed

      public boolean areIndexed(String className, String... fields)
      Specified by:
      areIndexed in interface OIndexManager
      Parameters:
      className - name of class which contain fields.
      fields - Field names.
      Returns:
      true if given fields are contained as first key fields in class indexes.
      See Also:
    • getClassIndexes

      public Set<OIndex> getClassIndexes(String className)
      Description copied from interface: OIndexManager
      Gets indexes for a specified class (excluding indexes for sub-classes).
      Specified by:
      getClassIndexes in interface OIndexManager
      Parameters:
      className - name of class which is indexed.
      Returns:
      a set of indexes related to specified class
    • getClassIndexes

      public void getClassIndexes(String className, Collection<OIndex> indexes)
      Description copied from interface: OIndexManager
      Gets indexes for a specified class (excluding indexes for sub-classes).
      Specified by:
      getClassIndexes in interface OIndexManager
      Parameters:
      className - name of class which is indexed.
      indexes - Collection of indexes where to add all the indexes
    • getClassIndex

      public OIndex getClassIndex(String className, String indexName)
      Description copied from interface: OIndexManager
      Searches for index for a specified class with specified name.
      Specified by:
      getClassIndex in interface OIndexManager
      Parameters:
      className - name of class which is indexed.
      indexName - name of index.
      Returns:
      an index instance or null if such does not exist.
    • getClassUniqueIndex

      public OIndexUnique getClassUniqueIndex(String className)
      Description copied from interface: OIndexManager
      Returns the unique index for a class, if any.
      Specified by:
      getClassUniqueIndex in interface OIndexManager
    • getClassAutoShardingIndex

      public OIndex getClassAutoShardingIndex(String className)
      Description copied from interface: OIndexManager
      Returns the auto-sharding index defined for the class, if any.
      Specified by:
      getClassAutoShardingIndex in interface OIndexManager
      Parameters:
      className - Class name
    • recreateIndexes

      public void recreateIndexes()
      Description copied from interface: OIndexManager
      Drops all indexes and creates them from scratch.
      Specified by:
      recreateIndexes in interface OIndexManager
    • waitTillIndexRestore

      public void waitTillIndexRestore()
      Description copied from interface: OIndexManager
      Blocks current thread till indexes will be restored.
      Specified by:
      waitTillIndexRestore in interface OIndexManager
    • autoRecreateIndexesAfterCrash

      public boolean autoRecreateIndexesAfterCrash()
      Description copied from interface: OIndexManager
      Checks if indexes should be automatically recreated.

      IMPORTANT! Only for internal usage.

      Specified by:
      autoRecreateIndexesAfterCrash in interface OIndexManager
      Returns:
      true if crash is happened and database configured to automatically recreate indexes after crash.
    • addClusterToIndex

      public void addClusterToIndex(String clusterName, String indexName)
      Description copied from interface: OIndexManager
      Adds a cluster to tracked cluster list of specified index.

      IMPORTANT! Only for internal usage.

      Specified by:
      addClusterToIndex in interface OIndexManager
      Parameters:
      clusterName - cluster to add.
      indexName - name of index.
    • removeClusterFromIndex

      public void removeClusterFromIndex(String clusterName, String indexName)
      Description copied from interface: OIndexManager
      Removes a cluster from tracked cluster list of specified index.

      IMPORTANT! Only for internal usage.

      Specified by:
      removeClusterFromIndex in interface OIndexManager
      Parameters:
      clusterName - cluster to remove.
      indexName - name of index.
    • removeClassPropertyIndex

      public void removeClassPropertyIndex(OIndex idx)
      Description copied from interface: OIndexManager
      Removes index from class-property map.

      IMPORTANT! Only for internal usage.

      Specified by:
      removeClassPropertyIndex in interface OIndexManager
      Parameters:
      idx - index to remove.
    • getClassRawIndexes

      public void getClassRawIndexes(String name, Collection<OIndex> indexes)
    • delegate

      public OIndexManagerAbstract delegate()