Interface OIndex

All Superinterfaces:
Comparable<OIndex>
All Known Subinterfaces:
OIndexInternal
All Known Implementing Classes:
OIndexAbstract, OIndexDictionary, OIndexFullText, OIndexMultiValues, OIndexNotUnique, OIndexOneValue, OIndexRemote, OIndexRemoteMultiValue, OIndexRemoteOneValue, OIndexUnique, OLuceneFullTextIndex, OLuceneIndexNotUnique, OLuceneSpatialIndex

public interface OIndex extends Comparable<OIndex>
Basic interface to handle index.
Author:
Luca Garulli (l.garulli--(at)--orientdb.com)
  • Method Details

    • getDatabaseName

      String getDatabaseName()
    • getKeyTypes

      OType[] getKeyTypes()
      Types of the keys that index can accept, if index contains composite key, list of types of elements from which this index consist will be returned, otherwise single element (key type obviously) will be returned.
    • get

      Deprecated.
      Use OIndexInternal.getRids(Object) instead, but only as internal (not public) API.
      Gets the set of records associated with the passed key.
      Parameters:
      key - The key to search
      Returns:
      The Record set if found, otherwise an empty Set
    • put

      OIndex put(Object key, OIdentifiable value)
      Inserts a new entry in the index. The behaviour depends by the index implementation.
      Parameters:
      key - Entry's key
      value - Entry's value as OIdentifiable instance
      Returns:
      The index instance itself to allow in chain calls
    • remove

      boolean remove(Object key)
      Removes an entry by its key.
      Parameters:
      key - The entry's key to remove
      Returns:
      True if the entry has been found and removed, otherwise false
    • remove

      boolean remove(Object key, OIdentifiable rid)
      Removes an entry by its key and value.
      Parameters:
      key - The entry's key to remove
      Returns:
      True if the entry has been found and removed, otherwise false
    • clear

      Deprecated.
      Manual indexes are deprecated and will be removed
      Clears the index removing all the entries in one shot.
      Returns:
      The index instance itself to allow in chain calls
    • getSize

      @Deprecated long getSize()
      Deprecated.
      Use OIndexInternal.size() instead. This API only for internal use !.
      Returns:
      number of entries in the index.
    • count

      @Deprecated long count(Object iKey)
      Deprecated.
      Use index.getInternal().getRids(key).count() instead. This API only for internal use !.
      Counts the entries for the key.
    • getKeySize

      @Deprecated long getKeySize()
      Deprecated.
      Use index.getInternal().getRids(key).distinct().count() instead. This API only for internal use !.
      Returns:
      Number of keys in index
    • flush

      @Deprecated void flush()
      Deprecated.
      Flushes in-memory changes to disk.
    • getRebuildVersion

      @Deprecated long getRebuildVersion()
      Deprecated.
    • isRebuilding

      @Deprecated boolean isRebuilding()
      Deprecated.
      Returns:
      Indicates whether index is rebuilding at the moment.
      See Also:
    • getFirstKey

      @Deprecated Object getFirstKey()
      Deprecated.
      Use index.getInternal().stream().findFirst().map(pair->pair.first) instead. This API only for internal use !
    • getLastKey

      @Deprecated Object getLastKey()
      Deprecated.
      Use index.getInternal().descStream().findFirst().map(pair->pair.first) instead. This API only for internal use !
    • cursor

      Deprecated.
      Use index.getInternal().stream() instead. This API only for internal use !
    • descCursor

      Deprecated.
      Use index.getInternal().descStream() instead. This API only for internal use !
    • keyCursor

      Deprecated.
      Use index.getInternal().keyStream() instead. This API only for internal use !
    • delete

      OIndex delete()
      Delete the index.
      Returns:
      The index instance itself to allow in chain calls
    • getName

      String getName()
      Returns the index name.
      Returns:
      The name of the index
    • getType

      String getType()
      Returns the type of the index as string.
    • getAlgorithm

      String getAlgorithm()
      Returns the engine of the index as string.
    • getVersion

      int getVersion()
      Returns binary format version for this index. Index format changes during system development but old formats are supported for binary compatibility. This method may be used to detect version of binary format which is used by current index and upgrade index to new one.
      Returns:
      Returns binary format version for this index if possible, otherwise -1.
    • isAutomatic

      boolean isAutomatic()
      Tells if the index is automatic. Automatic means it's maintained automatically by OrientDB. This is the case of indexes created against schema properties. Automatic indexes can always been rebuilt.
      Returns:
      True if the index is automatic, otherwise false
    • rebuild

      long rebuild()
      Rebuilds an automatic index.
      Returns:
      The number of entries rebuilt
    • rebuild

      long rebuild(OProgressListener iProgressListener)
      Populate the index with all the existent records.
    • getConfiguration

      ODocument getConfiguration()
      Returns the index configuration.
      Returns:
      An ODocument object containing all the index properties
    • getInternal

      OIndexInternal getInternal()
      Returns the internal index used.
    • getDefinition

      OIndexDefinition getDefinition()
    • getClusters

      Set<String> getClusters()
      Returns Names of clusters that will be indexed.
      Returns:
      Names of clusters that will be indexed.
    • iterateEntries

      @Deprecated OIndexCursor iterateEntries(Collection<?> keys, boolean ascSortOrder)
      Deprecated.
      Use OIndexInternal.streamEntries(Collection, boolean) instead. This API only for internal use !
      Returns cursor which presents data associated with passed in keys.
      Parameters:
      keys - Keys data of which should be returned.
      ascSortOrder - Flag which determines whether data iterated by cursor should be in ascending or descending order.
      Returns:
      cursor which presents data associated with passed in keys.
    • iterateEntriesBetween

      @Deprecated OIndexCursor iterateEntriesBetween(Object fromKey, boolean fromInclusive, Object toKey, boolean toInclusive, boolean ascOrder)
      Deprecated.
      Returns cursor which presents subset of index data between passed in keys.
      Parameters:
      fromKey - Lower border of index data.
      fromInclusive - Indicates whether lower border should be inclusive or exclusive.
      toKey - Upper border of index data.
      toInclusive - Indicates whether upper border should be inclusive or exclusive.
      ascOrder - Flag which determines whether data iterated by cursor should be in ascending or descending order.
      Returns:
      Cursor which presents subset of index data between passed in keys.
    • iterateEntriesMajor

      @Deprecated OIndexCursor iterateEntriesMajor(Object fromKey, boolean fromInclusive, boolean ascOrder)
      Deprecated.
      Use OIndexInternal.streamEntriesMajor(Object, boolean, boolean) instead. This API only for internal use !
      Returns cursor which presents subset of data which associated with key which is greater than passed in key.
      Parameters:
      fromKey - Lower border of index data.
      fromInclusive - Indicates whether lower border should be inclusive or exclusive.
      ascOrder - Flag which determines whether data iterated by cursor should be in ascending or descending order.
      Returns:
      cursor which presents subset of data which associated with key which is greater than passed in key.
    • iterateEntriesMinor

      @Deprecated OIndexCursor iterateEntriesMinor(Object toKey, boolean toInclusive, boolean ascOrder)
      Deprecated.
      Use OIndexInternal.streamEntriesMinor(Object, boolean, boolean) instead. This API only for internal use !
      Returns cursor which presents subset of data which associated with key which is less than passed in key.
      Parameters:
      toKey - Upper border of index data.
      toInclusive - Indicates Indicates whether upper border should be inclusive or exclusive.
      ascOrder - Flag which determines whether data iterated by cursor should be in ascending or descending order.
      Returns:
      cursor which presents subset of data which associated with key which is less than passed in key.
    • getMetadata

      ODocument getMetadata()
    • supportsOrderedIterations

      boolean supportsOrderedIterations()
    • isUnique

      boolean isUnique()