class Decidim::Meetings::MeetingSearch

find the meetings.
‘current_component` param with a `Decidim::Component` in order to
This class handles search and filtering of meetings. Needs a

def initialize(options = {})

per_page - The number of proposals to return per page.
page - The page number to paginate the results.
component - A Decidim::Component to get the meetings from.
Public: Initializes the service.
def initialize(options = {})
  scope = options.fetch(:scope, Meeting.all)
  super(scope, options)
end

def localized_search_text_in(field)

The Hash with the `:text` key is required or it won't work.

Resource.where(localized_search_text_for(:title, text: "my_query"))
Example:

available locales. Note that it is intended to be used as follows:
Internal: builds the needed query to search for a text in the organization's
def localized_search_text_in(field)
  options[:organization].available_locales.map { |l| "#{field} ->> '#{l}' ILIKE :text" }.join(" OR ")
end

def search_date

Handle the date filter
def search_date
  if options[:date] == "upcoming"
    query.where("end_time >= ? ", Time.current).order(start_time: :asc)
  elsif options[:date] == "past"
    query.where("end_time <= ? ", Time.current).order(start_time: :desc)
  end
end

def search_search_text

Handle the search_text filter
def search_search_text
  query
    .where(localized_search_text_in(:title), text: "%#{search_text}%")
    .or(query.where(localized_search_text_in(:description), text: "%#{search_text}%"))
end

def search_space

def search_space
  return query if options[:space].blank? || options[:space] == "all"
  query.joins(:component).where(decidim_components: { participatory_space_type: options[:space].classify })
end