0d138df952
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>
28 lines
326 B
Ruby
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
|