Module: Neo4j::Core::Index

Included in:
Node, Relationship
Defined in:
lib/neo4j-core/index/index.rb,
lib/neo4j-core/index/indexer.rb,
lib/neo4j-core/index/index_config.rb,
lib/neo4j-core/index/lucene_query.rb,
lib/neo4j-core/index/class_methods.rb,
lib/neo4j-core/index/unique_factory.rb,
lib/neo4j-core/index/indexer_registry.rb

Overview

A mixin which adds indexing behaviour to your own Ruby class You are expected to implement the method ‘_java_entity` returning the underlying Neo4j Node or Relationship.

Defined Under Namespace

Modules: ClassMethods Classes: IndexConfig, Indexer, IndexerRegistry, LuceneQuery, UniqueFactory

Instance Method Summary collapse

Instance Method Details

#add_index(field, value = self[field]) ⇒ Object

Adds an index on the given property Notice that you normally don’t have to do that since you simply can declare that the property and index should be updated automatically by using the class method #index.

The index operation will take place immediately unlike when using the Neo4j::Core::Index::ClassMethods#index method which instead will guarantee that the neo4j database and the lucene database will be consistent. It uses a two phase commit when the transaction is about to be committed.



18
19
20
# File 'lib/neo4j-core/index/index.rb', line 18

def add_index(field, value=self[field])
  self.class.add_index(_java_entity, field.to_s, value)
end

#rm_index(field, value = self[field]) ⇒ Object

Removes an index on the given property. Just like #add_index this is normally not needed since you instead can declare it with the #index class method instead.



28
29
30
# File 'lib/neo4j-core/index/index.rb', line 28

def rm_index(field, value=self[field])
  self.class.rm_index(_java_entity, field.to_s, value)
end