org.neo4j.graphdb.index

Interface Index<T extends PropertyContainer>

    • Method Detail

      • add

        void add(T entity,
                 String key,
                 Object value)
        Adds a key/value pair for entity to the index. If that key/value pair for the entity is already in the index it's up to the implementation to make it so that such an operation is idempotent.
        Parameters:
        entity - the entity (i.e Node or Relationship) to associate the key/value pair with.
        key - the key in the key/value pair to associate with the entity.
        value - the value in the key/value pair to associate with the entity.
      • remove

        void remove(T entity,
                    String key,
                    Object value)
        Removes a key/value pair for entity from the index. If that key/value pair isn't associated with entity in this index this operation doesn't do anything.
        Parameters:
        entity - the entity (i.e Node or Relationship) to dissociate the key/value pair from.
        key - the key in the key/value pair to dissociate from the entity.
        value - the value in the key/value pair to dissociate from the entity.
      • remove

        void remove(T entity,
                    String key)
        Removes key/value pairs for entity where key is key from the index. Implementations can choose to not implement this method and should in that case throw UnsupportedOperationException.
        Parameters:
        entity - the entity (Node or Relationship) to remove the this index.
        key - the key associated with the index entry
      • delete

        void delete()
        Clears the index and deletes the configuration associated with it. After this it's invalid to call any other method on this index. However if the transaction which the delete operation was called in gets rolled back it again becomes ok to use this index.
      • putIfAbsent

        T putIfAbsent(T entity,
                      String key,
                      Object value)
        Add the entity to this index for the given key/value pair if this particular key/value pair doesn't already exist. This ensures that only one entity will be associated with the key/value pair even if multiple transactions are trying to add it at the same time. One of those transactions will win and add it while the others will block, waiting for the winning transaction to finish. If the winning transaction was successful these other transactions will return the associated entity instead of adding it. If it wasn't successful the waiting transactions will begin a new race to add it.
        Parameters:
        entity - the entity (i.e Node or Relationship) to associate the key/value pair with.
        key - the key in the key/value pair to associate with the entity.
        value - the value in the key/value pair to associate with the entity.
        Returns:
        the previously indexed entity, or null if no entity was indexed before (and the specified entity was added to the index).

Copyright © 2002–2017 The Neo4j Graph Database Project. All rights reserved.