lib/pg_search/features/tsearch.rb in pg_search-0.5 vs lib/pg_search/features/tsearch.rb in pg_search-0.5.1
- old
+ new
@@ -61,10 +61,11 @@
@query.split(" ").compact.map { |term| tsquery_for_term(term) }.join(@options[:any_word] ? ' || ' : ' && ')
end
def tsdocument
if @options[:tsvector_column]
- @options[:tsvector_column].to_s
+ column_name = connection.quote_column_name(@options[:tsvector_column])
+ "#{quoted_table_name}.#{column_name}"
else
@columns.map do |search_column|
tsvector = "to_tsvector(:dictionary, #{@normalizer.add_normalization(search_column.to_sql)})"
search_column.weight.nil? ? tsvector : "setweight(#{tsvector}, #{connection.quote(search_column.weight)})"
end.join(" || ")