org.neo4j.unsafe.batchinsert

Interface BatchInserterIndex

    • Method Detail

      • add

        void add(long entityId,
                 Map<String,Object> properties)
        Adds key/value pairs for entity to the index. If there's a previous index for entity it will co-exist with this new one. This behavior is because of performance reasons, to not being forced to check if indexing for entity already exists or not. If you need to update indexing for entity and it's ok with a slower indexing process use updateOrAdd(long, Map) instead. Entries added to the index aren't necessarily written to the index and to disk until BatchInserterIndexProvider.shutdown() has been called. Entries added to the index isn't necessarily seen by other methods: updateOrAdd(long, Map), get(String, Object), query(String, Object) and query(Object) until a call to flush() has been made.
        Parameters:
        entityId - the entity (i.e id of Node or Relationship) to associate the key/value pairs with.
        properties - key/value pairs to index for entity.
      • updateOrAdd

        void updateOrAdd(long entityId,
                         Map<String,Object> properties)
        Adds key/value pairs for entity to the index. If there's any previous index for entity all such indexed key/value pairs will be deleted first. This method can be considerably slower than add(long, Map) because it must check if there are properties already indexed for entity. So if you know that there's no previous indexing for entity use add(long, Map) instead. Entries added to the index aren't necessarily written to the index and to disk until BatchInserterIndexProvider.shutdown() has been called. Entries added to the index isn't necessarily seen by other methods: updateOrAdd(long, Map), get(String, Object), query(String, Object) and query(Object) until a call to flush() has been made. So only entries added before the most recent flush() are guaranteed to be found by this method.
        Parameters:
        entityId - the entity (i.e id of Node or Relationship) to associate the key/value pairs with.
        properties - key/value pairs to index for entity.
      • query

        IndexHits<Long> query(String key,
                              Object queryOrQueryObject)
        Returns matches from this index based on the supplied key and query object, which can be a query string or an implementation-specific query object. Entries added to the index aren't necessarily written to the index and to disk until BatchInserterIndexProvider.shutdown() has been called. Entries added to the index isn't necessarily seen by other methods: updateOrAdd(long, Map), get(String, Object), query(String, Object) and query(Object) until a call to flush() has been made. So only entries added before the most recent flush() are guaranteed to be found by this method.
        Parameters:
        key - the key in this query.
        queryOrQueryObject - the query for the key to match.
        Returns:
        the result wrapped in an IndexHits object. If the entire result set isn't looped through, IndexHits.close() must be called before disposing of the result.
      • setCacheCapacity

        void setCacheCapacity(String key,
                              int size)
        Sets the cache size for key/value pairs for the given key. Caching values may increase get(String, Object) lookups significantly, but may at the same time slow down insertion of data some. Be sure to call this method to enable caching for keys that will be used a lot in lookups. It's also best to call this method for your keys right after the index has been created.
        Parameters:
        key - the key to set cache capacity for.
        size - the number of values to cache results for.

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