full_search 0.4.7 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a47cd95db7244715db988cdce15e8466dc2131d3a995769071ca7b513f7b91e4
4
- data.tar.gz: 35303e2f06de22ccfcd1e20018d8f1a83cd1d32bd2d883cdd7ba60c1919d3541
3
+ metadata.gz: f50c2f24f4b4929d3da0744d93e33a0b6c5a6ba3743c4542612c6e1007687691
4
+ data.tar.gz: d497857811078992322ad4cd081e41aa476878c0950b71a2ec5bcd7a76ff8db2
5
5
  SHA512:
6
- metadata.gz: 1316924b824ef6814d2899ee165426b8eee7b021fc7bde0ee358f6a9066f2668561f27fb1de12f12bd0d3b836f91a2d428eb1c9da9e0db7dc494cf037ea707e5
7
- data.tar.gz: 3c359e74e2898302ef51ada7f864c22c1b2dd340fb27e5e097b59baa78bae97b800d74ad020f172f202c2da85d3094925aba3fbad9cdc00dc5929fd990803dab
6
+ metadata.gz: bf77188446fed43a0e9f69826f85ced628f5960d493cbd96d721730e9fd9d8c92ffe5c58412aee47e81feb01adca00e2e7b7641f85ea01fe2c98fcaaca05b5f1
7
+ data.tar.gz: 89e0b8dc7ee2b44391deb5c339e2b048c836431a5997ab19c281285b1fef79fcfe5ad4fea02793a672643899e08e5276a12dbadacf51cb3411853d389c6fbbf7
@@ -85,7 +85,8 @@ module FullSearch
85
85
  def check_stale_config!
86
86
  if FullSearch::Index.missing_table?(model)
87
87
  if FullSearch.config.auto_rebuild_missing_tables
88
- FullSearch::Index.rebuild!(model)
88
+ FullSearch.logger.info("[full_search] Auto-creating missing FTS table for #{model.table_name}")
89
+ FullSearch::Index.ensure_table!(model)
89
90
  return
90
91
  end
91
92
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FullSearch
4
- VERSION = "0.4.7"
4
+ VERSION = "0.4.8"
5
5
  end
data/lib/full_search.rb CHANGED
@@ -72,6 +72,16 @@ module FullSearch
72
72
  def bulk_importing?(model)
73
73
  BulkImport.bulk_importing?(model)
74
74
  end
75
+
76
+ def logger
77
+ return @logger if defined?(@logger) && @logger
78
+
79
+ @logger = if defined?(Rails) && Rails.respond_to?(:logger) && Rails.logger
80
+ Rails.logger
81
+ else
82
+ Logger.new(File::NULL)
83
+ end
84
+ end
75
85
  end
76
86
  end
77
87
 
@@ -5,6 +5,9 @@ FullSearch.configure do |config|
5
5
 
6
6
  config.auto_rebuild_on_stale_query = Rails.env.local?
7
7
 
8
+ # Auto-create missing FTS tables on first query in dev/test instead of raising.
9
+ config.auto_rebuild_missing_tables = Rails.env.local?
10
+
8
11
  config.stale_query_behavior = Rails.env.production? ? :log_and_fallback : :raise
9
12
 
10
13
  config.lock_rebuilds = true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: full_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben D'Angelo