Files
fizzy/app/models/comment/searchable.rb
T
Mike Dalessio 0d138df952 Guard search indexing with searchable? check
Only index cards and comments if their card is `published?`, using a
new method `searchable?` that is implemented on both Card and Comment.
This prevents draft cards and their comments from being indexed.

When drafts are published, the existing `update_in_search_index`
callback creates the record via `upsert!`, or else ensures unpublished
records are removed from the index.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 12:13:08 -05:00

28 lines
326 B
Ruby

module Comment::Searchable
extend ActiveSupport::Concern
included do
include ::Searchable
end
def search_title
nil
end
def search_content
body.to_plain_text
end
def search_card_id
card_id
end
def search_board_id
card.board_id
end
def searchable?
card.published?
end
end