Sha256: 3130ffd5e033562e235135c1388498aa60d4fb7da768cbea2cf96cc4cc6209ee

Contents?: true

Size: 642 Bytes

Versions: 3

Compression:

Stored size: 642 Bytes

Contents

module PgSearch
  module Features
    class Feature
      def initialize(query, options, columns, model, normalizer)
        @query = query
        @options = options || {}
        @columns = columns
        @model = model
        @normalizer = normalizer
      end

      private

      def document
        if @columns.length == 1
          @columns.first.to_sql
        else
          expressions = @columns.map { |column| column.to_sql }.join(", ")
          "array_to_string(ARRAY[#{expressions}], ' ')"
        end
      end

      def normalize(expression)
        @normalizer.add_normalization(expression)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pg_search-0.5.4 lib/pg_search/features/feature.rb
pg_search-0.5.3 lib/pg_search/features/feature.rb
pg_search-0.5.2 lib/pg_search/features/feature.rb