Module: Lexster::Node::ClassMethods

Defined in:
lib/lexster/node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#neo_subref_nodeObject

Returns the value of attribute neo_subref_node.



10
11
12
# File 'lib/lexster/node.rb', line 10

def neo_subref_node
  @neo_subref_node
end

Instance Method Details

#delete_commandObject



20
21
22
# File 'lib/lexster/node.rb', line 20

def delete_command
  :delete_node
end

#neo_model_indexObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/lexster/node.rb', line 24

def neo_model_index
  return nil unless Lexster.config.enable_per_model_indexes

  Lexster::logger.info "Node#neo_model_index #{neo_subref_rel_type}"

  gremlin_query = <<-GREMLIN
    g.createManualIndex(neo_model_index_name, Vertex.class);
  GREMLIN

  # Lexster.logger.info "subref query:\n#{gremlin_query}"

  script_vars = { neo_model_index_name: neo_model_index_name }

  Lexster.execute_script_or_add_to_batch gremlin_query, script_vars
end

#neo_search(term, options = {}) ⇒ Object



76
77
78
# File 'lib/lexster/node.rb', line 76

def neo_search(term, options = {})
  Lexster.search(self, term, options)
end

#neo_subref_node_rel_typeObject



16
17
18
# File 'lib/lexster/node.rb', line 16

def neo_subref_node_rel_type
  @_neo_subref_node_rel_type ||= self.name.tableize
end

#neo_subref_rel_typeObject



12
13
14
# File 'lib/lexster/node.rb', line 12

def neo_subref_rel_type
  @_neo_subref_rel_type ||= "#{self.name.tableize}_subref"
end

#reset_neo_subref_nodeObject



72
73
74
# File 'lib/lexster/node.rb', line 72

def reset_neo_subref_node
  @neo_subref_node = nil
end