Module: SequelTextSearchable
- Defined in:
- lib/sequel/text_searchable.rb
Constant Summary collapse
- VERSION =
"0.0.1"
- INDEX_MODES =
[:async, :sync, :off].freeze
- DEFAULT_MODE =
:async
Class Attribute Summary collapse
-
.threadpool ⇒ Object
Return the global threadpool for :async indexing.
Class Method Summary collapse
Class Attribute Details
.threadpool ⇒ Object
Return the global threadpool for :async indexing. Use at most a couple threads; if the work gets backed up, have the caller run it. If the threads die, the text update is lost, so we don’t want to let it queue up forever.
26 27 28 29 30 31 32 33 |
# File 'lib/sequel/text_searchable.rb', line 26 def threadpool return @threadpool ||= Concurrent::ThreadPoolExecutor.new( min_threads: 1, max_threads: 2, max_queue: 10, fallback_policy: :caller_runs, ) end |
Class Method Details
.index_mode ⇒ Object
12 |
# File 'lib/sequel/text_searchable.rb', line 12 def index_mode = @index_mode || DEFAULT_MODE |
.index_mode=(v) ⇒ Object
14 15 16 17 18 |
# File 'lib/sequel/text_searchable.rb', line 14 def index_mode=(v) raise ArgumentError, "mode #{v.inspect} must be one of: #{INDEX_MODES}" unless INDEX_MODES.include?(v) @index_mode = v end |
.reindex_all ⇒ Object
38 39 40 |
# File 'lib/sequel/text_searchable.rb', line 38 def reindex_all return self.searchable_models.sum(&:text_search_reindex_all) end |
.searchable_models ⇒ Object
20 |
# File 'lib/sequel/text_searchable.rb', line 20 def searchable_models = @searchable_models ||= [] |