Module: S3arch::Handler
- Defined in:
- lib/s3arch/handler.rb
Class Method Summary collapse
Class Method Details
.indexer(event) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/s3arch/handler.rb', line 6 def indexer(event) if event['action'] == 'rebuild' S3arch::Indexer.new.rebuild(event['owner_id']) else S3arch::Indexer.new.process_event(event) end end |
.search(event) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/s3arch/handler.rb', line 14 def search(event) query = event['query'] owner_ids = event['owner_ids'] || [] filters = event['filters'] || {} return { record_ids: [], search_mode: 'fts5' } if query.nil? || owner_ids.empty? searcher = S3arch::Searcher.new result = searcher.search(query: query, owner_ids: owner_ids, filters: filters) result || { record_ids: nil, search_mode: nil } end |