Class: SearchResolverCompactResource

Inherits:
Object
  • Object
show all
Defined in:
backend/app/model/search_resolver_compact_resource.rb

Constant Summary collapse

FIELDS_TO_KEEP =
['id_0', 'id_1', 'id_2', 'id_3', 'level', 'other_level', 'title', 'uri', 'publish']

Instance Method Summary collapse

Instance Method Details

#resolve(record) ⇒ Object

Really just including this as a demo. Let’s parse the JSON and extract a few fields.



6
7
8
9
# File 'backend/app/model/search_resolver_compact_resource.rb', line 6

def resolve(record)
  resource = ASUtils.json_parse(record['json'])
  resource.select {|key, _| FIELDS_TO_KEEP.include?(key)}
end