Class: Neo4j::Cypher::LuceneQuery

Inherits:
Start
  • Object
show all
Defined in:
lib/neo4j-cypher/start.rb

Constant Summary

Constants included from Clause

Clause::NAME, Clause::ORDER

Instance Attribute Summary

Attributes included from Clause

#clause_list, #clause_type, #eval_context, #expr, #insert_order

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Start

#entity_list, #to_cypher

Methods included from Clause

#<=>, #alias_name, #as_alias, #as_alias?, #clause_position, #create_clause_args_for, #match_value, #match_value=, #prefix, #referenced!, #referenced?, #return_value, #separator, #to_prop_string, #valid_clause?, #var_name, #var_name=

Constructor Details

#initialize(clause_list, query, type) ⇒ LuceneQuery

Returns a new instance of LuceneQuery.



49
50
51
# File 'lib/neo4j-cypher/start.rb', line 49

def initialize(clause_list, query, type)
  super(clause_list, "#{type}:#{query}")
end

Class Method Details

._index_name_for_key(index_class, key) ⇒ Object



77
78
79
80
81
82
83
84
85
# File 'lib/neo4j-cypher/start.rb', line 77

def self._index_name_for_key(index_class, key)
  if index_class.respond_to?(:index_type)
    index_type = index_class.index_type(key.to_s)
    raise "No index on #{index_class} property #{key}" unless index_type
    index_class.index_name_for_type(index_type)
  else
    index_class.to_s
  end
end

._index_name_for_type(index_class, index_type) ⇒ Object



73
74
75
# File 'lib/neo4j-cypher/start.rb', line 73

def self._index_name_for_type(index_class , index_type)
  index_class.respond_to?(:index_name_for_type) ? index_class.index_name_for_type(index_type) : index_class.to_s
end

._lookup_params(index_class, key, value) ⇒ Object



53
54
55
# File 'lib/neo4j-cypher/start.rb', line 53

def self._lookup_params(index_class, key, value)
  %Q[#{_index_name_for_key(index_class, key)}(#{key}="#{value}")]
end

.lookup_node_by_class(clause_list, index_class, key, value) ⇒ Object



57
58
59
# File 'lib/neo4j-cypher/start.rb', line 57

def self.lookup_node_by_class(clause_list, index_class, key, value)
  LuceneQuery.new(clause_list, _lookup_params(index_class, key, value), 'node')
end

.lookup_rel_by_class(clause_list, index_class, key, value) ⇒ Object



65
66
67
# File 'lib/neo4j-cypher/start.rb', line 65

def self.lookup_rel_by_class(clause_list, index_class, key, value)
  LuceneQuery.new(clause_list, _lookup_params(index_class, key, value), 'relationship')
end

.query_node_by_class(clause_list, index_class, query, index_type) ⇒ Object



61
62
63
# File 'lib/neo4j-cypher/start.rb', line 61

def self.query_node_by_class(clause_list, index_class, query, index_type)
  LuceneQuery.new(clause_list, "#{_index_name_for_type(index_class, index_type)}('#{query}')", 'node')
end

.query_rel_by_class(clause_list, index_class, query, index_type) ⇒ Object



69
70
71
# File 'lib/neo4j-cypher/start.rb', line 69

def self.query_rel_by_class(clause_list, index_class, query, index_type)
  LuceneQuery.new(clause_list, "#{_index_name_for_type(index_class, index_type)}('#{query}')", 'relationship')
end