lib/pg_search/features/tsearch.rb in pg_search-0.3.4 vs lib/pg_search/features/tsearch.rb in pg_search-0.4

- old
+ new

@@ -60,13 +60,17 @@ return "''" if @query.blank? @query.split(" ").compact.map { |term| tsquery_for_term(term) }.join(@options[:any_word] ? ' || ' : ' && ') end def tsdocument - @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(" || ") + if @options[:tsvector_column] + @options[:tsvector_column].to_s + 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(" || ") + end end # From http://www.postgresql.org/docs/8.3/static/textsearch-controls.html # 0 (the default) ignores the document length # 1 divides the rank by 1 + the logarithm of the document length