typesense 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +4 -2
- data/.rubocop_todo.yml +8 -0
- data/LICENSE +198 -10
- data/README.md +2 -2
- data/examples/aliases.rb +80 -0
- data/examples/collections_and_documents.rb +17 -17
- data/examples/overrides.rb +129 -0
- data/examples/search.rb +17 -17
- data/lib/typesense.rb +4 -0
- data/lib/typesense/alias.rb +24 -0
- data/lib/typesense/aliases.rb +30 -0
- data/lib/typesense/api_call.rb +14 -4
- data/lib/typesense/client.rb +5 -3
- data/lib/typesense/collection.rb +2 -0
- data/lib/typesense/configuration.rb +2 -2
- data/lib/typesense/override.rb +25 -0
- data/lib/typesense/overrides.rb +31 -0
- data/lib/typesense/version.rb +1 -1
- data/typesense.gemspec +13 -11
- metadata +58 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6dcd2c3b6cfbf9be0a2d466eb377a55d9a419ba9334861de46cb3eefe6542d56
|
4
|
+
data.tar.gz: c3c6bbc4d9eb200a827d01ccbf25f2a9f660dce2237e483886237325f1ebb8eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c76aff4123a3c2067319f6d4c168eeaf5b2f95cf50cd07fd1ab0e9c8aec9f628be408071aa52750e86e768d1751205b4da94dcfdd4246f7ccb667d2c0a1ff01
|
7
|
+
data.tar.gz: 9e246a32ad33a084768b8b8c0eae17c61b969296294b757936d6f157a93beeb7b2d91c046a7322676ea62a363f7a09dadb89ed01a99c6071516ef227ba515280
|
data/.circleci/config.yml
CHANGED
@@ -27,8 +27,10 @@ jobs:
|
|
27
27
|
# - v1-dependencies-
|
28
28
|
|
29
29
|
- run:
|
30
|
-
name:
|
30
|
+
name: install bundler
|
31
31
|
command: |
|
32
|
+
echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV
|
33
|
+
source $BASH_ENV
|
32
34
|
gem install bundler
|
33
35
|
|
34
36
|
- run:
|
@@ -44,7 +46,7 @@ jobs:
|
|
44
46
|
- run:
|
45
47
|
name: lint
|
46
48
|
command: |
|
47
|
-
rubocop
|
49
|
+
bundle exec rubocop
|
48
50
|
|
49
51
|
# run tests!
|
50
52
|
- run:
|
data/.rubocop_todo.yml
CHANGED
@@ -38,6 +38,10 @@ RSpec/ExampleLength:
|
|
38
38
|
- 'spec/typesense/debug_spec.rb'
|
39
39
|
- 'spec/typesense/document_spec.rb'
|
40
40
|
- 'spec/typesense/documents_spec.rb'
|
41
|
+
- 'spec/typesense/override_spec.rb'
|
42
|
+
- 'spec/typesense/overrides_spec.rb'
|
43
|
+
- 'spec/typesense/alias_spec.rb'
|
44
|
+
- 'spec/typesense/aliases_spec.rb'
|
41
45
|
|
42
46
|
# Offense count: 2
|
43
47
|
# Configuration parameters: AggregateFailuresByDefault.
|
@@ -58,6 +62,10 @@ Style/Documentation:
|
|
58
62
|
- 'lib/typesense/debug.rb'
|
59
63
|
- 'lib/typesense/document.rb'
|
60
64
|
- 'lib/typesense/documents.rb'
|
65
|
+
- 'lib/typesense/override.rb'
|
66
|
+
- 'lib/typesense/overrides.rb'
|
67
|
+
- 'lib/typesense/alias.rb'
|
68
|
+
- 'lib/typesense/aliases.rb'
|
61
69
|
|
62
70
|
# Offense count: 92
|
63
71
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
data/LICENSE
CHANGED
@@ -1,13 +1,201 @@
|
|
1
|
-
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
2
4
|
|
3
|
-
|
4
|
-
you may not use this software except in compliance with the License.
|
5
|
-
You may obtain a copy of the License at
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
6
|
|
7
|
-
|
7
|
+
1. Definitions.
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Typesense Ruby Library [![Gem Version](https://badge.fury.io/rb/typesense.svg)](https://badge.fury.io/rb/typesense) [![CircleCI](https://circleci.com/gh/typesense/typesense-ruby.svg?style=shield&circle-token=063f2179925b0b37d540126f6c96f6e1fe23f1b9)](https://circleci.com/gh/typesense/typesense-ruby)
|
1
|
+
# Typesense Ruby Library [![Gem Version](https://badge.fury.io/rb/typesense.svg)](https://badge.fury.io/rb/typesense) [![CircleCI](https://circleci.com/gh/typesense/typesense-ruby.svg?style=shield&circle-token=063f2179925b0b37d540126f6c96f6e1fe23f1b9)](https://circleci.com/gh/typesense/typesense-ruby) [![codecov](https://codecov.io/gh/typesense/typesense-ruby/branch/master/graph/badge.svg)](https://codecov.io/gh/typesense/typesense-ruby)
|
2
2
|
|
3
3
|
|
4
4
|
Ruby client library for accessing the [Typesense HTTP API](https://github.com/typesense/typesense).
|
@@ -37,4 +37,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
37
37
|
|
38
38
|
## Contributing
|
39
39
|
|
40
|
-
Bug reports and pull requests are welcome on GitHub at [typesense/typesense-ruby](https://github.com/typesense/typesense-ruby).
|
40
|
+
Bug reports and pull requests are welcome on GitHub at [typesense/typesense-ruby](https://github.com/typesense/typesense-ruby).
|
data/examples/aliases.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
##
|
4
|
+
# These examples walk you through operations specifically related to aliases
|
5
|
+
# # This is a Typesense Premium feature (see: https://typesense.org/premium)
|
6
|
+
|
7
|
+
require_relative '../lib/typesense'
|
8
|
+
require 'awesome_print'
|
9
|
+
|
10
|
+
AwesomePrint.defaults = {
|
11
|
+
indent: -2
|
12
|
+
}
|
13
|
+
|
14
|
+
##
|
15
|
+
# Setup
|
16
|
+
#
|
17
|
+
# Start the master
|
18
|
+
# $ docker run -p 8108:8108 -it -v/tmp/typesense-data-master/:/data -it typesense/typesense:0.8.0-rc1 --data-dir /data --api-key=abcd --listen-port 8108 --license-key=<>
|
19
|
+
#
|
20
|
+
|
21
|
+
##
|
22
|
+
# Create a client
|
23
|
+
typesense = Typesense::Client.new(
|
24
|
+
master_node: {
|
25
|
+
host: 'localhost',
|
26
|
+
port: 8108,
|
27
|
+
protocol: 'http',
|
28
|
+
api_key: 'abcd'
|
29
|
+
}
|
30
|
+
)
|
31
|
+
|
32
|
+
# Create a collection
|
33
|
+
create_response = typesense.collections.create(
|
34
|
+
"name": 'books_january',
|
35
|
+
"fields": [
|
36
|
+
{ "name": 'title', "type": 'string' },
|
37
|
+
{ "name": 'authors', "type": 'string[]' },
|
38
|
+
{ "name": 'authors_facet', "type": 'string[]', "facet": true },
|
39
|
+
{ "name": 'publication_year', "type": 'int32' },
|
40
|
+
{ "name": 'publication_year_facet', "type": 'string', "facet": true },
|
41
|
+
{ "name": 'ratings_count', "type": 'int32' },
|
42
|
+
{ "name": 'average_rating', "type": 'float' },
|
43
|
+
{ "name": 'image_url', "type": 'string' }
|
44
|
+
],
|
45
|
+
"default_sorting_field": 'ratings_count'
|
46
|
+
)
|
47
|
+
|
48
|
+
ap create_response
|
49
|
+
|
50
|
+
# Create or update an existing alias
|
51
|
+
create_alias_response = typesense.aliases.upsert('books',
|
52
|
+
"collection_name": 'books_january')
|
53
|
+
ap create_alias_response
|
54
|
+
|
55
|
+
# Add a book using the alias name `books`
|
56
|
+
hunger_games_book = {
|
57
|
+
'id': '1', 'original_publication_year': 2008, 'authors': ['Suzanne Collins'], 'average_rating': 4.34,
|
58
|
+
'publication_year': 2008, 'publication_year_facet': '2008', 'authors_facet': ['Suzanne Collins'],
|
59
|
+
'title': 'The Hunger Games',
|
60
|
+
'image_url': 'https://images.gr-assets.com/books/1447303603m/2767052.jpg',
|
61
|
+
'ratings_count': 4_780_653
|
62
|
+
}
|
63
|
+
|
64
|
+
typesense.collections['books'].documents.create(hunger_games_book)
|
65
|
+
|
66
|
+
# Search using the alias
|
67
|
+
ap typesense.collections['books'].documents.search(
|
68
|
+
'q': 'hunger',
|
69
|
+
'query_by': 'title',
|
70
|
+
'sort_by': 'ratings_count:desc'
|
71
|
+
)
|
72
|
+
|
73
|
+
# List all aliases
|
74
|
+
ap typesense.aliases.retrieve
|
75
|
+
|
76
|
+
# Retrieve the configuration of a specific alias
|
77
|
+
ap typesense.aliases['books'].retrieve
|
78
|
+
|
79
|
+
# Delete an alias
|
80
|
+
ap typesense.aliases['books'].delete
|
@@ -23,39 +23,39 @@ AwesomePrint.defaults = {
|
|
23
23
|
##
|
24
24
|
# Create a client
|
25
25
|
typesense = Typesense::Client.new(
|
26
|
-
master_node:
|
27
|
-
host:
|
28
|
-
port:
|
26
|
+
master_node: {
|
27
|
+
host: 'localhost',
|
28
|
+
port: 8108,
|
29
29
|
protocol: 'http',
|
30
|
-
api_key:
|
30
|
+
api_key: 'abcd'
|
31
31
|
},
|
32
32
|
read_replica_nodes: [
|
33
33
|
{
|
34
|
-
host:
|
35
|
-
port:
|
34
|
+
host: 'localhost',
|
35
|
+
port: 8109,
|
36
36
|
protocol: 'http',
|
37
|
-
api_key:
|
37
|
+
api_key: 'wxyz'
|
38
38
|
}
|
39
39
|
],
|
40
|
-
timeout_seconds:
|
40
|
+
timeout_seconds: 10
|
41
41
|
)
|
42
42
|
|
43
43
|
##
|
44
44
|
# Create a collection
|
45
45
|
schema = {
|
46
|
-
'name'
|
47
|
-
'fields'
|
46
|
+
'name' => 'companies',
|
47
|
+
'fields' => [
|
48
48
|
{
|
49
49
|
'name' => 'company_name',
|
50
50
|
'type' => 'string'
|
51
51
|
},
|
52
52
|
{
|
53
|
-
'name'
|
54
|
-
'type'
|
53
|
+
'name' => 'num_employees',
|
54
|
+
'type' => 'int32'
|
55
55
|
},
|
56
56
|
{
|
57
|
-
'name'
|
58
|
-
'type'
|
57
|
+
'name' => 'country',
|
58
|
+
'type' => 'string',
|
59
59
|
'facet' => true
|
60
60
|
}
|
61
61
|
],
|
@@ -178,10 +178,10 @@ typesense.collections.create(schema)
|
|
178
178
|
##
|
179
179
|
# Create (index) a document
|
180
180
|
document = {
|
181
|
-
'id'
|
182
|
-
'company_name'
|
181
|
+
'id' => '124',
|
182
|
+
'company_name' => 'Stark Industries',
|
183
183
|
'num_employees' => 5215,
|
184
|
-
'country'
|
184
|
+
'country' => 'USA'
|
185
185
|
}
|
186
186
|
|
187
187
|
document = typesense.collections['companies'].documents.create(document)
|
@@ -0,0 +1,129 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
##
|
4
|
+
# These examples walk you through operations specifically related to overrides
|
5
|
+
# This is a Typesense Premium feature (see: https://typesense.org/premium)
|
6
|
+
|
7
|
+
require_relative '../lib/typesense'
|
8
|
+
require 'awesome_print'
|
9
|
+
|
10
|
+
AwesomePrint.defaults = {
|
11
|
+
indent: -2
|
12
|
+
}
|
13
|
+
|
14
|
+
##
|
15
|
+
# Setup
|
16
|
+
#
|
17
|
+
# Start the master
|
18
|
+
# $ docker run -p 8108:8108 -it -v/tmp/typesense-data-master/:/data -it typesense/typesense:0.8.0-rc1 --data-dir /data --api-key=abcd --listen-port 8108 --license-key=<>
|
19
|
+
|
20
|
+
##
|
21
|
+
# Create a client
|
22
|
+
typesense = Typesense::Client.new(
|
23
|
+
master_node: {
|
24
|
+
host: 'localhost',
|
25
|
+
port: 8108,
|
26
|
+
protocol: 'http',
|
27
|
+
api_key: 'abcd'
|
28
|
+
}
|
29
|
+
)
|
30
|
+
|
31
|
+
##
|
32
|
+
# Create a collection
|
33
|
+
schema = {
|
34
|
+
'name' => 'companies',
|
35
|
+
'fields' => [
|
36
|
+
{
|
37
|
+
'name' => 'company_name',
|
38
|
+
'type' => 'string'
|
39
|
+
},
|
40
|
+
{
|
41
|
+
'name' => 'num_employees',
|
42
|
+
'type' => 'int32'
|
43
|
+
},
|
44
|
+
{
|
45
|
+
'name' => 'country',
|
46
|
+
'type' => 'string',
|
47
|
+
'facet' => true
|
48
|
+
}
|
49
|
+
],
|
50
|
+
'default_sorting_field' => 'num_employees'
|
51
|
+
}
|
52
|
+
|
53
|
+
typesense.collections.create(schema)
|
54
|
+
|
55
|
+
# Let's create a couple documents for us to use in our search examples
|
56
|
+
typesense.collections['companies'].documents.create(
|
57
|
+
'id' => '124',
|
58
|
+
'company_name' => 'Stark Industries',
|
59
|
+
'num_employees' => 5215,
|
60
|
+
'country' => 'USA'
|
61
|
+
)
|
62
|
+
|
63
|
+
typesense.collections['companies'].documents.create(
|
64
|
+
'id' => '127',
|
65
|
+
'company_name' => 'Stark Corp',
|
66
|
+
'num_employees' => 1031,
|
67
|
+
'country' => 'USA'
|
68
|
+
)
|
69
|
+
|
70
|
+
typesense.collections['companies'].documents.create(
|
71
|
+
'id' => '125',
|
72
|
+
'company_name' => 'Acme Corp',
|
73
|
+
'num_employees' => 1002,
|
74
|
+
'country' => 'France'
|
75
|
+
)
|
76
|
+
|
77
|
+
typesense.collections['companies'].documents.create(
|
78
|
+
'id' => '126',
|
79
|
+
'company_name' => 'Doofenshmirtz Inc',
|
80
|
+
'num_employees' => 2,
|
81
|
+
'country' => 'Tri-State Area'
|
82
|
+
)
|
83
|
+
|
84
|
+
##
|
85
|
+
# Create overrides
|
86
|
+
|
87
|
+
typesense.collections['companies'].overrides.create(
|
88
|
+
"id": 'promote-doofenshmirtz',
|
89
|
+
"rule": {
|
90
|
+
"query": 'doofen',
|
91
|
+
"match": 'exact'
|
92
|
+
},
|
93
|
+
"includes": [{ 'id' => '126', 'position' => 1 }]
|
94
|
+
)
|
95
|
+
typesense.collections['companies'].overrides.create(
|
96
|
+
"id": 'promote-acme',
|
97
|
+
"rule": {
|
98
|
+
"query": 'stark',
|
99
|
+
"match": 'exact'
|
100
|
+
},
|
101
|
+
"includes": [{ 'id' => '125', 'position' => 1 }]
|
102
|
+
)
|
103
|
+
|
104
|
+
##
|
105
|
+
# Search for documents
|
106
|
+
results = typesense.collections['companies'].documents.search(
|
107
|
+
'q' => 'doofen',
|
108
|
+
'query_by' => 'company_name'
|
109
|
+
)
|
110
|
+
ap results
|
111
|
+
|
112
|
+
results = typesense.collections['companies'].documents.search(
|
113
|
+
'q' => 'stark',
|
114
|
+
'query_by' => 'company_name'
|
115
|
+
)
|
116
|
+
ap results
|
117
|
+
|
118
|
+
results = typesense.collections['companies'].documents.search(
|
119
|
+
'q' => 'Inc',
|
120
|
+
'query_by' => 'company_name',
|
121
|
+
'filter_by' => 'num_employees:<100',
|
122
|
+
'sort_by' => 'num_employees:desc'
|
123
|
+
)
|
124
|
+
ap results
|
125
|
+
|
126
|
+
##
|
127
|
+
# Cleanup
|
128
|
+
# Drop the collection
|
129
|
+
typesense.collections['companies'].delete
|
data/examples/search.rb
CHANGED
@@ -22,39 +22,39 @@ AwesomePrint.defaults = {
|
|
22
22
|
##
|
23
23
|
# Create a client
|
24
24
|
typesense = Typesense::Client.new(
|
25
|
-
master_node:
|
26
|
-
host:
|
27
|
-
port:
|
25
|
+
master_node: {
|
26
|
+
host: 'localhost',
|
27
|
+
port: 8108,
|
28
28
|
protocol: 'http',
|
29
|
-
api_key:
|
29
|
+
api_key: 'abcd'
|
30
30
|
},
|
31
31
|
read_replica_nodes: [
|
32
32
|
{
|
33
|
-
host:
|
34
|
-
port:
|
33
|
+
host: 'localhost',
|
34
|
+
port: 8109,
|
35
35
|
protocol: 'http',
|
36
|
-
api_key:
|
36
|
+
api_key: 'wxyz'
|
37
37
|
}
|
38
38
|
],
|
39
|
-
timeout_seconds:
|
39
|
+
timeout_seconds: 10
|
40
40
|
)
|
41
41
|
|
42
42
|
##
|
43
43
|
# Create a collection
|
44
44
|
schema = {
|
45
|
-
'name'
|
46
|
-
'fields'
|
45
|
+
'name' => 'companies',
|
46
|
+
'fields' => [
|
47
47
|
{
|
48
48
|
'name' => 'company_name',
|
49
49
|
'type' => 'string'
|
50
50
|
},
|
51
51
|
{
|
52
|
-
'name'
|
53
|
-
'type'
|
52
|
+
'name' => 'num_employees',
|
53
|
+
'type' => 'int32'
|
54
54
|
},
|
55
55
|
{
|
56
|
-
'name'
|
57
|
-
'type'
|
56
|
+
'name' => 'country',
|
57
|
+
'type' => 'string',
|
58
58
|
'facet' => true
|
59
59
|
}
|
60
60
|
],
|
@@ -135,9 +135,9 @@ ap results
|
|
135
135
|
# Search for more documents
|
136
136
|
results = typesense.collections['companies'].documents.search(
|
137
137
|
'q' => 'Inc',
|
138
|
-
'query_by'
|
138
|
+
'query_by' => 'company_name',
|
139
139
|
'filter_by' => 'num_employees:<100',
|
140
|
-
'sort_by'
|
140
|
+
'sort_by' => 'num_employees:desc'
|
141
141
|
)
|
142
142
|
ap results
|
143
143
|
|
@@ -164,7 +164,7 @@ ap results
|
|
164
164
|
##
|
165
165
|
# Search for more documents
|
166
166
|
results = typesense.collections['companies'].documents.search(
|
167
|
-
'q'
|
167
|
+
'q' => 'Non-existent',
|
168
168
|
'query_by' => 'company_name'
|
169
169
|
)
|
170
170
|
ap results
|
data/lib/typesense.rb
CHANGED
@@ -11,5 +11,9 @@ require_relative 'typesense/collections'
|
|
11
11
|
require_relative 'typesense/collection'
|
12
12
|
require_relative 'typesense/documents'
|
13
13
|
require_relative 'typesense/document'
|
14
|
+
require_relative 'typesense/overrides'
|
15
|
+
require_relative 'typesense/override'
|
16
|
+
require_relative 'typesense/aliases'
|
17
|
+
require_relative 'typesense/alias'
|
14
18
|
require_relative 'typesense/debug'
|
15
19
|
require_relative 'typesense/error'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Typesense
|
4
|
+
class Alias
|
5
|
+
def initialize(configuration, name)
|
6
|
+
@configuration = configuration
|
7
|
+
@name = name
|
8
|
+
end
|
9
|
+
|
10
|
+
def retrieve
|
11
|
+
ApiCall.new(@configuration).get(endpoint_path)
|
12
|
+
end
|
13
|
+
|
14
|
+
def delete
|
15
|
+
ApiCall.new(@configuration).delete(endpoint_path)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def endpoint_path
|
21
|
+
"#{Aliases::RESOURCE_PATH}/#{@name}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Typesense
|
4
|
+
class Aliases
|
5
|
+
RESOURCE_PATH = '/aliases'
|
6
|
+
|
7
|
+
def initialize(configuration)
|
8
|
+
@configuration = configuration
|
9
|
+
@aliases = {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def upsert(alias_name, mapping)
|
13
|
+
ApiCall.new(@configuration).put(endpoint_path(alias_name), mapping)
|
14
|
+
end
|
15
|
+
|
16
|
+
def retrieve
|
17
|
+
ApiCall.new(@configuration).get(RESOURCE_PATH)
|
18
|
+
end
|
19
|
+
|
20
|
+
def [](alias_name)
|
21
|
+
@aliases[alias_name] ||= Alias.new(@configuration, alias_name)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def endpoint_path(alias_name)
|
27
|
+
"#{Aliases::RESOURCE_PATH}/#{alias_name}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/typesense/api_call.rb
CHANGED
@@ -16,12 +16,22 @@ module Typesense
|
|
16
16
|
perform_with_error_handling(:do_not_use_read_replicas) do
|
17
17
|
self.class.post(uri_for(endpoint),
|
18
18
|
default_options.merge(
|
19
|
-
body:
|
19
|
+
body: parameters.to_json,
|
20
20
|
headers: default_headers.merge('Content-Type' => 'application/json')
|
21
21
|
))
|
22
22
|
end.parsed_response
|
23
23
|
end
|
24
24
|
|
25
|
+
def put(endpoint, parameters = {})
|
26
|
+
perform_with_error_handling(:do_not_use_read_replicas) do
|
27
|
+
self.class.put(uri_for(endpoint),
|
28
|
+
default_options.merge(
|
29
|
+
body: parameters.to_json,
|
30
|
+
headers: default_headers.merge('Content-Type' => 'application/json')
|
31
|
+
))
|
32
|
+
end.parsed_response
|
33
|
+
end
|
34
|
+
|
25
35
|
def get(endpoint, parameters = {})
|
26
36
|
get_unparsed_response(endpoint, parameters).parsed_response
|
27
37
|
end
|
@@ -30,7 +40,7 @@ module Typesense
|
|
30
40
|
perform_with_error_handling(:use_read_replicas) do |node, node_index|
|
31
41
|
self.class.get(uri_for(endpoint, node, node_index),
|
32
42
|
default_options.merge(
|
33
|
-
query:
|
43
|
+
query: parameters,
|
34
44
|
headers: default_headers
|
35
45
|
))
|
36
46
|
end
|
@@ -40,7 +50,7 @@ module Typesense
|
|
40
50
|
perform_with_error_handling(:do_not_use_read_replicas) do
|
41
51
|
self.class.delete(uri_for(endpoint),
|
42
52
|
default_options.merge(
|
43
|
-
query:
|
53
|
+
query: parameters,
|
44
54
|
headers: default_headers
|
45
55
|
))
|
46
56
|
end.parsed_response
|
@@ -89,7 +99,7 @@ module Typesense
|
|
89
99
|
Errno::EINVAL, Errno::ENETDOWN, Errno::ENETUNREACH, Errno::ENETRESET, Errno::ECONNABORTED, Errno::ECONNRESET,
|
90
100
|
Errno::ETIMEDOUT, Errno::ECONNREFUSED, Errno::EHOSTDOWN, Errno::EHOSTUNREACH,
|
91
101
|
Timeout::Error, Error::ServerError, HTTParty::ResponseError
|
92
|
-
if (
|
102
|
+
if ([:use_read_replicas, true].include? use_read_replicas) &&
|
93
103
|
!@configuration.read_replica_nodes.nil?
|
94
104
|
node = :read_replica
|
95
105
|
node_index += 1
|
data/lib/typesense/client.rb
CHANGED
@@ -4,12 +4,14 @@ module Typesense
|
|
4
4
|
class Client
|
5
5
|
attr_reader :configuration
|
6
6
|
attr_reader :collections
|
7
|
+
attr_reader :aliases
|
7
8
|
attr_reader :debug
|
8
9
|
|
9
10
|
def initialize(options = {})
|
10
|
-
@configuration
|
11
|
-
@collections
|
12
|
-
@
|
11
|
+
@configuration = Configuration.new(options)
|
12
|
+
@collections = Collections.new(@configuration)
|
13
|
+
@aliases = Aliases.new(@configuration)
|
14
|
+
@debug = Debug.new(@configuration)
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
data/lib/typesense/collection.rb
CHANGED
@@ -3,11 +3,13 @@
|
|
3
3
|
module Typesense
|
4
4
|
class Collection
|
5
5
|
attr_reader :documents
|
6
|
+
attr_reader :overrides
|
6
7
|
|
7
8
|
def initialize(configuration, name)
|
8
9
|
@configuration = configuration
|
9
10
|
@name = name
|
10
11
|
@documents = Documents.new(@configuration, @name)
|
12
|
+
@overrides = Overrides.new(@configuration, @name)
|
11
13
|
end
|
12
14
|
|
13
15
|
def retrieve
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Typesense
|
4
|
+
class Override
|
5
|
+
def initialize(configuration, collection_name, override_id)
|
6
|
+
@configuration = configuration
|
7
|
+
@collection_name = collection_name
|
8
|
+
@override_id = override_id
|
9
|
+
end
|
10
|
+
|
11
|
+
def retrieve
|
12
|
+
ApiCall.new(@configuration).get(endpoint_path)
|
13
|
+
end
|
14
|
+
|
15
|
+
def delete
|
16
|
+
ApiCall.new(@configuration).delete(endpoint_path)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def endpoint_path
|
22
|
+
"#{Collections::RESOURCE_PATH}/#{@collection_name}#{Overrides::RESOURCE_PATH}/#{@override_id}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Typesense
|
4
|
+
class Overrides
|
5
|
+
RESOURCE_PATH = '/overrides'
|
6
|
+
|
7
|
+
def initialize(configuration, collection_name)
|
8
|
+
@configuration = configuration
|
9
|
+
@collection_name = collection_name
|
10
|
+
@overrides = {}
|
11
|
+
end
|
12
|
+
|
13
|
+
def create(params)
|
14
|
+
ApiCall.new(@configuration).put(endpoint_path, params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def retrieve
|
18
|
+
ApiCall.new(@configuration).get(endpoint_path)
|
19
|
+
end
|
20
|
+
|
21
|
+
def [](override_id)
|
22
|
+
@overrides[override_id] ||= Override.new(@configuration, @collection_name, override_id)
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def endpoint_path(operation = nil)
|
28
|
+
"#{Collections::RESOURCE_PATH}/#{@collection_name}#{Overrides::RESOURCE_PATH}#{operation.nil? ? '' : '/' + operation}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/typesense/version.rb
CHANGED
data/typesense.gemspec
CHANGED
@@ -7,7 +7,7 @@ require 'typesense/version'
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
8
|
spec.name = 'typesense'
|
9
9
|
spec.version = Typesense::VERSION
|
10
|
-
spec.authors = ['
|
10
|
+
spec.authors = ['Typesense, Inc.']
|
11
11
|
spec.email = ['contact@typesense.org']
|
12
12
|
|
13
13
|
spec.summary = 'Ruby Library for Typesense'
|
@@ -23,15 +23,17 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
25
|
spec.add_development_dependency 'awesome_print', '~> 1.8'
|
26
|
-
spec.add_development_dependency 'bundler', '~>
|
27
|
-
spec.add_development_dependency '
|
28
|
-
spec.add_development_dependency '
|
29
|
-
spec.add_development_dependency '
|
30
|
-
spec.add_development_dependency '
|
31
|
-
spec.add_development_dependency '
|
32
|
-
spec.add_development_dependency '
|
33
|
-
spec.add_development_dependency '
|
34
|
-
spec.add_development_dependency '
|
26
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
27
|
+
spec.add_development_dependency 'codecov', '~> 0.1'
|
28
|
+
spec.add_development_dependency 'pry-byebug', '~> 3.7'
|
29
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
30
|
+
spec.add_development_dependency 'rspec', '~> 3.9'
|
31
|
+
spec.add_development_dependency 'rspec-legacy_formatters', '~> 1.0' # For codecov formatter
|
32
|
+
spec.add_development_dependency 'rspec_junit_formatter', '~> 0.4'
|
33
|
+
spec.add_development_dependency 'rubocop', '~> 0.76'
|
34
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 1.36'
|
35
|
+
spec.add_development_dependency 'simplecov', '~> 0.17'
|
36
|
+
spec.add_development_dependency 'webmock', '~> 3.7'
|
35
37
|
|
36
|
-
spec.add_dependency 'httparty', '~> 0.
|
38
|
+
spec.add_dependency 'httparty', '~> 0.17'
|
37
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typesense
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Typesense, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -30,140 +30,168 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: codecov
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.1'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.1'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: pry-byebug
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
61
|
+
version: '3.7'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3.
|
68
|
+
version: '3.7'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rake
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
75
|
+
version: '13.0'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
82
|
+
version: '13.0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rspec
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: '3.
|
89
|
+
version: '3.9'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.9'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec-legacy_formatters
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.0'
|
76
104
|
type: :development
|
77
105
|
prerelease: false
|
78
106
|
version_requirements: !ruby/object:Gem::Requirement
|
79
107
|
requirements:
|
80
108
|
- - "~>"
|
81
109
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
110
|
+
version: '1.0'
|
83
111
|
- !ruby/object:Gem::Dependency
|
84
112
|
name: rspec_junit_formatter
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|
86
114
|
requirements:
|
87
115
|
- - "~>"
|
88
116
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0.
|
117
|
+
version: '0.4'
|
90
118
|
type: :development
|
91
119
|
prerelease: false
|
92
120
|
version_requirements: !ruby/object:Gem::Requirement
|
93
121
|
requirements:
|
94
122
|
- - "~>"
|
95
123
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0.
|
124
|
+
version: '0.4'
|
97
125
|
- !ruby/object:Gem::Dependency
|
98
126
|
name: rubocop
|
99
127
|
requirement: !ruby/object:Gem::Requirement
|
100
128
|
requirements:
|
101
129
|
- - "~>"
|
102
130
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
131
|
+
version: '0.76'
|
104
132
|
type: :development
|
105
133
|
prerelease: false
|
106
134
|
version_requirements: !ruby/object:Gem::Requirement
|
107
135
|
requirements:
|
108
136
|
- - "~>"
|
109
137
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
138
|
+
version: '0.76'
|
111
139
|
- !ruby/object:Gem::Dependency
|
112
140
|
name: rubocop-rspec
|
113
141
|
requirement: !ruby/object:Gem::Requirement
|
114
142
|
requirements:
|
115
143
|
- - "~>"
|
116
144
|
- !ruby/object:Gem::Version
|
117
|
-
version: '1.
|
145
|
+
version: '1.36'
|
118
146
|
type: :development
|
119
147
|
prerelease: false
|
120
148
|
version_requirements: !ruby/object:Gem::Requirement
|
121
149
|
requirements:
|
122
150
|
- - "~>"
|
123
151
|
- !ruby/object:Gem::Version
|
124
|
-
version: '1.
|
152
|
+
version: '1.36'
|
125
153
|
- !ruby/object:Gem::Dependency
|
126
154
|
name: simplecov
|
127
155
|
requirement: !ruby/object:Gem::Requirement
|
128
156
|
requirements:
|
129
157
|
- - "~>"
|
130
158
|
- !ruby/object:Gem::Version
|
131
|
-
version: '0.
|
159
|
+
version: '0.17'
|
132
160
|
type: :development
|
133
161
|
prerelease: false
|
134
162
|
version_requirements: !ruby/object:Gem::Requirement
|
135
163
|
requirements:
|
136
164
|
- - "~>"
|
137
165
|
- !ruby/object:Gem::Version
|
138
|
-
version: '0.
|
166
|
+
version: '0.17'
|
139
167
|
- !ruby/object:Gem::Dependency
|
140
168
|
name: webmock
|
141
169
|
requirement: !ruby/object:Gem::Requirement
|
142
170
|
requirements:
|
143
171
|
- - "~>"
|
144
172
|
- !ruby/object:Gem::Version
|
145
|
-
version: '3.
|
173
|
+
version: '3.7'
|
146
174
|
type: :development
|
147
175
|
prerelease: false
|
148
176
|
version_requirements: !ruby/object:Gem::Requirement
|
149
177
|
requirements:
|
150
178
|
- - "~>"
|
151
179
|
- !ruby/object:Gem::Version
|
152
|
-
version: '3.
|
180
|
+
version: '3.7'
|
153
181
|
- !ruby/object:Gem::Dependency
|
154
182
|
name: httparty
|
155
183
|
requirement: !ruby/object:Gem::Requirement
|
156
184
|
requirements:
|
157
185
|
- - "~>"
|
158
186
|
- !ruby/object:Gem::Version
|
159
|
-
version: '0.
|
187
|
+
version: '0.17'
|
160
188
|
type: :runtime
|
161
189
|
prerelease: false
|
162
190
|
version_requirements: !ruby/object:Gem::Requirement
|
163
191
|
requirements:
|
164
192
|
- - "~>"
|
165
193
|
- !ruby/object:Gem::Version
|
166
|
-
version: '0.
|
194
|
+
version: '0.17'
|
167
195
|
description: Typesense is an open source search engine for building a delightful search
|
168
196
|
experience.
|
169
197
|
email:
|
@@ -183,9 +211,13 @@ files:
|
|
183
211
|
- Rakefile
|
184
212
|
- bin/console
|
185
213
|
- bin/setup
|
214
|
+
- examples/aliases.rb
|
186
215
|
- examples/collections_and_documents.rb
|
216
|
+
- examples/overrides.rb
|
187
217
|
- examples/search.rb
|
188
218
|
- lib/typesense.rb
|
219
|
+
- lib/typesense/alias.rb
|
220
|
+
- lib/typesense/aliases.rb
|
189
221
|
- lib/typesense/api_call.rb
|
190
222
|
- lib/typesense/client.rb
|
191
223
|
- lib/typesense/collection.rb
|
@@ -195,6 +227,8 @@ files:
|
|
195
227
|
- lib/typesense/document.rb
|
196
228
|
- lib/typesense/documents.rb
|
197
229
|
- lib/typesense/error.rb
|
230
|
+
- lib/typesense/override.rb
|
231
|
+
- lib/typesense/overrides.rb
|
198
232
|
- lib/typesense/version.rb
|
199
233
|
- typesense.gemspec
|
200
234
|
homepage: https://typesense.org
|
@@ -216,8 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
216
250
|
- !ruby/object:Gem::Version
|
217
251
|
version: '0'
|
218
252
|
requirements: []
|
219
|
-
|
220
|
-
rubygems_version: 2.7.6
|
253
|
+
rubygems_version: 3.0.6
|
221
254
|
signing_key:
|
222
255
|
specification_version: 4
|
223
256
|
summary: Ruby Library for Typesense
|