Class: DorIndexing::Builders::TopicBuilder
- Inherits:
-
Object
- Object
- DorIndexing::Builders::TopicBuilder
- Defined in:
- lib/dor_indexing/builders/topic_builder.rb
Overview
Builds the topic fields for a solr document
Class Method Summary collapse
Instance Method Summary collapse
- #build(subjects) ⇒ Object
-
#initialize(filter:, remove_trailing_punctuation:) ⇒ TopicBuilder
constructor
A new instance of TopicBuilder.
Constructor Details
#initialize(filter:, remove_trailing_punctuation:) ⇒ TopicBuilder
Returns a new instance of TopicBuilder.
13 14 15 16 |
# File 'lib/dor_indexing/builders/topic_builder.rb', line 13 def initialize(filter:, remove_trailing_punctuation:) @filter = filter @remove_trailing_punctuation = remove_trailing_punctuation end |
Class Method Details
.build(subjects, filter:, remove_trailing_punctuation: false) ⇒ Object
9 10 11 |
# File 'lib/dor_indexing/builders/topic_builder.rb', line 9 def self.build(subjects, filter:, remove_trailing_punctuation: false) new(filter:, remove_trailing_punctuation:).build(subjects) end |
Instance Method Details
#build(subjects) ⇒ Object
18 19 20 |
# File 'lib/dor_indexing/builders/topic_builder.rb', line 18 def build(subjects) topics(subjects).flat_map { |topic| flat_topic(topic) }.compact.uniq end |