Class: Decidim::SearchableResource

Inherits:
ApplicationRecord show all
Includes:
PgSearch::Model
Defined in:
decidim-core/app/models/decidim/searchable_resource.rb

Overview

A Searchable Resource. This is a model to a PgSearch table that indexes all searchable resources. This table is used to perform textual searches.

Main attributes are:

  • locale: One entry per locale is required, so each resource will be indexed once per locale.

  • content_a: The most relevant textual content.

  • content_b: The second most relevant textual content.

  • content_c: The third most relevant textual content.

  • content_d: The less relevant textual content.

  • datetime: The timestamp that places this resource in the line of time. Used as second criteria (first is text relevance) for sorting.

Instance Method Summary collapse

Instance Method Details

#resource_global_idObject

Returns the global ID of the resource.



48
49
50
51
52
53
54
# File 'decidim-core/app/models/decidim/searchable_resource.rb', line 48

def resource_global_id
  URI::GID.build(
    app: GlobalID.app,
    model_name: resource_type,
    model_id: resource_id
  ).to_s
end