Class: Lutaml::UmlRepository::StaticSite::SearchIndexBuilder
- Inherits:
-
Object
- Object
- Lutaml::UmlRepository::StaticSite::SearchIndexBuilder
- Defined in:
- lib/lutaml/uml_repository/static_site/search_index_builder.rb
Overview
Builds a lunr.js-compatible search index from a UML repository.
The index includes:
-
Document store with searchable content
-
Field configuration for lunr.js
-
Pre-processed tokens for efficient client-side search
Constant Summary collapse
- STOP_WORDS =
%w[ the a an and or but in on at to for of with from by is are was were be been being have has had this that these those it its ].freeze
Instance Attribute Summary collapse
-
#id_generator ⇒ Object
readonly
Returns the value of attribute id_generator.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
-
#build ⇒ Hash
Build the search index.
-
#initialize(repository, options = {}) ⇒ SearchIndexBuilder
constructor
Initialize search index builder.
Constructor Details
#initialize(repository, options = {}) ⇒ SearchIndexBuilder
Initialize search index builder
33 34 35 36 37 |
# File 'lib/lutaml/uml_repository/static_site/search_index_builder.rb', line 33 def initialize(repository, = {}) @repository = repository @options = .merge() @id_generator = IDGenerator.new end |
Instance Attribute Details
#id_generator ⇒ Object (readonly)
Returns the value of attribute id_generator.
20 21 22 |
# File 'lib/lutaml/uml_repository/static_site/search_index_builder.rb', line 20 def id_generator @id_generator end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
20 21 22 |
# File 'lib/lutaml/uml_repository/static_site/search_index_builder.rb', line 20 def @options end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
20 21 22 |
# File 'lib/lutaml/uml_repository/static_site/search_index_builder.rb', line 20 def repository @repository end |
Instance Method Details
#build ⇒ Hash
Build the search index
42 43 44 45 46 47 48 49 50 |
# File 'lib/lutaml/uml_repository/static_site/search_index_builder.rb', line 42 def build { version: "1.0.0", fields: field_definitions, ref: "id", documentStore: build_document_store, pipeline: ["stemmer", "stopWordFilter"], } end |