minidusen 0.11.2 → 1.0.1

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: 4f32ad9fa29bb04c20b375672101586a333419a6e7ba63dca31de338a6160240
4
- data.tar.gz: e6e3262a32e39a889a942eafe2babbdd097acf40b79577f442b5539b920cd1ea
3
+ metadata.gz: 49b6d529fa0d5d7d8b60601710f83bdca392e55f07e94c391262ffde4018a4f3
4
+ data.tar.gz: 9dfc4631c2c134f872a252a45bee844cbbc76589ea99fd121117700980989eb3
5
5
  SHA512:
6
- metadata.gz: 95ff0a7700fa447a36e36d45844d6f37ae7a5cab44b7782055eb28d9ae06981c21d0236d6199f727787230b14233f10942315333eb9eba945fb6ea5d1945224c
7
- data.tar.gz: 506d7606d35b9c139091433834c9f1116997f836440e953c8c9f8ce26be29b33aff71bb15fc8a78879dbfed48489d8eca19dd44699d708486c82b5105d3e2b7b
6
+ metadata.gz: e7093279ac9fad6059bdbedad5a5b82d7f6156a09f507f8e6b33ca7ab728e147e70cb1c4aed4dbf9eb8fb85db824a3aab8a92e4deca329a168a7da7a8d4edc5a
7
+ data.tar.gz: 0d3eea42001a1a95128d4ba3f3d139af9afb1e2cf21d665107fa5b53a1c3fdfc47ffbb441a35ead69da12825ce2eb30d77a514f6a0ff23d7bd04ce704b37b209
@@ -1,108 +1,109 @@
1
1
  ---
2
2
  name: Tests
3
- 'on':
3
+
4
+ on:
4
5
  push:
5
6
  branches:
6
7
  - main
7
8
  pull_request:
8
9
  branches:
9
10
  - main
11
+
10
12
  jobs:
11
13
  test_mysql:
12
- runs-on: ubuntu-20.04
14
+ runs-on: ubuntu-24.04
15
+
13
16
  services:
14
17
  mysql:
15
- image: mysql:5.6
18
+ image: mysql:5.7
16
19
  env:
17
20
  MYSQL_ROOT_PASSWORD: password
18
- options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout
19
- 5s --health-retries 5
21
+ options: >-
22
+ --health-cmd="mysqladmin ping"
23
+ --health-interval=10s
24
+ --health-timeout=5s
25
+ --health-retries=5
20
26
  ports:
21
27
  - 3306:3306
28
+
22
29
  strategy:
23
30
  fail-fast: false
24
31
  matrix:
25
32
  include:
26
- - ruby: 2.5.8
27
- gemfile: Gemfile.4.2.mysql2
28
- - ruby: 2.5.8
29
- gemfile: Gemfile.5.2.mysql2
30
- - ruby: 2.5.8
31
- gemfile: Gemfile.6.0.mysql2
32
- - ruby: 2.5.8
33
+ - ruby: 2.7.8
33
34
  gemfile: Gemfile.6.1.mysql2
34
- - ruby: 3.2.0
35
+ - ruby: 3.2.3
35
36
  gemfile: Gemfile.6.1.mysql2
36
- - ruby: 3.2.0
37
+ - ruby: 3.2.3
37
38
  gemfile: Gemfile.7.0.mysql2
38
- - ruby: 3.2.0
39
+ - ruby: 3.2.3
39
40
  gemfile: Gemfile.7.1.mysql2
40
- - ruby: 3.2.0
41
+ - ruby: 3.3.4
41
42
  gemfile: Gemfile.7.2.mysql2
43
+ - ruby: 3.3.4
44
+ gemfile: Gemfile.8.0.mysql2
45
+
42
46
  env:
43
- BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
47
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
48
+ BUNDLE_FROZEN: "false"
49
+
44
50
  steps:
45
- - uses: actions/checkout@v2
51
+ - uses: actions/checkout@v3
46
52
  - name: Install ruby
47
53
  uses: ruby/setup-ruby@v1
48
54
  with:
49
- ruby-version: "${{ matrix.ruby }}"
55
+ ruby-version: ${{ matrix.ruby }}
56
+ bundler-cache: true
50
57
  - name: Setup database
51
58
  run: |
52
- mysql -e 'create database IF NOT EXISTS test;' -u root --password=password -P 3306 -h 127.0.0.1
53
- - name: Bundle
54
- run: |
55
- gem install bundler:1.17.3
56
- bundle install --no-deployment
59
+ mysql -e 'create database IF NOT EXISTS minidusen_test;' -u root --password=password -P 3306 -h 127.0.0.1
57
60
  - name: Run tests
58
61
  run: bundle exec rspec
62
+
59
63
  test_pg:
60
- runs-on: ubuntu-20.04
64
+ runs-on: ubuntu-24.04
65
+
61
66
  services:
62
67
  postgres:
63
68
  image: postgres
64
69
  env:
65
70
  POSTGRES_PASSWORD: postgres
66
- options: "--health-cmd pg_isready --health-interval 10s --health-timeout 5s
67
- --health-retries 5"
71
+ POSTGRES_DB: minidusen_test
72
+ options: >-
73
+ --health-cmd pg_isready
74
+ --health-interval 10s
75
+ --health-timeout 5s
76
+ --health-retries 5
68
77
  ports:
69
78
  - 5432:5432
79
+
70
80
  strategy:
71
81
  fail-fast: false
72
82
  matrix:
73
83
  include:
74
- - ruby: 2.5.8
75
- gemfile: Gemfile.4.2.pg
76
- - ruby: 2.5.8
77
- gemfile: Gemfile.5.2.pg
78
- - ruby: 2.5.8
79
- gemfile: Gemfile.6.0.pg
80
- - ruby: 2.5.8
84
+ - ruby: 2.7.8
81
85
  gemfile: Gemfile.6.1.pg
82
- - ruby: 3.2.0
86
+ - ruby: 3.2.3
83
87
  gemfile: Gemfile.6.1.pg
84
- - ruby: 3.2.0
88
+ - ruby: 3.2.3
85
89
  gemfile: Gemfile.7.0.pg
86
- - ruby: 3.2.0
90
+ - ruby: 3.2.3
87
91
  gemfile: Gemfile.7.1.pg
88
- - ruby: 3.2.0
92
+ - ruby: 3.3.4
89
93
  gemfile: Gemfile.7.2.pg
94
+ - ruby: 3.3.4
95
+ gemfile: Gemfile.8.0.pg
96
+
90
97
  env:
91
- BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
98
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
99
+ BUNDLE_FROZEN: "false"
100
+
92
101
  steps:
93
- - uses: actions/checkout@v2
102
+ - uses: actions/checkout@v3
94
103
  - name: Install ruby
95
104
  uses: ruby/setup-ruby@v1
96
105
  with:
97
- ruby-version: "${{ matrix.ruby }}"
98
- - name: Setup database
99
- run: |
100
- sudo apt-get update
101
- sudo apt-get install -y postgresql-client
102
- PGPASSWORD=postgres psql -c 'create database test;' -U postgres -p 5432 -h localhost
103
- - name: Bundle
104
- run: |
105
- gem install bundler:1.17.3
106
- bundle install --no-deployment
106
+ ruby-version: ${{ matrix.ruby }}
107
+ bundler-cache: true
107
108
  - name: Run tests
108
109
  run: bundle exec rspec
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.2.0
1
+ 3.2.3
data/CHANGELOG.md CHANGED
@@ -10,6 +10,18 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
10
10
 
11
11
  ### Compatible changes
12
12
 
13
+ ## 1.0.1 2025-08-20
14
+
15
+ ### Compatible changes
16
+
17
+ - Support filter aliases (#25). Thanks to @botandrose.
18
+
19
+ ## 1.0.0 2025-07-31
20
+
21
+ ### Breaking changes
22
+
23
+ - Add a `phrase` flag to tokens
24
+
13
25
  ## 0.11.2 2024-10-31
14
26
 
15
27
  ### Compatible changes
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- minidusen (0.11.2)
4
+ minidusen (1.0.1)
5
5
  activerecord (>= 3.2)
6
6
  activesupport (>= 3.2)
7
7
  edge_rider (>= 0.2.5)
@@ -29,7 +29,7 @@ GEM
29
29
  database_cleaner-core (~> 2.0.0)
30
30
  database_cleaner-core (2.0.1)
31
31
  diff-lcs (1.4.4)
32
- edge_rider (2.1.1)
32
+ edge_rider (2.4.0)
33
33
  activerecord (>= 3.2)
34
34
  gemika (0.8.1)
35
35
  i18n (1.8.9)
data/Gemfile.6.1.pg.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- minidusen (0.11.2)
4
+ minidusen (1.0.1)
5
5
  activerecord (>= 3.2)
6
6
  activesupport (>= 3.2)
7
7
  edge_rider (>= 0.2.5)
@@ -29,7 +29,7 @@ GEM
29
29
  database_cleaner-core (~> 2.0.0)
30
30
  database_cleaner-core (2.0.1)
31
31
  diff-lcs (1.4.4)
32
- edge_rider (2.1.1)
32
+ edge_rider (2.4.0)
33
33
  activerecord (>= 3.2)
34
34
  gemika (0.8.1)
35
35
  i18n (1.8.9)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- minidusen (0.11.2)
4
+ minidusen (1.0.1)
5
5
  activerecord (>= 3.2)
6
6
  activesupport (>= 3.2)
7
7
  edge_rider (>= 0.2.5)
@@ -28,7 +28,7 @@ GEM
28
28
  database_cleaner-core (~> 2.0.0)
29
29
  database_cleaner-core (2.0.1)
30
30
  diff-lcs (1.5.0)
31
- edge_rider (2.1.1)
31
+ edge_rider (2.4.0)
32
32
  activerecord (>= 3.2)
33
33
  gemika (0.8.1)
34
34
  i18n (1.8.11)
data/Gemfile.7.0.pg.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- minidusen (0.11.2)
4
+ minidusen (1.0.1)
5
5
  activerecord (>= 3.2)
6
6
  activesupport (>= 3.2)
7
7
  edge_rider (>= 0.2.5)
@@ -28,7 +28,7 @@ GEM
28
28
  database_cleaner-core (~> 2.0.0)
29
29
  database_cleaner-core (2.0.1)
30
30
  diff-lcs (1.5.0)
31
- edge_rider (2.1.1)
31
+ edge_rider (2.4.0)
32
32
  activerecord (>= 3.2)
33
33
  gemika (0.8.1)
34
34
  i18n (1.8.11)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- minidusen (0.11.2)
4
+ minidusen (1.0.1)
5
5
  activerecord (>= 3.2)
6
6
  activesupport (>= 3.2)
7
7
  edge_rider (>= 0.2.5)
@@ -65,7 +65,6 @@ GEM
65
65
  concurrent-ruby (~> 1.0)
66
66
 
67
67
  PLATFORMS
68
- ruby
69
68
  x86_64-linux
70
69
 
71
70
  DEPENDENCIES
data/Gemfile.7.1.pg.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- minidusen (0.11.2)
4
+ minidusen (1.0.1)
5
5
  activerecord (>= 3.2)
6
6
  activesupport (>= 3.2)
7
7
  edge_rider (>= 0.2.5)
@@ -65,7 +65,6 @@ GEM
65
65
  concurrent-ruby (~> 1.0)
66
66
 
67
67
  PLATFORMS
68
- ruby
69
68
  x86_64-linux
70
69
 
71
70
  DEPENDENCIES
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- minidusen (0.11.2)
4
+ minidusen (1.0.1)
5
5
  activerecord (>= 3.2)
6
6
  activesupport (>= 3.2)
7
7
  edge_rider (>= 0.2.5)
@@ -67,7 +67,6 @@ GEM
67
67
  concurrent-ruby (~> 1.0)
68
68
 
69
69
  PLATFORMS
70
- ruby
71
70
  x86_64-linux
72
71
 
73
72
  DEPENDENCIES
data/Gemfile.7.2.pg.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- minidusen (0.11.2)
4
+ minidusen (1.0.1)
5
5
  activerecord (>= 3.2)
6
6
  activesupport (>= 3.2)
7
7
  edge_rider (>= 0.2.5)
@@ -67,7 +67,6 @@ GEM
67
67
  concurrent-ruby (~> 1.0)
68
68
 
69
69
  PLATFORMS
70
- ruby
71
70
  x86_64-linux
72
71
 
73
72
  DEPENDENCIES
@@ -1,8 +1,8 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  # Runtime dependencies
4
- gem 'activerecord', '~>6.0.0'
5
- gem 'mysql2', '~>0.4.4'
4
+ gem 'activerecord', '~>8.0.1'
5
+ gem 'mysql2', '~>0.5'
6
6
 
7
7
  # Development dependencies
8
8
  gem 'rake'
@@ -0,0 +1,87 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ minidusen (1.0.1)
5
+ activerecord (>= 3.2)
6
+ activesupport (>= 3.2)
7
+ edge_rider (>= 0.2.5)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ activemodel (8.0.1)
13
+ activesupport (= 8.0.1)
14
+ activerecord (8.0.1)
15
+ activemodel (= 8.0.1)
16
+ activesupport (= 8.0.1)
17
+ timeout (>= 0.4.0)
18
+ activesupport (8.0.1)
19
+ base64
20
+ benchmark (>= 0.3)
21
+ bigdecimal
22
+ concurrent-ruby (~> 1.0, >= 1.3.1)
23
+ connection_pool (>= 2.2.5)
24
+ drb
25
+ i18n (>= 1.6, < 2)
26
+ logger (>= 1.4.2)
27
+ minitest (>= 5.1)
28
+ securerandom (>= 0.3)
29
+ tzinfo (~> 2.0, >= 2.0.5)
30
+ uri (>= 0.13.1)
31
+ base64 (0.2.0)
32
+ benchmark (0.4.0)
33
+ bigdecimal (3.1.8)
34
+ byebug (11.1.3)
35
+ concurrent-ruby (1.3.4)
36
+ connection_pool (2.4.1)
37
+ database_cleaner (2.0.2)
38
+ database_cleaner-active_record (>= 2, < 3)
39
+ database_cleaner-active_record (2.2.0)
40
+ activerecord (>= 5.a)
41
+ database_cleaner-core (~> 2.0.0)
42
+ database_cleaner-core (2.0.1)
43
+ diff-lcs (1.5.1)
44
+ drb (2.2.1)
45
+ edge_rider (2.3.0)
46
+ activerecord (>= 3.2)
47
+ gemika (0.8.3)
48
+ i18n (1.14.5)
49
+ concurrent-ruby (~> 1.0)
50
+ logger (1.6.1)
51
+ minitest (5.25.1)
52
+ mysql2 (0.5.6)
53
+ rake (13.2.1)
54
+ rspec (3.13.0)
55
+ rspec-core (~> 3.13.0)
56
+ rspec-expectations (~> 3.13.0)
57
+ rspec-mocks (~> 3.13.0)
58
+ rspec-core (3.13.1)
59
+ rspec-support (~> 3.13.0)
60
+ rspec-expectations (3.13.2)
61
+ diff-lcs (>= 1.2.0, < 2.0)
62
+ rspec-support (~> 3.13.0)
63
+ rspec-mocks (3.13.1)
64
+ diff-lcs (>= 1.2.0, < 2.0)
65
+ rspec-support (~> 3.13.0)
66
+ rspec-support (3.13.1)
67
+ securerandom (0.3.1)
68
+ timeout (0.4.3)
69
+ tzinfo (2.0.6)
70
+ concurrent-ruby (~> 1.0)
71
+ uri (1.0.2)
72
+
73
+ PLATFORMS
74
+ x86_64-linux
75
+
76
+ DEPENDENCIES
77
+ activerecord (~> 8.0.1)
78
+ byebug
79
+ database_cleaner
80
+ gemika
81
+ minidusen!
82
+ mysql2 (~> 0.5)
83
+ rake
84
+ rspec (~> 3.5)
85
+
86
+ BUNDLED WITH
87
+ 2.5.6
@@ -1,8 +1,8 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  # Runtime dependencies
4
- gem 'activerecord', '~>6.0.0'
5
- gem 'pg', '~>0.18.4'
4
+ gem 'activerecord', '~>8.0.1'
5
+ gem 'pg', '~> 1.4.0'
6
6
 
7
7
  # Development dependencies
8
8
  gem 'rake'
@@ -0,0 +1,87 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ minidusen (1.0.1)
5
+ activerecord (>= 3.2)
6
+ activesupport (>= 3.2)
7
+ edge_rider (>= 0.2.5)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ activemodel (8.0.1)
13
+ activesupport (= 8.0.1)
14
+ activerecord (8.0.1)
15
+ activemodel (= 8.0.1)
16
+ activesupport (= 8.0.1)
17
+ timeout (>= 0.4.0)
18
+ activesupport (8.0.1)
19
+ base64
20
+ benchmark (>= 0.3)
21
+ bigdecimal
22
+ concurrent-ruby (~> 1.0, >= 1.3.1)
23
+ connection_pool (>= 2.2.5)
24
+ drb
25
+ i18n (>= 1.6, < 2)
26
+ logger (>= 1.4.2)
27
+ minitest (>= 5.1)
28
+ securerandom (>= 0.3)
29
+ tzinfo (~> 2.0, >= 2.0.5)
30
+ uri (>= 0.13.1)
31
+ base64 (0.2.0)
32
+ benchmark (0.4.0)
33
+ bigdecimal (3.1.8)
34
+ byebug (11.1.3)
35
+ concurrent-ruby (1.3.4)
36
+ connection_pool (2.4.1)
37
+ database_cleaner (2.0.2)
38
+ database_cleaner-active_record (>= 2, < 3)
39
+ database_cleaner-active_record (2.2.0)
40
+ activerecord (>= 5.a)
41
+ database_cleaner-core (~> 2.0.0)
42
+ database_cleaner-core (2.0.1)
43
+ diff-lcs (1.5.1)
44
+ drb (2.2.1)
45
+ edge_rider (2.3.0)
46
+ activerecord (>= 3.2)
47
+ gemika (0.8.3)
48
+ i18n (1.14.5)
49
+ concurrent-ruby (~> 1.0)
50
+ logger (1.6.1)
51
+ minitest (5.25.1)
52
+ pg (1.4.6)
53
+ rake (13.2.1)
54
+ rspec (3.13.0)
55
+ rspec-core (~> 3.13.0)
56
+ rspec-expectations (~> 3.13.0)
57
+ rspec-mocks (~> 3.13.0)
58
+ rspec-core (3.13.1)
59
+ rspec-support (~> 3.13.0)
60
+ rspec-expectations (3.13.2)
61
+ diff-lcs (>= 1.2.0, < 2.0)
62
+ rspec-support (~> 3.13.0)
63
+ rspec-mocks (3.13.1)
64
+ diff-lcs (>= 1.2.0, < 2.0)
65
+ rspec-support (~> 3.13.0)
66
+ rspec-support (3.13.1)
67
+ securerandom (0.3.1)
68
+ timeout (0.4.3)
69
+ tzinfo (2.0.6)
70
+ concurrent-ruby (~> 1.0)
71
+ uri (1.0.2)
72
+
73
+ PLATFORMS
74
+ ruby
75
+
76
+ DEPENDENCIES
77
+ activerecord (~> 8.0.1)
78
+ byebug
79
+ database_cleaner
80
+ gemika
81
+ minidusen!
82
+ pg (~> 1.4.0)
83
+ rake
84
+ rspec (~> 3.5)
85
+
86
+ BUNDLED WITH
87
+ 2.5.6
data/README.md CHANGED
@@ -1,5 +1,20 @@
1
- Minidusen [![Tests](https://github.com/makandra/minidusen/workflows/Tests/badge.svg)](https://github.com/makandra/minidusen/actions)
2
- =========
1
+ <p>
2
+ <a href="https://makandra.de/">
3
+ <picture>
4
+ <source media="(prefers-color-scheme: light)" srcset="media/makandra-with-bottom-margin.light.svg">
5
+ <source media="(prefers-color-scheme: dark)" srcset="media/makandra-with-bottom-margin.dark.svg">
6
+ <img align="right" width="25%" alt="makandra" src="media/makandra-with-bottom-margin.light.svg">
7
+ </picture>
8
+ </a>
9
+
10
+ <picture>
11
+ <source media="(prefers-color-scheme: light)" srcset="media/logo.light.shapes.svg">
12
+ <source media="(prefers-color-scheme: dark)" srcset="media/logo.dark.shapes.svg">
13
+ <img width="210" alt="Minidusen" role="heading" aria-level="1" src="media/logo.light.shapes.svg">
14
+ </picture>
15
+ </p>
16
+
17
+ [![Tests](https://github.com/makandra/minidusen/workflows/Tests/badge.svg)](https://github.com/makandra/minidusen/actions)
3
18
 
4
19
  Low-tech search solution for ActiveRecord with MySQL or PostgreSQL
5
20
  ------------------------------------------------------------------
@@ -205,6 +220,36 @@ ContactFilter.new.filter(Contact, 'email:foo@bar.com').to_sql
205
220
  # => "SELECT * FROM contacts WHERE email='foo@bar.com'"
206
221
  ```
207
222
 
223
+ Filter aliases
224
+ --------------
225
+
226
+ You can define aliases for the same filter by passing multiple field names to a single `filter` call:
227
+
228
+ ```ruby
229
+ class ContactFilter
230
+ include Minidusen::Filter
231
+
232
+ filter :email, :mail, :contact do |scope, email|
233
+ scope.where(email: email)
234
+ end
235
+ end
236
+ ```
237
+
238
+ Now you can search using any of the defined aliases:
239
+
240
+ ```ruby
241
+ ContactFilter.new.filter(Contact, 'email:foo@bar.com').to_sql
242
+ # => "SELECT * FROM contacts WHERE email='foo@bar.com'"
243
+
244
+ ContactFilter.new.filter(Contact, 'mail:foo@bar.com').to_sql
245
+ # => "SELECT * FROM contacts WHERE email='foo@bar.com'"
246
+
247
+ ContactFilter.new.filter(Contact, 'contact:foo@bar.com').to_sql
248
+ # => "SELECT * FROM contacts WHERE email='foo@bar.com'"
249
+ ```
250
+
251
+ This feature is useful when you want to provide multiple intuitive ways for users to search the same field.
252
+
208
253
  ### Caveat
209
254
 
210
255
  If you search for a phrase containing a colon (e.g. `deploy:rollback`), Minidusen will mistake the first part as a – nonexistent – qualifier and return an empty set.
@@ -219,9 +264,6 @@ Supported Rails versions
219
264
 
220
265
  Minidusen is tested on:
221
266
 
222
- - Rails 4.2
223
- - Rails 5.2
224
- - Rails 6.0
225
267
  - Rails 6.1
226
268
  - Rails 7.0
227
269
  - Rails 7.1
@@ -6,8 +6,10 @@ module Minidusen
6
6
 
7
7
  attr_accessor :minidusen_syntax
8
8
 
9
- def filter(field, &block)
10
- minidusen_syntax.learn_field(field, &block)
9
+ def filter(*fields, &block)
10
+ fields.each do |field|
11
+ minidusen_syntax.learn_field(field, &block)
12
+ end
11
13
  end
12
14
 
13
15
  end
@@ -42,9 +42,10 @@ module Minidusen
42
42
 
43
43
  def extract_text_query_tokens(query_string, query)
44
44
  while query_string.sub!(TEXT_QUERY, '')
45
+ phrase = !$2.nil?
45
46
  value = "#{$2}#{$4}"
46
47
  exclude = "#{$1}#{$3}" == "-"
47
- options = { :field => 'text', :value => value, :exclude => exclude }
48
+ options = { :field => 'text', :value => value, :exclude => exclude, :phrase => phrase }
48
49
  query << Token.new(options)
49
50
  end
50
51
  end
@@ -52,9 +53,10 @@ module Minidusen
52
53
  def extract_field_query_tokens(query_string, query)
53
54
  while query_string.sub!(FIELD_QUERY, '')
54
55
  field = $2
56
+ phrase = !$4.nil?
55
57
  value = "#{$4}#{$6}"
56
58
  exclude = "#{$1}" == "-"
57
- options = { :field => field, :value => value, :exclude => exclude }
59
+ options = { :field => field, :value => value, :exclude => exclude, :phrase => phrase }
58
60
  query << Token.new(options)
59
61
  end
60
62
  end
@@ -7,6 +7,7 @@ module Minidusen
7
7
  @value = options.fetch(:value)
8
8
  @exclude = options.fetch(:exclude, false)
9
9
  @field = options.fetch(:field).to_s
10
+ @phrase = options.fetch(:phrase, false)
10
11
  end
11
12
 
12
13
  def to_s
@@ -21,5 +22,9 @@ module Minidusen
21
22
  exclude
22
23
  end
23
24
 
25
+ def phrase?
26
+ @phrase
27
+ end
28
+
24
29
  end
25
30
  end
@@ -1,3 +1,3 @@
1
1
  module Minidusen
2
- VERSION = '0.11.2'
2
+ VERSION = '1.0.1'
3
3
  end