There are cases when computing ranking between search results and the default order by ORDER BY rank DESC, id ASC is not required.
Although the default ordering can be disabled with .reorder(nil) the ranking computation itself can't be disabled.
I wish there was a an option for pg_search's ranked_by to disable it.
Something like: rank: false or ranked_by: false
If I'm not mistaken it should be possible by making this optional:
|
def rank |
|
(config.ranking_sql || ":tsearch").gsub(/:(\w*)/) do |
|
feature_for(Regexp.last_match(1)).rank.to_sql |
|
end |
|
end |
so that if config.ranking_sql (which is the value of options[:ranked_by]) is explicitly set to false ranking can be skipped entirely.
I can try to transform this idea into a PR, let me know
There are cases when computing ranking between search results and the default order by
ORDER BY rank DESC, id ASCis not required.Although the default ordering can be disabled with
.reorder(nil)the ranking computation itself can't be disabled.I wish there was a an option for
pg_search'sranked_byto disable it.Something like:
rank: falseorranked_by: falseIf I'm not mistaken it should be possible by making this optional:
pg_search/lib/pg_search/scope_options.rb
Lines 138 to 142 in ea17b19
so that if
config.ranking_sql(which is the value ofoptions[:ranked_by]) is explicitly set tofalseranking can be skipped entirely.I can try to transform this idea into a PR, let me know