Class: Deepsearch::Engine::Steps::DataAggregation::Process
- Inherits:
-
Object
- Object
- Deepsearch::Engine::Steps::DataAggregation::Process
- Defined in:
- lib/deepsearch/engine/steps/data_aggregation/process.rb
Overview
Takes a list of website URLs from a previous search step and processes them in parallel. For each URL, it fetches, parses, and cleans the content using ‘ParsedWebsite`. It aggregates the successfully parsed websites into a `Result` object.
Constant Summary collapse
- MAX_CONCURRENCY =
30
Instance Attribute Summary collapse
-
#websites ⇒ Object
readonly
Returns the value of attribute websites.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(websites: []) ⇒ Process
constructor
A new instance of Process.
Constructor Details
#initialize(websites: []) ⇒ Process
Returns a new instance of Process.
20 21 22 |
# File 'lib/deepsearch/engine/steps/data_aggregation/process.rb', line 20 def initialize(websites: []) @websites = websites end |
Instance Attribute Details
#websites ⇒ Object (readonly)
Returns the value of attribute websites.
18 19 20 |
# File 'lib/deepsearch/engine/steps/data_aggregation/process.rb', line 18 def websites @websites end |
Instance Method Details
#execute ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/deepsearch/engine/steps/data_aggregation/process.rb', line 24 def execute Deepsearch.configuration.logger.debug("Starting data aggregation for #{@websites.size} websites") parsed_websites = process_in_parallel parsed_websites.filter!(&:success?) Result.new( parsed_websites: parsed_websites ) rescue StandardError => e Result.new( parsed_websites: [], error: e. ) end |