Module: Pacer::Core::Graph::GraphIndexRoute

Included in:
PacerGraph
Defined in:
lib/pacer/core/graph/graph_index_route.rb

Overview

This module adds indexed route methods to the basic graph classes returned from the blueprints library.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#choose_best_indexObject

Returns the value of attribute choose_best_index.



10
11
12
# File 'lib/pacer/core/graph/graph_index_route.rb', line 10

def choose_best_index
  @choose_best_index
end

#never_scanObject

If never_scan is true, raise an exception if a graph route does not start with an indexed property. Large databases could spend hours scanning!



9
10
11
# File 'lib/pacer/core/graph/graph_index_route.rb', line 9

def never_scan
  @never_scan
end

#search_manual_indicesObject

Returns the value of attribute search_manual_indices.



11
12
13
# File 'lib/pacer/core/graph/graph_index_route.rb', line 11

def search_manual_indices
  @search_manual_indices
end

Instance Method Details

#e(*args, &block) ⇒ Object

Returns a new route to all graph edges. Standard filter options.



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/pacer/core/graph/graph_index_route.rb', line 29

def e(*args, &block)
  filters = Pacer::Route.edge_filters(self, args)
  if features.supportsKeyIndices or (search_manual_indices and features.supportsIndices)
    route = indexed_route(:edge, filters, block)
  end
  if route
    route
  elsif never_scan
    fail Pacer::ClientError, "No indexed properties found among: #{ filters.property_keys.join ', ' }"
  else
    super(filters, &block)
  end
end

#v(*args, &block) ⇒ Object

Returns a new route to all graph vertices. Standard filter options.



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/pacer/core/graph/graph_index_route.rb', line 14

def v(*args, &block)
  filters = Pacer::Route.filters(self, args)
  if features.supportsKeyIndices or (search_manual_indices and features.supportsIndices)
    route = indexed_route(:vertex, filters, block)
  end
  if route
    route
  elsif never_scan
    fail Pacer::ClientError, "No indexed properties found among: #{ filters.property_keys.join ', ' }"
  else
    super(filters, &block)
  end
end