fuzzily_reloaded 1.0.1 → 2.0.0
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 +4 -4
- data/.github/workflows/spec.yml +120 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +41 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +128 -31
- data/README.md +6 -18
- data/fuzzily.gemspec +2 -7
- data/gemfiles/rails61.gemfile +13 -0
- data/gemfiles/rails70.gemfile +13 -0
- data/gemfiles/rails71.gemfile +13 -0
- data/gemfiles/rails72.gemfile +13 -0
- data/gemfiles/rails80.gemfile +13 -0
- data/gemfiles/rails81.gemfile +13 -0
- data/lib/fuzzily/trigram.rb +5 -6
- data/lib/fuzzily/version.rb +1 -1
- data/lib/fuzzily.rb +2 -0
- data/spec/fuzzily/trigram_spec.rb +8 -0
- data/spec/spec_helper.rb +19 -12
- metadata +17 -71
- data/.travis.yml +0 -39
- data/gemfiles/rails51.gemfile +0 -5
- data/gemfiles/rails60.gemfile +0 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 417ec4f6ce9352ad08c91cefde67045f5f0232690b8f0d45a915a9d6e5dfe59e
|
|
4
|
+
data.tar.gz: 5f7e4bd500bbbc87d74401a689d1484f3ec624c6def9cb869b4c410cecff48ee
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5df3d9e52199939a142ba1bc4beb4d2dba9c13c9901eef0d65e6aec804cec13fdd89727eb3d999a057a17a204a316551a294b51cd7a4522cb2511944050acfa8
|
|
7
|
+
data.tar.gz: 3513f8e719f5da56425f260eb80c73f74c359746ff3ded563f5700551dca28ee5faba9ca2bb825c2442083fd8bdd9406ab5434e88bee24d8d909b72f8c490a9e
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
name: tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["master"]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: ["master"]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
container: 'catthehacker/ubuntu:act-latest'
|
|
16
|
+
continue-on-error: ${{ matrix.ruby == 'ruby-head' }}
|
|
17
|
+
|
|
18
|
+
name: "Ruby ${{ matrix.ruby }} with ${{ matrix.gemfile }} on ${{ matrix.db }}"
|
|
19
|
+
|
|
20
|
+
env:
|
|
21
|
+
FUZZILY_ADAPTER: ${{ matrix.db }}
|
|
22
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
|
23
|
+
|
|
24
|
+
strategy:
|
|
25
|
+
matrix:
|
|
26
|
+
ruby:
|
|
27
|
+
- ruby-head
|
|
28
|
+
- "3.3"
|
|
29
|
+
- "3.2"
|
|
30
|
+
- "3.1"
|
|
31
|
+
- "3.0"
|
|
32
|
+
gemfile:
|
|
33
|
+
- gemfiles/rails61.gemfile
|
|
34
|
+
- gemfiles/rails70.gemfile
|
|
35
|
+
- gemfiles/rails71.gemfile
|
|
36
|
+
- gemfiles/rails72.gemfile
|
|
37
|
+
- gemfiles/rails80.gemfile
|
|
38
|
+
- gemfiles/rails81.gemfile
|
|
39
|
+
db:
|
|
40
|
+
- postgresql
|
|
41
|
+
- mysql
|
|
42
|
+
- sqlite3
|
|
43
|
+
|
|
44
|
+
exclude:
|
|
45
|
+
# --- Ruby 3.0 ---
|
|
46
|
+
- ruby: "3.0"
|
|
47
|
+
gemfile: gemfiles/rails72.gemfile
|
|
48
|
+
- ruby: "3.0"
|
|
49
|
+
gemfile: gemfiles/rails80.gemfile
|
|
50
|
+
- ruby: "3.0"
|
|
51
|
+
gemfile: gemfiles/rails81.gemfile
|
|
52
|
+
|
|
53
|
+
# --- Ruby 3.1 ---
|
|
54
|
+
- ruby: "3.1"
|
|
55
|
+
gemfile: gemfiles/rails80.gemfile
|
|
56
|
+
- ruby: "3.1"
|
|
57
|
+
gemfile: gemfiles/rails81.gemfile
|
|
58
|
+
|
|
59
|
+
# --- Ruby-Head ---
|
|
60
|
+
- ruby: "ruby-head"
|
|
61
|
+
gemfile: gemfiles/rails61.gemfile
|
|
62
|
+
|
|
63
|
+
services:
|
|
64
|
+
postgres:
|
|
65
|
+
image: postgres:10
|
|
66
|
+
env:
|
|
67
|
+
POSTGRES_USER: postgres
|
|
68
|
+
POSTGRES_PASSWORD: postgres
|
|
69
|
+
POSTGRES_DB: fuzzily_test
|
|
70
|
+
options: >-
|
|
71
|
+
--health-cmd pg_isready
|
|
72
|
+
--health-interval 10s
|
|
73
|
+
--health-timeout 5s
|
|
74
|
+
--health-retries 5
|
|
75
|
+
|
|
76
|
+
mysql:
|
|
77
|
+
image: mysql:8
|
|
78
|
+
env:
|
|
79
|
+
MYSQL_DATABASE: fuzzily_test
|
|
80
|
+
MYSQL_USER: test
|
|
81
|
+
MYSQL_PASSWORD: test
|
|
82
|
+
MYSQL_ROOT_PASSWORD: root
|
|
83
|
+
MYSQL_CHARSET: utf8mb4
|
|
84
|
+
MYSQL_COLLATION: utf8mb4_unicode_ci
|
|
85
|
+
options: >-
|
|
86
|
+
--health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -proot"
|
|
87
|
+
--health-interval 10s
|
|
88
|
+
--health-timeout 5s
|
|
89
|
+
--health-retries 5
|
|
90
|
+
|
|
91
|
+
steps:
|
|
92
|
+
- uses: actions/checkout@v6
|
|
93
|
+
|
|
94
|
+
- name: Fix Ruby-Head Home Path
|
|
95
|
+
if: matrix.ruby == 'ruby-head'
|
|
96
|
+
run: |
|
|
97
|
+
# Create the home directory the pre-compiled binary expects
|
|
98
|
+
sudo mkdir -p /home/runner
|
|
99
|
+
# Link the expected .rubies path to the actual one
|
|
100
|
+
sudo ln -sf "$HOME/.rubies" /home/runner/.rubies
|
|
101
|
+
|
|
102
|
+
- name: Set up Ruby
|
|
103
|
+
uses: ruby/setup-ruby@v1
|
|
104
|
+
with:
|
|
105
|
+
ruby-version: ${{ matrix.ruby }}
|
|
106
|
+
bundler-cache: true
|
|
107
|
+
# Only update for stable rubies; head already has the newest
|
|
108
|
+
rubygems: ${{ matrix.ruby == 'ruby-head' && '' || 'latest' }}
|
|
109
|
+
|
|
110
|
+
- name: Fix Ruby-Head Shared Library Path
|
|
111
|
+
if: matrix.ruby == 'ruby-head'
|
|
112
|
+
run: |
|
|
113
|
+
# Find where the head binary is and add its lib folder to LD_LIBRARY_PATH
|
|
114
|
+
RUBY_LIB_PATH=$(dirname $(which ruby))/../lib
|
|
115
|
+
echo "LD_LIBRARY_PATH=$RUBY_LIB_PATH:$LD_LIBRARY_PATH" >> $GITHUB_ENV
|
|
116
|
+
|
|
117
|
+
- name: Run tests
|
|
118
|
+
env:
|
|
119
|
+
DATABASE_URL: ${{ matrix.db == 'mysql' && 'mysql2://test:test@mysql:3306/fuzzily_test' || matrix.db == 'postgresql' && 'postgresql://postgres:postgres@postgres:5432/fuzzily_test' || 'sqlite://notempty' }}
|
|
120
|
+
run: bundle exec rake
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Fuzzily (reloaded) - Changelog
|
|
2
|
+
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
### Breaking changes
|
|
6
|
+
|
|
7
|
+
* Dropped support for Ruby <3 and by extension Rails <6.1. This version should however still work on Ruby >=2.4
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Changes
|
|
11
|
+
|
|
12
|
+
* Transliterate via I18n, for example
|
|
13
|
+
* `Straße` transliterates `ß` into `ss` instead of dropping it
|
|
14
|
+
* `Smørrebrød` transliterates `ø` into `o` instead of dropping it
|
|
15
|
+
* added I18n dependency
|
|
16
|
+
* Added (implicit) Logger and ostruct dependency for newer Ruby
|
|
17
|
+
* Remove usage of deprecated `ActiveSupport::Multibyte::Chars`
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## 1.0.1
|
|
22
|
+
|
|
23
|
+
* Added support for Rails 7
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## 1.0.0 (fork)
|
|
28
|
+
|
|
29
|
+
* Added support for Rails 5.1 and 6.0
|
|
30
|
+
* Removed support for Rails <5.1
|
|
31
|
+
|
|
32
|
+
### Breaking changes
|
|
33
|
+
|
|
34
|
+
- Dirty attributes behaviour has changed in after_save context.
|
|
35
|
+
Use `saved_change_to_ATTR?` instead of `ATTR_changed?`!
|
|
36
|
+
- Semi-breaking: The string is now being checked for `blank?` instead of `nil?` to prevent `***` ngrams
|
|
37
|
+
|
|
38
|
+
### Fixes
|
|
39
|
+
|
|
40
|
+
- Numbers are now supported but using a Converter is recommended
|
|
41
|
+
- Fixed deprecation warning regarding uniqueness validator
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,49 +1,100 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
fuzzily_reloaded (
|
|
4
|
+
fuzzily_reloaded (2.0.0)
|
|
5
5
|
activerecord (>= 5.1)
|
|
6
|
+
logger (>= 1.4)
|
|
7
|
+
ostruct
|
|
6
8
|
|
|
7
9
|
GEM
|
|
8
10
|
remote: https://rubygems.org/
|
|
9
11
|
specs:
|
|
10
|
-
activemodel (
|
|
11
|
-
activesupport (=
|
|
12
|
-
activerecord (
|
|
13
|
-
activemodel (=
|
|
14
|
-
activesupport (=
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
activemodel (8.1.3)
|
|
13
|
+
activesupport (= 8.1.3)
|
|
14
|
+
activerecord (8.1.3)
|
|
15
|
+
activemodel (= 8.1.3)
|
|
16
|
+
activesupport (= 8.1.3)
|
|
17
|
+
timeout (>= 0.4.0)
|
|
18
|
+
activesupport (8.1.3)
|
|
19
|
+
base64
|
|
20
|
+
bigdecimal
|
|
21
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
22
|
+
connection_pool (>= 2.2.5)
|
|
23
|
+
drb
|
|
17
24
|
i18n (>= 1.6, < 2)
|
|
25
|
+
json
|
|
26
|
+
logger (>= 1.4.2)
|
|
18
27
|
minitest (>= 5.1)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
securerandom (>= 0.3)
|
|
29
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
30
|
+
uri (>= 0.13.1)
|
|
31
|
+
base64 (0.3.0)
|
|
32
|
+
bigdecimal (4.1.1)
|
|
33
|
+
concurrent-ruby (1.3.6)
|
|
34
|
+
connection_pool (3.0.2)
|
|
35
|
+
diff-lcs (1.6.2)
|
|
36
|
+
drb (2.2.3)
|
|
37
|
+
i18n (1.14.8)
|
|
23
38
|
concurrent-ruby (~> 1.0)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
39
|
+
json (2.19.3)
|
|
40
|
+
logger (1.7.0)
|
|
41
|
+
minitest (6.0.3)
|
|
42
|
+
drb (~> 2.0)
|
|
43
|
+
prism (~> 1.5)
|
|
44
|
+
mysql2 (0.5.7)
|
|
45
|
+
bigdecimal
|
|
46
|
+
ostruct (0.6.3)
|
|
47
|
+
pg (1.6.3)
|
|
48
|
+
pg (1.6.3-aarch64-linux)
|
|
49
|
+
pg (1.6.3-aarch64-linux-musl)
|
|
50
|
+
pg (1.6.3-arm64-darwin)
|
|
51
|
+
pg (1.6.3-x86_64-darwin)
|
|
52
|
+
pg (1.6.3-x86_64-linux)
|
|
53
|
+
pg (1.6.3-x86_64-linux-musl)
|
|
54
|
+
prism (1.9.0)
|
|
55
|
+
rake (13.3.1)
|
|
56
|
+
rspec (3.13.2)
|
|
57
|
+
rspec-core (~> 3.13.0)
|
|
58
|
+
rspec-expectations (~> 3.13.0)
|
|
59
|
+
rspec-mocks (~> 3.13.0)
|
|
60
|
+
rspec-core (3.13.6)
|
|
61
|
+
rspec-support (~> 3.13.0)
|
|
62
|
+
rspec-expectations (3.13.5)
|
|
35
63
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
36
|
-
rspec-support (~> 3.
|
|
37
|
-
rspec-mocks (3.
|
|
64
|
+
rspec-support (~> 3.13.0)
|
|
65
|
+
rspec-mocks (3.13.8)
|
|
38
66
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
39
|
-
rspec-support (~> 3.
|
|
40
|
-
rspec-support (3.
|
|
41
|
-
|
|
42
|
-
|
|
67
|
+
rspec-support (~> 3.13.0)
|
|
68
|
+
rspec-support (3.13.7)
|
|
69
|
+
securerandom (0.4.1)
|
|
70
|
+
sqlite3 (2.9.2-aarch64-linux-gnu)
|
|
71
|
+
sqlite3 (2.9.2-aarch64-linux-musl)
|
|
72
|
+
sqlite3 (2.9.2-arm-linux-gnu)
|
|
73
|
+
sqlite3 (2.9.2-arm-linux-musl)
|
|
74
|
+
sqlite3 (2.9.2-arm64-darwin)
|
|
75
|
+
sqlite3 (2.9.2-x86-linux-gnu)
|
|
76
|
+
sqlite3 (2.9.2-x86-linux-musl)
|
|
77
|
+
sqlite3 (2.9.2-x86_64-darwin)
|
|
78
|
+
sqlite3 (2.9.2-x86_64-linux-gnu)
|
|
79
|
+
sqlite3 (2.9.2-x86_64-linux-musl)
|
|
80
|
+
timeout (0.6.1)
|
|
81
|
+
tzinfo (2.0.6)
|
|
43
82
|
concurrent-ruby (~> 1.0)
|
|
83
|
+
uri (1.1.1)
|
|
44
84
|
|
|
45
85
|
PLATFORMS
|
|
46
|
-
|
|
86
|
+
aarch64-linux
|
|
87
|
+
aarch64-linux-gnu
|
|
88
|
+
aarch64-linux-musl
|
|
89
|
+
arm-linux-gnu
|
|
90
|
+
arm-linux-musl
|
|
91
|
+
arm64-darwin
|
|
92
|
+
x86-linux-gnu
|
|
93
|
+
x86-linux-musl
|
|
94
|
+
x86_64-darwin
|
|
95
|
+
x86_64-linux
|
|
96
|
+
x86_64-linux-gnu
|
|
97
|
+
x86_64-linux-musl
|
|
47
98
|
|
|
48
99
|
DEPENDENCIES
|
|
49
100
|
bundler
|
|
@@ -54,5 +105,51 @@ DEPENDENCIES
|
|
|
54
105
|
rspec
|
|
55
106
|
sqlite3
|
|
56
107
|
|
|
108
|
+
CHECKSUMS
|
|
109
|
+
activemodel (8.1.3) sha256=90c05cbe4cef3649b8f79f13016191ea94c4525ce4a5c0fb7ef909c4b91c8219
|
|
110
|
+
activerecord (8.1.3) sha256=8003be7b2466ba0a2a670e603eeb0a61dd66058fccecfc49901e775260ac70ab
|
|
111
|
+
activesupport (8.1.3) sha256=21a5e0dfbd4c3ddd9e1317ec6a4d782fa226e7867dc70b0743acda81a1dca20e
|
|
112
|
+
base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
|
|
113
|
+
bigdecimal (4.1.1) sha256=1c09efab961da45203c8316b0cdaec0ff391dfadb952dd459584b63ebf8054ca
|
|
114
|
+
concurrent-ruby (1.3.6) sha256=6b56837e1e7e5292f9864f34b69c5a2cbc75c0cf5338f1ce9903d10fa762d5ab
|
|
115
|
+
connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a
|
|
116
|
+
diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
|
|
117
|
+
drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
|
|
118
|
+
fuzzily_reloaded (2.0.0)
|
|
119
|
+
i18n (1.14.8) sha256=285778639134865c5e0f6269e0b818256017e8cde89993fdfcbfb64d088824a5
|
|
120
|
+
json (2.19.3) sha256=289b0bb53052a1fa8c34ab33cc750b659ba14a5c45f3fcf4b18762dc67c78646
|
|
121
|
+
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
|
|
122
|
+
minitest (6.0.3) sha256=88ac8a1de36c00692420e7cb3cc11a0773bbcb126aee1c249f320160a7d11411
|
|
123
|
+
mysql2 (0.5.7) sha256=ba09ede515a0ae8a7192040a1b778c0fb0f025fa5877e9be895cd325fa5e9d7b
|
|
124
|
+
ostruct (0.6.3) sha256=95a2ed4a4bd1d190784e666b47b2d3f078e4a9efda2fccf18f84ddc6538ed912
|
|
125
|
+
pg (1.6.3) sha256=1388d0563e13d2758c1089e35e973a3249e955c659592d10e5b77c468f628a99
|
|
126
|
+
pg (1.6.3-aarch64-linux) sha256=0698ad563e02383c27510b76bf7d4cd2de19cd1d16a5013f375dd473e4be72ea
|
|
127
|
+
pg (1.6.3-aarch64-linux-musl) sha256=06a75f4ea04b05140146f2a10550b8e0d9f006a79cdaf8b5b130cde40e3ecc2c
|
|
128
|
+
pg (1.6.3-arm64-darwin) sha256=7240330b572e6355d7c75a7de535edb5dfcbd6295d9c7777df4d9dddfb8c0e5f
|
|
129
|
+
pg (1.6.3-x86_64-darwin) sha256=ee2e04a17c0627225054ffeb43e31a95be9d7e93abda2737ea3ce4a62f2729d6
|
|
130
|
+
pg (1.6.3-x86_64-linux) sha256=5d9e188c8f7a0295d162b7b88a768d8452a899977d44f3274d1946d67920ae8d
|
|
131
|
+
pg (1.6.3-x86_64-linux-musl) sha256=9c9c90d98c72f78eb04c0f55e9618fe55d1512128e411035fe229ff427864009
|
|
132
|
+
prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
|
|
133
|
+
rake (13.3.1) sha256=8c9e89d09f66a26a01264e7e3480ec0607f0c497a861ef16063604b1b08eb19c
|
|
134
|
+
rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
|
|
135
|
+
rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d
|
|
136
|
+
rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
|
|
137
|
+
rspec-mocks (3.13.8) sha256=086ad3d3d17533f4237643de0b5c42f04b66348c28bf6b9c2d3f4a3b01af1d47
|
|
138
|
+
rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c
|
|
139
|
+
securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
|
|
140
|
+
sqlite3 (2.9.2-aarch64-linux-gnu) sha256=eeb86db55645b85327ba75129e3614658d974bf4da8fdc87018a0d42c59f6e42
|
|
141
|
+
sqlite3 (2.9.2-aarch64-linux-musl) sha256=4feff91fb8c2b13688da34b5627c9d1ed9cedb3ee87a7114ec82209147f07a6d
|
|
142
|
+
sqlite3 (2.9.2-arm-linux-gnu) sha256=1ee2eb06b5301aaf5ce343a6e88d99ac932d95202d7b350f0e7b6d8d588580d7
|
|
143
|
+
sqlite3 (2.9.2-arm-linux-musl) sha256=8ca0de6aceede968de0394e22e95d549834c4d8e318f69a92a52f049878a0057
|
|
144
|
+
sqlite3 (2.9.2-arm64-darwin) sha256=d15bd9609a05f9d54930babe039585efc8cadd57517c15b64ec7dfa75158a5e9
|
|
145
|
+
sqlite3 (2.9.2-x86-linux-gnu) sha256=066bc904522f8a7072236a81237c03a4a1dfe070a25107e392de03d1e4ad0e6d
|
|
146
|
+
sqlite3 (2.9.2-x86-linux-musl) sha256=6503c76278f5e8629b12b6518ff43a9a4f6d9381de73f0b086c9fa1226db5ede
|
|
147
|
+
sqlite3 (2.9.2-x86_64-darwin) sha256=ed691b5021674d72582d03c5a38e89634b961902735fb6225273892805421d13
|
|
148
|
+
sqlite3 (2.9.2-x86_64-linux-gnu) sha256=dce83ffcb7e72f9f7aeb6e5404f15d277a45332fe18ccce8a8b3ed51e8d23aee
|
|
149
|
+
sqlite3 (2.9.2-x86_64-linux-musl) sha256=e8dd906a613f13b60f6d47ae9dda376384d9de1ab3f7e3f2fdf2fd18a871a2d7
|
|
150
|
+
timeout (0.6.1) sha256=78f57368a7e7bbadec56971f78a3f5ecbcfb59b7fcbb0a3ed6ddc08a5094accb
|
|
151
|
+
tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b
|
|
152
|
+
uri (1.1.1) sha256=379fa58d27ffb1387eaada68c749d1426738bd0f654d812fcc07e7568f5c57c6
|
|
153
|
+
|
|
57
154
|
BUNDLED WITH
|
|
58
|
-
|
|
155
|
+
4.0.7
|
data/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# Fuzzily - fuzzy string matching for ActiveRecord
|
|
1
|
+
# Fuzzily (reloaded) - fuzzy string matching for ActiveRecord
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/rb/fuzzily_reloaded)
|
|
4
|
-
[](https://github.com/2called-chaos/fuzzily/actions/workflows/spec.yml)
|
|
5
5
|
|
|
6
6
|
> Show me photos of **Marakech** !
|
|
7
7
|
>
|
|
@@ -12,7 +12,7 @@ Fuzzily finds misspelled, prefix, or partial needles in a haystack of
|
|
|
12
12
|
strings. It's a fast, [trigram](http://en.wikipedia.org/wiki/N-gram)-based, database-backed [fuzzy](http://en.wikipedia.org/wiki/Approximate_string_matching) string search/match engine for Rails.
|
|
13
13
|
Loosely inspired from an [old blog post](http://unirec.blogspot.co.uk/2007/12/live-fuzzy-search-using-n-grams-in.html).
|
|
14
14
|
|
|
15
|
-
Tested with ActiveRecord (
|
|
15
|
+
Tested with ActiveRecord (6.1, 7.x and 8.x) on various Rubies (3.[0-3]) and the most common adapters (SQLite3, MySQL, and PostgreSQL).
|
|
16
16
|
|
|
17
17
|
If your dateset is big, if you need yet more speed, or do not use ActiveRecord,
|
|
18
18
|
check out [blurrily](http://github.com/mezis/blurrily), another gem (backed with a C extension)
|
|
@@ -20,19 +20,7 @@ with the same intent.
|
|
|
20
20
|
|
|
21
21
|
## Fork differences
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
- Removed support for Rails <5.1
|
|
25
|
-
|
|
26
|
-
### Breaking changes
|
|
27
|
-
|
|
28
|
-
- Dirty attributes behaviour has changed in after_save context.
|
|
29
|
-
Use `saved_change_to_ATTR?` instead of `ATTR_changed?`!
|
|
30
|
-
- Semi-breaking: The string is now being checked for `blank?` instead of `nil?` to prevent `***` ngrams
|
|
31
|
-
|
|
32
|
-
### Fixes
|
|
33
|
-
|
|
34
|
-
- Numbers are now supported but using a Converter is recommended
|
|
35
|
-
- Fixed deprecation warning regarding uniqueness validator
|
|
23
|
+
Please refer to CHANGELOG.md for changes since the fork.
|
|
36
24
|
|
|
37
25
|
|
|
38
26
|
## Installation
|
|
@@ -204,7 +192,7 @@ end
|
|
|
204
192
|
|
|
205
193
|
MIT licence. Quite permissive if you ask me.
|
|
206
194
|
|
|
207
|
-
Copyright (c) 2013, HouseTrip Ltd.
|
|
195
|
+
Copyright (c) 2013, HouseTrip Ltd.
|
|
208
196
|
Copyright (c) 2020, Sven Pachnit aka. 2called-chaos (forked)
|
|
209
197
|
|
|
210
198
|
## Contributing
|
|
@@ -216,6 +204,6 @@ Copyright (c) 2020, Sven Pachnit aka. 2called-chaos (forked)
|
|
|
216
204
|
5. Create a new Pull Request
|
|
217
205
|
|
|
218
206
|
|
|
219
|
-
Thanks to @mezis for creating this literal gem.
|
|
207
|
+
Thanks to @mezis for creating this literal gem.
|
|
220
208
|
Thanks to @bclennox, @fdegiuli, @nickbender, @Shanison, @rickbutton for pointing out
|
|
221
209
|
and/or helping on various issues.
|
data/fuzzily.gemspec
CHANGED
|
@@ -13,13 +13,8 @@ Gem::Specification.new do |spec|
|
|
|
13
13
|
spec.license = "MIT"
|
|
14
14
|
|
|
15
15
|
spec.add_runtime_dependency "activerecord", ">= 5.1"
|
|
16
|
-
|
|
17
|
-
spec.
|
|
18
|
-
spec.add_development_dependency "rake"
|
|
19
|
-
spec.add_development_dependency "rspec"
|
|
20
|
-
spec.add_development_dependency "sqlite3"
|
|
21
|
-
spec.add_development_dependency "pg"
|
|
22
|
-
spec.add_development_dependency "mysql2"
|
|
16
|
+
spec.add_runtime_dependency "logger", ">= 1.4"
|
|
17
|
+
spec.add_runtime_dependency "ostruct"
|
|
23
18
|
|
|
24
19
|
spec.files = `git ls-files`.split($/)
|
|
25
20
|
spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
data/lib/fuzzily/trigram.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
require "active_support/core_ext/string/multibyte"
|
|
2
1
|
require "delegate"
|
|
2
|
+
|
|
3
3
|
module Fuzzily
|
|
4
4
|
class String < SimpleDelegator
|
|
5
5
|
|
|
@@ -16,13 +16,12 @@ module Fuzzily
|
|
|
16
16
|
|
|
17
17
|
protected
|
|
18
18
|
|
|
19
|
-
# Remove accents, downcase, replace spaces and word start with "*",
|
|
20
|
-
# return list of normalized words
|
|
19
|
+
# Remove accents, downcase, replace spaces and word start with "*", return list of normalized words
|
|
21
20
|
def normalize
|
|
22
|
-
|
|
23
|
-
.
|
|
24
|
-
.gsub(/[^\x00-\x7F]/, "")
|
|
21
|
+
I18n.transliterate(to_s)
|
|
22
|
+
.downcase
|
|
25
23
|
.gsub(/[^a-z\d]/, " ")
|
|
24
|
+
.strip
|
|
26
25
|
.gsub(/\s+/, "*")
|
|
27
26
|
.gsub(/^/, "**")
|
|
28
27
|
.gsub(/$/, "*")
|
data/lib/fuzzily/version.rb
CHANGED
data/lib/fuzzily.rb
CHANGED
|
@@ -13,6 +13,14 @@ describe Fuzzily::String do
|
|
|
13
13
|
expect(result("Montélimar")).to eq %w(**m *mo mon ont nte tel eli lim ima mar ar*)
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
+
it "normalizes special characters (ß)" do
|
|
17
|
+
expect(result("Straße")).to eq %w(**s *st str tra ras ass sse se*)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it "normalizes special characters (ø)" do
|
|
21
|
+
expect(result("Smørrebrød")).to eq %w(**s *sm smo mor orr rre reb ebr bro rod od*)
|
|
22
|
+
end
|
|
23
|
+
|
|
16
24
|
it "allows numbers" do
|
|
17
25
|
expect(result("GTA 5")).to eq %w(**g *gt gta ta* a*5 *5*)
|
|
18
26
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -2,8 +2,7 @@ require "fuzzily"
|
|
|
2
2
|
require "pathname"
|
|
3
3
|
require "yaml"
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
DATABASE = Pathname.new "test.sqlite3"
|
|
5
|
+
DATABASE = Pathname.new "./test.sqlite3"
|
|
7
6
|
|
|
8
7
|
# def get_adapter
|
|
9
8
|
# ENV.fetch("FUZZILY_ADAPTER", "sqlite3")
|
|
@@ -13,24 +12,32 @@ DATABASE = Pathname.new "test.sqlite3"
|
|
|
13
12
|
def get_connection_hash
|
|
14
13
|
case ENV.fetch("FUZZILY_ADAPTER", "sqlite3")
|
|
15
14
|
when "postgresql"
|
|
15
|
+
# Because old AR is too dumb to use URL properly
|
|
16
|
+
uri = URI.parse(ENV.fetch("DATABASE_URL", "postgresql://postgres:postgres@127.0.0.1/fuzzily_test"))
|
|
16
17
|
{
|
|
17
|
-
adapter:
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
adapter: "postgresql",
|
|
19
|
+
host: uri.host,
|
|
20
|
+
port: uri.port,
|
|
21
|
+
username: uri.user,
|
|
22
|
+
password: uri.password,
|
|
23
|
+
database: uri.path.sub(%r{^/}, ''),
|
|
20
24
|
min_messages: "warning",
|
|
21
|
-
username: ENV["FUZZILY_DB_USER"]
|
|
22
25
|
}
|
|
23
26
|
when "mysql"
|
|
27
|
+
# Because old AR is too dumb to use URL properly
|
|
28
|
+
uri = URI.parse(ENV.fetch("DATABASE_URL", "mysql2://test:test@127.0.0.1/fuzzily_test"))
|
|
24
29
|
{
|
|
25
|
-
adapter:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
username:
|
|
30
|
+
adapter: uri.scheme,
|
|
31
|
+
host: uri.host,
|
|
32
|
+
port: uri.port,
|
|
33
|
+
username: uri.user,
|
|
34
|
+
password: uri.password,
|
|
35
|
+
database: uri.path.sub(%r{^/}, ''),
|
|
29
36
|
}
|
|
30
37
|
when "sqlite3"
|
|
31
38
|
{
|
|
32
|
-
adapter:
|
|
33
|
-
database: DATABASE
|
|
39
|
+
adapter: "sqlite3",
|
|
40
|
+
database: DATABASE,
|
|
34
41
|
}
|
|
35
42
|
end
|
|
36
43
|
end
|
metadata
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fuzzily_reloaded
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Julien Letessier
|
|
8
8
|
- Sven Pachnit
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: activerecord
|
|
@@ -26,83 +25,27 @@ dependencies:
|
|
|
26
25
|
- !ruby/object:Gem::Version
|
|
27
26
|
version: '5.1'
|
|
28
27
|
- !ruby/object:Gem::Dependency
|
|
29
|
-
name:
|
|
28
|
+
name: logger
|
|
30
29
|
requirement: !ruby/object:Gem::Requirement
|
|
31
30
|
requirements:
|
|
32
31
|
- - ">="
|
|
33
32
|
- !ruby/object:Gem::Version
|
|
34
|
-
version: '
|
|
35
|
-
type: :
|
|
36
|
-
prerelease: false
|
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
38
|
-
requirements:
|
|
39
|
-
- - ">="
|
|
40
|
-
- !ruby/object:Gem::Version
|
|
41
|
-
version: '0'
|
|
42
|
-
- !ruby/object:Gem::Dependency
|
|
43
|
-
name: rake
|
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
|
45
|
-
requirements:
|
|
46
|
-
- - ">="
|
|
47
|
-
- !ruby/object:Gem::Version
|
|
48
|
-
version: '0'
|
|
49
|
-
type: :development
|
|
50
|
-
prerelease: false
|
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
52
|
-
requirements:
|
|
53
|
-
- - ">="
|
|
54
|
-
- !ruby/object:Gem::Version
|
|
55
|
-
version: '0'
|
|
56
|
-
- !ruby/object:Gem::Dependency
|
|
57
|
-
name: rspec
|
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
|
59
|
-
requirements:
|
|
60
|
-
- - ">="
|
|
61
|
-
- !ruby/object:Gem::Version
|
|
62
|
-
version: '0'
|
|
63
|
-
type: :development
|
|
64
|
-
prerelease: false
|
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
66
|
-
requirements:
|
|
67
|
-
- - ">="
|
|
68
|
-
- !ruby/object:Gem::Version
|
|
69
|
-
version: '0'
|
|
70
|
-
- !ruby/object:Gem::Dependency
|
|
71
|
-
name: sqlite3
|
|
72
|
-
requirement: !ruby/object:Gem::Requirement
|
|
73
|
-
requirements:
|
|
74
|
-
- - ">="
|
|
75
|
-
- !ruby/object:Gem::Version
|
|
76
|
-
version: '0'
|
|
77
|
-
type: :development
|
|
78
|
-
prerelease: false
|
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
80
|
-
requirements:
|
|
81
|
-
- - ">="
|
|
82
|
-
- !ruby/object:Gem::Version
|
|
83
|
-
version: '0'
|
|
84
|
-
- !ruby/object:Gem::Dependency
|
|
85
|
-
name: pg
|
|
86
|
-
requirement: !ruby/object:Gem::Requirement
|
|
87
|
-
requirements:
|
|
88
|
-
- - ">="
|
|
89
|
-
- !ruby/object:Gem::Version
|
|
90
|
-
version: '0'
|
|
91
|
-
type: :development
|
|
33
|
+
version: '1.4'
|
|
34
|
+
type: :runtime
|
|
92
35
|
prerelease: false
|
|
93
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
94
37
|
requirements:
|
|
95
38
|
- - ">="
|
|
96
39
|
- !ruby/object:Gem::Version
|
|
97
|
-
version: '
|
|
40
|
+
version: '1.4'
|
|
98
41
|
- !ruby/object:Gem::Dependency
|
|
99
|
-
name:
|
|
42
|
+
name: ostruct
|
|
100
43
|
requirement: !ruby/object:Gem::Requirement
|
|
101
44
|
requirements:
|
|
102
45
|
- - ">="
|
|
103
46
|
- !ruby/object:Gem::Version
|
|
104
47
|
version: '0'
|
|
105
|
-
type: :
|
|
48
|
+
type: :runtime
|
|
106
49
|
prerelease: false
|
|
107
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
108
51
|
requirements:
|
|
@@ -117,17 +60,22 @@ executables: []
|
|
|
117
60
|
extensions: []
|
|
118
61
|
extra_rdoc_files: []
|
|
119
62
|
files:
|
|
63
|
+
- ".github/workflows/spec.yml"
|
|
120
64
|
- ".gitignore"
|
|
121
65
|
- ".rspec"
|
|
122
|
-
-
|
|
66
|
+
- CHANGELOG.md
|
|
123
67
|
- Gemfile
|
|
124
68
|
- Gemfile.lock
|
|
125
69
|
- LICENSE.txt
|
|
126
70
|
- README.md
|
|
127
71
|
- Rakefile
|
|
128
72
|
- fuzzily.gemspec
|
|
129
|
-
- gemfiles/
|
|
130
|
-
- gemfiles/
|
|
73
|
+
- gemfiles/rails61.gemfile
|
|
74
|
+
- gemfiles/rails70.gemfile
|
|
75
|
+
- gemfiles/rails71.gemfile
|
|
76
|
+
- gemfiles/rails72.gemfile
|
|
77
|
+
- gemfiles/rails80.gemfile
|
|
78
|
+
- gemfiles/rails81.gemfile
|
|
131
79
|
- lib/fuzzily.rb
|
|
132
80
|
- lib/fuzzily/migration.rb
|
|
133
81
|
- lib/fuzzily/model.rb
|
|
@@ -145,7 +93,6 @@ homepage: http://github.com/2called-chaos/fuzzily
|
|
|
145
93
|
licenses:
|
|
146
94
|
- MIT
|
|
147
95
|
metadata: {}
|
|
148
|
-
post_install_message:
|
|
149
96
|
rdoc_options: []
|
|
150
97
|
require_paths:
|
|
151
98
|
- lib
|
|
@@ -160,8 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
160
107
|
- !ruby/object:Gem::Version
|
|
161
108
|
version: '0'
|
|
162
109
|
requirements: []
|
|
163
|
-
rubygems_version:
|
|
164
|
-
signing_key:
|
|
110
|
+
rubygems_version: 4.0.6
|
|
165
111
|
specification_version: 4
|
|
166
112
|
summary: A fast, trigram-based, database-backed fuzzy string search/match engine for
|
|
167
113
|
Rails.
|
data/.travis.yml
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
language: ruby
|
|
3
|
-
services:
|
|
4
|
-
- mysql
|
|
5
|
-
- postgresql
|
|
6
|
-
before_script:
|
|
7
|
-
- psql -c 'create database fuzzily_test;' -U postgres
|
|
8
|
-
- mysql -e 'create database fuzzily_test;'
|
|
9
|
-
env:
|
|
10
|
-
- FUZZILY_ADAPTER=sqlite3
|
|
11
|
-
- FUZZILY_ADAPTER=mysql FUZZILY_DB_USER=travis
|
|
12
|
-
- FUZZILY_ADAPTER=postgresql FUZZILY_DB_USER=postgres
|
|
13
|
-
script:
|
|
14
|
-
- bundle exec rspec
|
|
15
|
-
rvm:
|
|
16
|
-
- 2.3.8
|
|
17
|
-
- 2.4.9
|
|
18
|
-
- 2.5.7
|
|
19
|
-
- 2.6.5
|
|
20
|
-
- 2.7.0
|
|
21
|
-
- ruby-head
|
|
22
|
-
- jruby-9.2.6.0
|
|
23
|
-
- jruby-head
|
|
24
|
-
gemfile:
|
|
25
|
-
- gemfiles/rails51.gemfile
|
|
26
|
-
- gemfiles/rails60.gemfile
|
|
27
|
-
matrix:
|
|
28
|
-
allow_failures:
|
|
29
|
-
- rvm: ruby-head
|
|
30
|
-
- rvm: jruby-head
|
|
31
|
-
- rvm: jruby-9.2.6.0
|
|
32
|
-
exclude:
|
|
33
|
-
- rvm: 2.3.8
|
|
34
|
-
gemfile: gemfiles/rails60.gemfile
|
|
35
|
-
- rvm: 2.4.9
|
|
36
|
-
gemfile: gemfiles/rails60.gemfile
|
|
37
|
-
fast_finish: true
|
|
38
|
-
branches:
|
|
39
|
-
only: master
|
data/gemfiles/rails51.gemfile
DELETED