Make `against` optional if `tsvector_column` is specified for all search features #164

BrentWheeldon opened this Issue Apr 9, 2014 · 2 comments

2 participants


Hi there!

We're using pg_search something like:

  pg_search_scope :search,
    against: '',
    using: [
      [:tsearch, {
        prefix: true,
        tsvector_column: :tsvector_tsearch
      [:dmetaphone, {
        tsvector_column: :tsvector_dmetaphone

Since we're using the tsvector columns, the against actually isn't used. Setting the against option to an empty string works, but looks kind of weird. And having all of out fields, and their weightings, in here when they're not actually being used seems confusing.

Do you have any suggestions on approaches we could take to solve this? Could we add more conditions to the check in PgSearch::Configuration easily? A quick poke around seemed to yield some pretty gross code. Perhaps specifying against: [:tsvector_tsearch, :tsvector_dmetaphone] might be the most obvious thing to do here, even though it's not really what's happening?

Any thoughts greatly appreciated!


Cool, thanks for the info! I will try to send a PR if I get a chance, but I'll close this for now.

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