diff --git a/lib/pg_search/features/feature.rb b/lib/pg_search/features/feature.rb index 4d598d63..cacde06b 100644 --- a/lib/pg_search/features/feature.rb +++ b/lib/pg_search/features/feature.rb @@ -24,8 +24,8 @@ def initialize(query, options, all_columns, model, normalizer) attr_reader :query, :options, :all_columns, :model, :normalizer - def document - columns.map(&:to_sql).join(" || ' ' || ") + def document(separator = " ") + columns.map(&:to_sql).join(" || '#{separator}' || ") end def columns diff --git a/lib/pg_search/features/tsearch.rb b/lib/pg_search/features/tsearch.rb index a4136bde..a8a9115b 100644 --- a/lib/pg_search/features/tsearch.rb +++ b/lib/pg_search/features/tsearch.rb @@ -29,7 +29,7 @@ def highlight def ts_headline Arel::Nodes::NamedFunction.new("ts_headline", [ dictionary, - arel_wrap(document), + arel_wrap(document((options[:highlight] || {})[:separator])), arel_wrap(tsquery), Arel::Nodes.build_quoted(ts_headline_options) ]).to_sql