You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: search_helper.rb
    path of file: ./repos/bootcamp/app/helpers
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module SearchHelper
  def matched_document(searchable)
    if searchable.instance_of?(Comment)
      searchable.commentable_type.constantize.find(searchable.commentable_id)
    elsif searchable.instance_of?(Answer) || sea
    
  def filtered_message(searchable)
    if searchable.instance_of?(Comment) && searchable.commentable_type == 'Product'
      commentable = Product.find(searchable.commentable_id)
      if policy(commentable).show? || commentable.practice.open_product?
        searchable.description
      else
        '該当プラクティスを修了するまで他の人の提出物へのコメントは見れません。'
      end