Sha256: 627a3f4a33cb846f22dce6b16c031e019f33e080ae49c99d8dbf2b12ad53ac04
Contents?: true
Size: 646 Bytes
Versions: 6
Compression:
Stored size: 646 Bytes
Contents
module Alchemy::PgSearch::PgSearchDocumentExtension def self.prepended(base) base.belongs_to :page, class_name: "::Alchemy::Page", foreign_key: "page_id" end ## # get a list of excerpts of the searched phrase # The JSON_AGG - method will transform the grouped content entries into json which have to be "unpacked". # @return [array<string>] def excerpts return [] if content.blank? begin parsed_content = JSON.parse content parsed_content.kind_of?(Array) ? parsed_content : [] rescue JSON::ParserError [] end end end PgSearch::Document.prepend(Alchemy::PgSearch::PgSearchDocumentExtension)
Version data entries
6 entries across 6 versions & 1 rubygems