graphql-searchkick 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -1
- data/lib/graphql/searchkick/searchable_extension.rb +6 -2
- data/lib/graphql/searchkick/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7cd3f32d5911c582242dd3eada324780dcc7bdbb71d36ea02ef381056cbd746
|
4
|
+
data.tar.gz: 95cd5dcbcacb622785bcbc5fc03ca7de14a237f49b6065ec7d3a39d971bdfc9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b652f084bf034cdd176c137ee5b65de299c37bb85a333471b6ebc1502d7b016c42a8fa8a8eec8a59d09c22e1d813af8e11a481b15f3a2902971bbdeb5fd45854
|
7
|
+
data.tar.gz: 86d12ca1727e042b42ea211607a88367cf2d70c726b9195095d76a062d0cea3b9f0921e2fc98fa791c740b594dea801ca196324bc3d75b29521714e2d9f990c7
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@ Integrate Searchkick with GraphQL Connections easily.
|
|
8
8
|
|
9
9
|
## Note
|
10
10
|
|
11
|
-
The current version of the gem only works with `GraphQL::
|
11
|
+
The current version of the gem only works with `GraphQL::Pagination::Connection` . If you need support for the older `GraphQL::Relay::BaseConnection` version use v0.1.0.
|
12
12
|
|
13
13
|
## Considerations & Limits
|
14
14
|
|
@@ -43,6 +43,15 @@ class BaseField < GraphQL::Schema::Field
|
|
43
43
|
end
|
44
44
|
```
|
45
45
|
|
46
|
+
Add the connection to your schema.
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
class Schema < GraphQL::Schema
|
50
|
+
use GraphQL::Pagination::Connections
|
51
|
+
connections.add(GraphQL::Searchkick::LazySearch, GraphQL::Searchkick::ResultConnection)
|
52
|
+
end
|
53
|
+
```
|
54
|
+
|
46
55
|
## Usage
|
47
56
|
|
48
57
|
Add `search: ModelClass` to any connection field that you want to allow querying.
|
@@ -14,8 +14,12 @@ module GraphQL
|
|
14
14
|
query = next_args.delete(:query)
|
15
15
|
result = yield(object, next_args)
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
if defined?(ActiveRecord::Relation) && result.is_a?(ActiveRecord::Relation)
|
18
|
+
result
|
19
|
+
else
|
20
|
+
model = options[:model_class]
|
21
|
+
LazySearch.new(result, query: query, model_class: model)
|
22
|
+
end
|
19
23
|
end
|
20
24
|
end
|
21
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql-searchkick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chad Wilken
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appraisal
|