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

Provide a search method under a unique name #1264

Closed
JasonBarnabe opened this issue Jul 7, 2024 · 1 comment
Closed

Provide a search method under a unique name #1264

JasonBarnabe opened this issue Jul 7, 2024 · 1 comment

Comments

@JasonBarnabe
Copy link

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
@pat
Copy link
Owner

pat commented Jul 7, 2024

Ended up implementing this in #1265, and is part of 5.6.0 which has just been released :)

@pat pat closed this as completed Jul 7, 2024
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

No branches or pull requests

2 participants