Commit 9f2e8dd35140def5af54bae4f54f134d26350b1e
1 parent
f13fb329
Exists in
master
and in
17 other branches
DRY warn code [skip ci]
Showing
3 changed files
with
8 additions
and
4 deletions
Show diff stats
lib/searchkick.rb
lib/searchkick/query.rb
... | ... | @@ -432,7 +432,7 @@ module Searchkick |
432 | 432 | |
433 | 433 | models = Array(options[:models]) |
434 | 434 | if models.any? { |m| m != m.searchkick_klass } |
435 | - warn "[searchkick] WARNING: Passing child models to models option throws off hits and pagination - use type option instead" | |
435 | + Searchkick.warn("Passing child models to models option throws off hits and pagination - use type option instead") | |
436 | 436 | |
437 | 437 | # uncomment once aliases are supported with _index |
438 | 438 | # see https://github.com/elastic/elasticsearch/issues/23306 |
... | ... | @@ -986,13 +986,13 @@ module Searchkick |
986 | 986 | {bool: {must_not: {exists: {field: field}}}} |
987 | 987 | elsif value.is_a?(Regexp) |
988 | 988 | if value.casefold? |
989 | - warn "[searchkick] Case-insensitive flag does not work with Elasticsearch" | |
989 | + Searchkick.warn("Case-insensitive flag does not work with Elasticsearch") | |
990 | 990 | end |
991 | 991 | |
992 | 992 | source = value.source |
993 | 993 | unless source.start_with?("\\A") && source.end_with?("\\z") |
994 | 994 | # https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-regexp-query.html |
995 | - warn "[searchkick] Regular expressions are always anchored in Elasticsearch" | |
995 | + Searchkick.warn("Regular expressions are always anchored in Elasticsearch") | |
996 | 996 | end |
997 | 997 | |
998 | 998 | # TODO handle other anchor characters, like ^, $, \Z | ... | ... |
lib/searchkick/results.rb
... | ... | @@ -62,7 +62,7 @@ module Searchkick |
62 | 62 | end |
63 | 63 | |
64 | 64 | if missing_ids.any? |
65 | - warn "[searchkick] WARNING: Records in search index do not exist in database: #{missing_ids.join(", ")}" | |
65 | + Searchkick.warn("Records in search index do not exist in database: #{missing_ids.join(", ")}") | |
66 | 66 | end |
67 | 67 | |
68 | 68 | results | ... | ... |