redi_search 2.0.0 → 2.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 +4 -4
- data/README.md +6 -2
- data/bin/console +0 -7
- data/lib/redi_search/model.rb +2 -2
- data/lib/redi_search/search.rb +2 -0
- data/lib/redi_search/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f59647d0daeafbfc902948adde6dfb3e61d92b7d1b79762921926f4e8e8ae3ca
|
4
|
+
data.tar.gz: 7ba39058e621c59f18a33d26a11d35df2b8ce0ae7fafb94de8916d5c0296cab9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 918b4df4305480f2e4251a0a30c6a1e1ecbfd9a1125a4140e5020c3986bc9591ef7f87ac680eb83670dd51b15756d747c918ee14617dbeb2e110823ccef17a29
|
7
|
+
data.tar.gz: 25ee1578bbe420f001099e1bd78c9eaf68273924da34a42949dd70d78552dbe32fc334ba008177d8113874cc349f342405637302b21272b6198f79059dfc15e1
|
data/README.md
CHANGED
@@ -521,8 +521,8 @@ end
|
|
521
521
|
This will automatically add `User.search` and `User.spellcheck`
|
522
522
|
methods which behave the same as if you called them on an `Index` instance.
|
523
523
|
|
524
|
-
`User.reindex(only: [], **options)` is also added and behaves
|
525
|
-
`RediSearch::Index#reindex`. Some of the differences include:
|
524
|
+
`User.reindex(recreate: false, only: [], **options)` is also added and behaves
|
525
|
+
similarly to `RediSearch::Index#reindex`. Some of the differences include:
|
526
526
|
- By default, does an upsert for all `Document`s added using the
|
527
527
|
option `replace: { partial: true }`.
|
528
528
|
- `Document`s do not to be passed as the first parameter. The `search_import`
|
@@ -561,6 +561,10 @@ class User < ApplicationRecord
|
|
561
561
|
end
|
562
562
|
```
|
563
563
|
|
564
|
+
When searching, by default a collection of `Document`s is returned. Calling
|
565
|
+
`#results` on the search query will execute the search, and then look up all the
|
566
|
+
found records in the database and return an ActiveRecord relation.
|
567
|
+
|
564
568
|
The default `Index` name for model `Index`s is
|
565
569
|
`#{model_name.plural}_#{RediSearch.env}`. The `redi_search` method takes an
|
566
570
|
optional `index_prefix` argument which gets prepended to the index name:
|
data/bin/console
CHANGED
data/lib/redi_search/model.rb
CHANGED
@@ -48,11 +48,11 @@ module RediSearch
|
|
48
48
|
redi_search_index.spellcheck(term, distance: distance)
|
49
49
|
end
|
50
50
|
|
51
|
-
def reindex(only: [], **options)
|
51
|
+
def reindex(recreate: false, only: [], **options)
|
52
52
|
search_import.find_in_batches.all? do |group|
|
53
53
|
redi_search_index.reindex(
|
54
54
|
group.map { |record| record.redi_search_document(only: only) },
|
55
|
-
**options.deep_merge(replace: { partial: true })
|
55
|
+
recreate: recreate, **options.deep_merge(replace: { partial: true })
|
56
56
|
)
|
57
57
|
end
|
58
58
|
end
|
data/lib/redi_search/search.rb
CHANGED
data/lib/redi_search/version.rb
CHANGED