Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advanced Search Queries #407

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Advanced Search Queries #407

wants to merge 2 commits into from

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