class Documentable::Search
Search entries generator.
Takes a Documentable::Registry and generate all the necessary entries to enable search capabilities.
What is an entry? Is a JSON object with three different attributes:
method new
Defined as
method new(:)
Creates a new instance of the class.
method registry
Defined as
method registry(--> Documentable::Registry)
Documentable::Registry object used to generate the entries.
method generate-entries
Defined as
method generate-entries(--> Array[Str])
Generates all search entries and store them in an Array
. It generates three kind of entries:
Primary entries: these entries come from Documentable::Primary objects. We initialize one entry per instance of that class found in the registry as follows:
category => subkind attributevalue => name attributeurl => url attributeSecondary entries: these entries come from Documentable::Secondary objects. Before create any entry of this type, we group all
Documentable::Secondary
objects by name and after that, we generate one entry per group, as follows:category => kind attribute if more than one document is found. Subkind attribute otherwisevalue => name attributeurl => url attributeReference entries: these entries come from Documentable::Index objects. One entry per found object.
category => kind attribute (it's always Kind::Reference)value => name attributeurl => url attribute