caoutsearch 0.0.7 → 0.0.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: b63cce452c0627b856cb582366494c13b997a5e387ed03d2311b7f9ea8ea80f0
4
- data.tar.gz: f9fe10e15528bef3d13b668fe6e2cc9e1a693c0d171797a463cf93ae4e3aca37
3
+ metadata.gz: 82c211241267ff95d58756ac59023647d3ddadc86dacb8437bf0de0b78e0d835
4
+ data.tar.gz: b44e855ff204810d7b2820110ea3fe0b9beaf67293b4a5c5de69132473917358
5
5
  SHA512:
6
- metadata.gz: 9b5b638e8050f586b8140f729847d236e280c44e074b3300e746cf763fb861cfde3a5e5ac4071601782008aed363ed7130614914c25ec9f4c68f6542839145ad
7
- data.tar.gz: 0b2e3ec3ff278bd7615d4b39e82738bb805c25264ae0cad3289c7c626e7a9e71b0cddc8cad1f9b28bbbb2e059061f800aa7df3189bae860da2fd39fee44cfd99
6
+ metadata.gz: c339a3e527771299baee300002fd46ce1ce8f05a17a7896978aec440439683865c80e15d308110a9b92a764a22a77da596fcb958a53a829a28d8a41247527c8e
7
+ data.tar.gz: '09533510be354a1a9b1a14c3659300e990b5dd656d96ef6a696277b8f1cf76b21a35c2a66f8395f92c12bbad96be5476506c6efa4deb561dda392a64f7a001a0'
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2022 Mon Territoire
1
+ Copyright (c) 2023 Solutions & Territoire
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # Caoutsearch [\ˈkawt͡ˈsɝtʃ\\](http://ipa-reader.xyz/?text=ˈkawt͡ˈsɝtʃ)
2
2
 
3
3
  <span>[![Gem Version](https://badge.fury.io/rb/caoutsearch.svg)](https://rubygems.org/gems/caoutsearch)</span> <span>
4
- [![CI Status](https://github.com/mon-territoire/caoutsearch/actions/workflows/ci.yml/badge.svg)](https://github.com/mon-territoire/caoutsearch/actions/workflows/ci.yml)</span> <span>
4
+ [![CI Status](https://github.com/solutions-territoire/caoutsearch/actions/workflows/ci.yml/badge.svg)](https://github.com/solutions-territoire/caoutsearch/actions/workflows/ci.yml)</span> <span>
5
5
  [![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)</span> <span>
6
- [![Maintainability](https://api.codeclimate.com/v1/badges/fbe73db3fd8be9a10e12/maintainability)](https://codeclimate.com/github/mon-territoire/caoutsearch/maintainability)</span> <span>
7
- [![Test Coverage](https://api.codeclimate.com/v1/badges/fbe73db3fd8be9a10e12/test_coverage)](https://codeclimate.com/github/mon-territoire/caoutsearch/test_coverage)</span>
6
+ [![Maintainability](https://api.codeclimate.com/v1/badges/fbe73db3fd8be9a10e12/maintainability)](https://codeclimate.com/github/solutions-territoire/caoutsearch/maintainability)</span> <span>
7
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/fbe73db3fd8be9a10e12/test_coverage)](https://codeclimate.com/github/solutions-territoire/caoutsearch/test_coverage)</span>
8
8
 
9
- <span>[![JRuby](https://github.com/mon-territoire/caoutsearch/actions/workflows/jruby.yml/badge.svg)](https://github.com/mon-territoire/caoutsearch/actions/workflows/jruby.yml)</span> <span>
10
- [![Truffle Ruby](https://github.com/mon-territoire/caoutsearch/actions/workflows/truffle_ruby.yml/badge.svg)](https://github.com/mon-territoire/caoutsearch/actions/workflows/truffle_ruby.yml)</span>
9
+ <span>[![JRuby](https://github.com/solutions-territoire/caoutsearch/actions/workflows/jruby.yml/badge.svg)](https://github.com/solutions-territoire/caoutsearch/actions/workflows/jruby.yml)</span> <span>
10
+ [![Truffle Ruby](https://github.com/solutions-territoire/caoutsearch/actions/workflows/truffle_ruby.yml/badge.svg)](https://github.com/solutions-territoire/caoutsearch/actions/workflows/truffle_ruby.yml)</span>
11
11
 
12
12
  **!! Gem under development before public release !!**
13
13
 
@@ -15,14 +15,14 @@ Caoutsearch is a new Elasticsearch integration for Ruby and/or Rails.
15
15
  It provides a simple but powerful DSL to perform complex indexing and searching, while securely exposing search criteria to a public and chainable API, without overwhelming your models.
16
16
 
17
17
  Caoutsearch only supports Elasticsearch 8.x right now.
18
- It is used in production in a robust application, updated and maintained for several years at [Mon Territoire](https://mon-territoire.fr).
18
+ It is used in production in a robust application, updated and maintained for several years at [Solutions & Territoire](https://solutions-territoire.fr).
19
19
 
20
20
  Caoutsearch was inspired by awesome gems such as [elasticsearch-rails](https://github.com/elastic/elasticsearch-rails) or [search_flip](https://github.com/mrkamel/search_flip).
21
21
  Depending on your search scenarios, they may better suite your needs.
22
22
 
23
23
  ## Documentation
24
24
 
25
- Visit our [offical documentation](https://mon-territoire.github.io/caoutsearch) to understand how to use Caoutsearch.
25
+ Visit our [offical documentation](https://solutions-territoire.github.io/caoutsearch) to understand how to use Caoutsearch.
26
26
 
27
27
  ## Installation
28
28
 
@@ -71,8 +71,8 @@ ArticleSearch.search(published_on: [["now-1y", nil]]).aggregate(:popular_tags)
71
71
 
72
72
  ## Contributing
73
73
 
74
- 1. Don't hesitate to submit your feature/idea/fix in [issues](https://github.com/inkstak/activejob-status)
75
- 2. Fork the [repository](https://github.com/inkstak/activejob-status)
74
+ 1. Don't hesitate to submit your feature/idea/fix in [issues](https://github.com/solutions-territoire/caoutsearch/issues)
75
+ 2. Fork the [repository](https://github.com/solutions-territoire/caoutsearch)
76
76
  3. Create your feature branch
77
77
  4. Ensure RSpec & Rubocop are passing
78
78
  4. Create a pull request
@@ -99,7 +99,7 @@ bundle exec rake
99
99
 
100
100
  ## License & credits
101
101
 
102
- Please see [LICENSE](https://github.com/mon-territoire/caoutsearch/blob/main/LICENSE) for further details.
102
+ Please see [LICENSE](https://github.com/solutions-territoire/caoutsearch/blob/main/LICENSE) for further details.
103
103
 
104
- Contributors: [./graphs/contributors](https://github.com/mon-territoire/caoutsearch/graphs/contributors)
104
+ Contributors: [./graphs/contributors](https://github.com/solutions-territoire/caoutsearch/graphs/contributors)
105
105
 
@@ -25,7 +25,11 @@ module Caoutsearch
25
25
  protected
26
26
 
27
27
  def default_mappings
28
- path = ::Rails.root.join("config/elasticsearch/#{index_name}.json")
28
+ if defined?(Rails)
29
+ path = ::Rails.root.join("config/elasticsearch/#{index_name}.json")
30
+ else
31
+ raise NotImplementedError, "Mappings files cannot be found out of a Rails application"
32
+ end
29
33
  raise ArgumentError, "No mappings file found for #{index_name} at #{path}" unless path.exist?
30
34
 
31
35
  MultiJson.load(path.read)
@@ -12,7 +12,7 @@ module Caoutsearch
12
12
  request = payload[:request]
13
13
 
14
14
  debug do
15
- title = color("#{payload[:klass]} #{subject}", GREEN, true)
15
+ title = color("#{payload[:klass]} #{subject}", GREEN, bold: true)
16
16
  request_body = format_request_body(request, format: format)
17
17
 
18
18
  message = " #{title} #{request_body}"
@@ -27,11 +27,11 @@ module Caoutsearch
27
27
  return unless response
28
28
 
29
29
  debug do
30
- title = color("#{payload[:klass]} #{subject}", GREEN, true)
30
+ title = color("#{payload[:klass]} #{subject}", GREEN, bold: true)
31
31
 
32
32
  duration = "#{event.duration.round(1)}ms"
33
33
  duration += " / took #{response["took"]}ms" if response.key?("took")
34
- duration = color("(#{duration})", GREEN, true)
34
+ duration = color("(#{duration})", GREEN, bold: true)
35
35
 
36
36
  message = " #{title} #{duration}"
37
37
  message += " got errors" if response["errors"]
@@ -44,7 +44,7 @@ module Caoutsearch
44
44
 
45
45
  errors = response["items"].select { |k, _| k.values.first["error"] }
46
46
  errors.each do |error|
47
- warn { color(error, RED, true) }
47
+ warn { color(error, RED, bold: true) }
48
48
  end
49
49
  end
50
50
 
@@ -54,16 +54,24 @@ module Caoutsearch
54
54
  body.ai(limit: true, index: false)
55
55
  when "full"
56
56
  json = MultiJson.dump(body)
57
- color(json, BLUE, true)
57
+ color(json, BLUE, bold: true)
58
58
  when "truncated"
59
59
  json = MultiJson.dump(body).truncate(200, omission: "…}")
60
- color(json, BLUE, true)
60
+ color(json, BLUE, bold: true)
61
61
  end
62
62
  end
63
63
 
64
64
  def inspect_json_size(json)
65
65
  ApplicationController.helpers.number_to_human_size(MultiJson.dump(json).bytesize)
66
66
  end
67
+
68
+ def color(message, color, bold: false)
69
+ if Gem::Version.new(ActiveSupport.version) >= Gem::Version.new("7.1.0")
70
+ super
71
+ else
72
+ super(message, color, bold)
73
+ end
74
+ end
67
75
  end
68
76
  end
69
77
  end
@@ -19,8 +19,8 @@ module Caoutsearch
19
19
  end
20
20
 
21
21
  module ClassMethods
22
- def reindex(*properties, **options, &block)
23
- index_engine_class.reindex(all, *properties, **options, &block)
22
+ def reindex(...)
23
+ index_engine_class.reindex(all, ...)
24
24
  end
25
25
 
26
26
  def delete_indexes
@@ -11,16 +11,16 @@ module Caoutsearch
11
11
  end
12
12
 
13
13
  class_methods do
14
- def before_build(*filters, &blk)
15
- set_callback(:build, :before, *filters, &blk)
14
+ def before_build(...)
15
+ set_callback(:build, :before, ...)
16
16
  end
17
17
 
18
- def after_build(*filters, &blk)
19
- set_callback(:build, :after, *filters, &blk)
18
+ def after_build(...)
19
+ set_callback(:build, :after, ...)
20
20
  end
21
21
 
22
- def around_build(*filters, &blk)
23
- set_callback(:build, :around, *filters, &blk)
22
+ def around_build(...)
23
+ set_callback(:build, :around, ...)
24
24
  end
25
25
  end
26
26
  end
@@ -32,7 +32,7 @@ module Caoutsearch
32
32
 
33
33
  def properties_to_inspect
34
34
  PROPERTIES_TO_INSPECT.each_with_object({}) do |name, properties|
35
- value = instance_variable_get("@#{name}")
35
+ value = instance_variable_get(:"@#{name}")
36
36
  properties[name] = value.inspect if value.present?
37
37
  end
38
38
  end
@@ -25,7 +25,7 @@ module Caoutsearch
25
25
 
26
26
  def properties_to_inspect
27
27
  PROPERTIES_TO_INSPECT.each_with_object({}) do |name, properties|
28
- value = instance_variable_get("@#{name}")
28
+ value = instance_variable_get(:"@#{name}")
29
29
  properties[name] = value.inspect if value
30
30
  end
31
31
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Caoutsearch
4
- VERSION = "0.0.7"
4
+ VERSION = "0.0.8"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caoutsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Savater Sebastien
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-08-11 00:00:00.000000000 Z
12
+ date: 2025-11-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '5.0'
20
+ version: '6.1'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: '5.0'
27
+ version: '6.1'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: elasticsearch
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -371,7 +371,7 @@ files:
371
371
  - lib/caoutsearch/testing.rb
372
372
  - lib/caoutsearch/testing/mock_requests.rb
373
373
  - lib/caoutsearch/version.rb
374
- homepage: http://github.com/mon-territoire/caoutsearch
374
+ homepage: http://github.com/solutions-territoire/caoutsearch
375
375
  licenses:
376
376
  - MIT
377
377
  metadata: {}
@@ -390,7 +390,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
390
390
  - !ruby/object:Gem::Version
391
391
  version: '0'
392
392
  requirements: []
393
- rubygems_version: 3.4.8
393
+ rubygems_version: 3.5.11
394
394
  signing_key:
395
395
  specification_version: 4
396
396
  summary: An alternative approach to index & search with Elasticsearch & Ruby on Rails