Skip to content

Conversation

@skryl
Copy link

@skryl skryl commented Jun 1, 2019

:advanced

Setting this attribute to true will allow you to pass advanced search queries directly to postgres, without pg_search doing any processing on the terms.

class Number < ActiveRecord::Base
  include PgSearch
  pg_search_scope :advanced_search,
                  against: :text,
                  using: {
                    tsearch: {advanced: true}
                  }
end

one = Number.create! text: 'one two three'
one = Number.create! text: 'one three two'

Number.advanced_search('one<->two') # => ['one two three']

See the
documentation
for details on the meaning of each option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant