autosuggest 0.2.0 → 0.4.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/CHANGELOG.md +10 -0
- data/LICENSE.txt +1 -1
- data/README.md +3 -15
- data/lib/autosuggest/generator.rb +3 -5
- data/lib/autosuggest/version.rb +1 -1
- data/lib/autosuggest.rb +1 -1
- data/lib/generators/autosuggest/suggestions_generator.rb +1 -5
- metadata +5 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 380bee30bc6228daaeb97b24894e2332a0daad91a3f2dfbf6ba04dbca47b794e
|
|
4
|
+
data.tar.gz: 3df1265dbb5b67b234f023a5595d636d4cd3a244496a467f1b1819c2b9c693f0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cd036013fd6ee96dcc935c8ca5551b8c8424af5cb7c7f704617a102798bdb020f30206230876b60843ca31b9395820743b29b6c78438050ed7b69f2dd2eb68a1
|
|
7
|
+
data.tar.gz: 5e66bcba5ad4df678274336f53cc81063117d86a571f252bca8754b28970455de088d775fbc5e493c8910f1f47fb82fd5457c114eefe8359090771b77adc6552
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## 0.4.0 (2025-10-26)
|
|
2
|
+
|
|
3
|
+
- Switched to keyword arguments for `parse_words` method
|
|
4
|
+
- Dropped support for Ruby < 3.2
|
|
5
|
+
|
|
6
|
+
## 0.3.0 (2024-05-22)
|
|
7
|
+
|
|
8
|
+
- Switched to Mittens for stemming
|
|
9
|
+
- Dropped support for Ruby < 3.1
|
|
10
|
+
|
|
1
11
|
## 0.2.0 (2023-01-29)
|
|
2
12
|
|
|
3
13
|
- Added `language` option
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -4,9 +4,7 @@ Generate autocomplete suggestions based on what your users search
|
|
|
4
4
|
|
|
5
5
|
:tangerine: Battle-tested at [Instacart](https://www.instacart.com/opensource)
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
[](https://github.com/ankane/autosuggest/actions)
|
|
7
|
+
[](https://github.com/ankane/autosuggest/actions)
|
|
10
8
|
|
|
11
9
|
## Installation
|
|
12
10
|
|
|
@@ -67,7 +65,7 @@ autosuggest.not_duplicates [["straws", "straus"]]
|
|
|
67
65
|
|
|
68
66
|
#### Filter misspellings
|
|
69
67
|
|
|
70
|
-
We tried open-source libraries like [Aspell](http://aspell.net) and [Hunspell](
|
|
68
|
+
We tried open-source libraries like [Aspell](http://aspell.net) and [Hunspell](https://github.com/hunspell/hunspell) but quickly realized we needed to build a corpus specific to our application.
|
|
71
69
|
|
|
72
70
|
There are two ways to build the corpus, which can be used together.
|
|
73
71
|
|
|
@@ -123,7 +121,7 @@ Autosuggest::Suggestion.transaction do
|
|
|
123
121
|
end
|
|
124
122
|
```
|
|
125
123
|
|
|
126
|
-
Leave out `unique_by` for MySQL
|
|
124
|
+
Leave out `unique_by` for MySQL.
|
|
127
125
|
|
|
128
126
|
#### Show suggestions
|
|
129
127
|
|
|
@@ -201,16 +199,6 @@ Autosuggest::Suggestion.transaction do
|
|
|
201
199
|
end
|
|
202
200
|
```
|
|
203
201
|
|
|
204
|
-
## Upgrading
|
|
205
|
-
|
|
206
|
-
### 0.2.0
|
|
207
|
-
|
|
208
|
-
Suggestions are now filtered by default, and only the query and score are returned. To get all queries and fields, use:
|
|
209
|
-
|
|
210
|
-
```ruby
|
|
211
|
-
autosuggest.suggestions(filter: false)
|
|
212
|
-
```
|
|
213
|
-
|
|
214
202
|
## History
|
|
215
203
|
|
|
216
204
|
View the [changelog](https://github.com/ankane/autosuggest/blob/master/CHANGELOG.md)
|
|
@@ -10,8 +10,8 @@ module Autosuggest
|
|
|
10
10
|
@profane_words = {}
|
|
11
11
|
@concept_tree = {}
|
|
12
12
|
begin
|
|
13
|
-
@stemmer =
|
|
14
|
-
rescue
|
|
13
|
+
@stemmer = Mittens::Stemmer.new(language: language)
|
|
14
|
+
rescue ArgumentError
|
|
15
15
|
raise ArgumentError, "Language not available"
|
|
16
16
|
end
|
|
17
17
|
# TODO take language into account for profanity
|
|
@@ -24,9 +24,7 @@ module Autosuggest
|
|
|
24
24
|
@concepts[name] = Set.new(values.map(&:downcase))
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
def parse_words(phrases,
|
|
28
|
-
min = options[:min] || 1
|
|
29
|
-
|
|
27
|
+
def parse_words(phrases, min: 1)
|
|
30
28
|
word_counts = Hash.new(0)
|
|
31
29
|
phrases.each do |phrase|
|
|
32
30
|
words = tokenize(phrase)
|
data/lib/autosuggest/version.rb
CHANGED
data/lib/autosuggest.rb
CHANGED
|
@@ -22,11 +22,7 @@ module Autosuggest
|
|
|
22
22
|
# use connection_config instead of connection.adapter
|
|
23
23
|
# so database connection isn't needed
|
|
24
24
|
def adapter
|
|
25
|
-
|
|
26
|
-
ActiveRecord::Base.connection_db_config.adapter.to_s
|
|
27
|
-
else
|
|
28
|
-
ActiveRecord::Base.connection_config[:adapter].to_s
|
|
29
|
-
end
|
|
25
|
+
ActiveRecord::Base.connection_db_config.adapter.to_s
|
|
30
26
|
end
|
|
31
27
|
end
|
|
32
28
|
end
|
metadata
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: autosuggest
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Kane
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
13
|
+
name: mittens
|
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
|
16
15
|
requirements:
|
|
17
16
|
- - ">="
|
|
@@ -38,7 +37,6 @@ dependencies:
|
|
|
38
37
|
- - ">="
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
39
|
version: '0'
|
|
41
|
-
description:
|
|
42
40
|
email: andrew@ankane.org
|
|
43
41
|
executables: []
|
|
44
42
|
extensions: []
|
|
@@ -57,7 +55,6 @@ homepage: https://github.com/ankane/autosuggest
|
|
|
57
55
|
licenses:
|
|
58
56
|
- MIT
|
|
59
57
|
metadata: {}
|
|
60
|
-
post_install_message:
|
|
61
58
|
rdoc_options: []
|
|
62
59
|
require_paths:
|
|
63
60
|
- lib
|
|
@@ -65,15 +62,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
65
62
|
requirements:
|
|
66
63
|
- - ">="
|
|
67
64
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '2
|
|
65
|
+
version: '3.2'
|
|
69
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
67
|
requirements:
|
|
71
68
|
- - ">="
|
|
72
69
|
- !ruby/object:Gem::Version
|
|
73
70
|
version: '0'
|
|
74
71
|
requirements: []
|
|
75
|
-
rubygems_version: 3.
|
|
76
|
-
signing_key:
|
|
72
|
+
rubygems_version: 3.6.9
|
|
77
73
|
specification_version: 4
|
|
78
74
|
summary: Generate autocomplete suggestions based on what your users search
|
|
79
75
|
test_files: []
|