Module: FullSearch::Typo

Defined in:
lib/full_search/typo.rb

Constant Summary collapse

MIN_SQLITE_VERSION =
[3, 34].freeze

Class Method Summary collapse

Class Method Details

.supported?(model = nil) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
# File 'lib/full_search/typo.rb', line 8

def supported?(model = nil)
  conn = model&.connection || ActiveRecord::Base.connection
  major, minor = sqlite_version_parts(conn)
  major > MIN_SQLITE_VERSION.first || (major == MIN_SQLITE_VERSION.first && minor >= MIN_SQLITE_VERSION.last)
end

.warn_unsupported!(model = nil) ⇒ Object



14
15
16
17
# File 'lib/full_search/typo.rb', line 14

def warn_unsupported!(model = nil)
  version = sqlite_version(model&.connection || ActiveRecord::Base.connection)
  warn "[full_search] SQLite #{version} does not support the trigram tokenizer. typo_tolerance requires SQLite >= 3.34."
end