Skip to content

Provide a search method under a unique name #1264

@JasonBarnabe

Description

@JasonBarnabe

Related to #1241.

If you have TS and something else both trying to define ActiveRecord::Base.search, it's unclear which implementation you will end up with. If TS also defined something like ActiveRecord::Base.ts_search, then this could be used to target TS specifically.

A monkeypatch to accomplish this:

# To disambiguate #search (ES vs TS).
module DisambiguousThinkingSphinx
  extend ActiveSupport::Concern

  module ClassMethods
    def ts_search(query = nil, options = {})
      merge_search ThinkingSphinx.search, query, options
    end
  end
end
ActiveRecord::Base.include DisambiguousThinkingSphinx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions