class NoSE::Serialize::IndexBuilder
Reconstruct indexes with fields from an existing workload
Public Instance Methods
call(_, represented:, fragment:, **)
click to toggle source
# File lib/nose/serialize.rb, line 101 def call(_, represented:, fragment:, **) # Extract the entities from the workload model = represented.workload.model # Pull the fields from each entity f = lambda do |fields| fields.map { |dict| model[dict['parent']][dict['name']] } end graph_entities = fragment['graph']['nodes'].map { |n| model[n] } graph_keys = f.call(fragment['graph']['edges']) graph = QueryGraph::Graph.new graph_entities graph_keys.each { |k| graph.add_edge k.parent, k.entity, k } Index.new f.call(fragment['hash_fields']), f.call(fragment['order_fields']), f.call(fragment['extra']), graph, saved_key: fragment['key'] end