module PgSearch::ScopeOptions::PgSearchRankTableAliasing

def increment_counter

def increment_counter
  @counter ||= 0
ensure
  @counter += 1
end

def pg_search_rank_table_alias(include_counter: false)

def pg_search_rank_table_alias(include_counter: false)
  components = [arel_table.name]
  if include_counter
    count = increment_counter
    components << count if count > 0
  end
  Configuration.alias(components)
end