typesense 4.1.0 → 5.0.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/.github/workflows/tests.yml +1 -1
- data/README.md +1 -0
- data/lib/typesense/analytics.rb +4 -0
- data/lib/typesense/analytics_events.rb +19 -0
- data/lib/typesense/analytics_events_v1.rb +21 -0
- data/lib/typesense/analytics_rule.rb +4 -0
- data/lib/typesense/analytics_rule_v1.rb +24 -0
- data/lib/typesense/analytics_rules.rb +5 -12
- data/lib/typesense/analytics_rules_v1.rb +30 -0
- data/lib/typesense/analytics_v1.rb +19 -0
- data/lib/typesense/client.rb +4 -1
- data/lib/typesense/curation_set.rb +31 -0
- data/lib/typesense/curation_set_item.rb +29 -0
- data/lib/typesense/curation_set_items.rb +25 -0
- data/lib/typesense/curation_sets.rb +23 -0
- data/lib/typesense/synonym_set.rb +24 -0
- data/lib/typesense/synonym_sets.rb +30 -0
- data/lib/typesense/version.rb +1 -1
- data/lib/typesense.rb +11 -0
- metadata +13 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4b23c932504c838fa3f2e1f81799177bf87ba5ca4707a51166a25ddfe4c4b122
|
|
4
|
+
data.tar.gz: dc707abbc7a0a9407e0dee23fc93aae5da56cd5c6e9829eae932a578b476d307
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 34d84e8e3f542b1adf96200bef90e35754ffa940a43860e72e9e60fe4cf401cad013678a4a42f0253470af31fbbb9d39e2455ce79971348821b479c751d5073b
|
|
7
|
+
data.tar.gz: 6afb7470a13190ec849e9ba01c64a4f45866878291afcbb606998f94b97ba21f7fa58656dd8285d3448072476d96c04920f8fabe8f7fe9b7f8d6928d3d482293
|
data/.github/workflows/tests.yml
CHANGED
data/README.md
CHANGED
|
@@ -33,6 +33,7 @@ Tests are also a good place to know how the the library works internally: [spec]
|
|
|
33
33
|
|
|
34
34
|
| Typesense Server | typesense-ruby |
|
|
35
35
|
|------------------|----------------|
|
|
36
|
+
| \>= v30.0 | \>= v5.0.0 |
|
|
36
37
|
| \>= v28.0 | \>= v3.0.0 |
|
|
37
38
|
| \>= v0.25.0 | \>= v1.0.0 |
|
|
38
39
|
| \>= v0.23.0 | \>= v0.14.0 |
|
data/lib/typesense/analytics.rb
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Typesense
|
|
4
|
+
class AnalyticsEvents
|
|
5
|
+
RESOURCE_PATH = '/analytics/events'
|
|
6
|
+
|
|
7
|
+
def initialize(api_call)
|
|
8
|
+
@api_call = api_call
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create(params)
|
|
12
|
+
@api_call.post(self.class::RESOURCE_PATH, params)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def retrieve(params = {})
|
|
16
|
+
@api_call.get(self.class::RESOURCE_PATH, params)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Typesense
|
|
4
|
+
class AnalyticsEventsV1
|
|
5
|
+
RESOURCE_PATH = '/analytics/events'
|
|
6
|
+
|
|
7
|
+
def initialize(api_call)
|
|
8
|
+
@api_call = api_call
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create(params)
|
|
12
|
+
@api_call.post(endpoint_path, params)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def endpoint_path(operation = nil)
|
|
18
|
+
"#{AnalyticsEventsV1::RESOURCE_PATH}#{"/#{URI.encode_www_form_component(operation)}" unless operation.nil?}"
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Typesense
|
|
4
|
+
class AnalyticsRuleV1
|
|
5
|
+
def initialize(rule_name, api_call)
|
|
6
|
+
@rule_name = rule_name
|
|
7
|
+
@api_call = api_call
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def retrieve
|
|
11
|
+
@api_call.get(endpoint_path)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def delete
|
|
15
|
+
@api_call.delete(endpoint_path)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
private
|
|
19
|
+
|
|
20
|
+
def endpoint_path
|
|
21
|
+
"#{AnalyticsRulesV1::RESOURCE_PATH}/#{URI.encode_www_form_component(@rule_name)}"
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -5,26 +5,19 @@ module Typesense
|
|
|
5
5
|
RESOURCE_PATH = '/analytics/rules'
|
|
6
6
|
|
|
7
7
|
def initialize(api_call)
|
|
8
|
-
@api_call
|
|
9
|
-
@analytics_rules = {}
|
|
8
|
+
@api_call = api_call
|
|
10
9
|
end
|
|
11
10
|
|
|
12
|
-
def
|
|
13
|
-
@api_call.
|
|
11
|
+
def create(rules)
|
|
12
|
+
@api_call.post(self.class::RESOURCE_PATH, rules)
|
|
14
13
|
end
|
|
15
14
|
|
|
16
15
|
def retrieve
|
|
17
|
-
@api_call.get(
|
|
16
|
+
@api_call.get(self.class::RESOURCE_PATH)
|
|
18
17
|
end
|
|
19
18
|
|
|
20
19
|
def [](rule_name)
|
|
21
|
-
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
private
|
|
25
|
-
|
|
26
|
-
def endpoint_path(operation = nil)
|
|
27
|
-
"#{AnalyticsRules::RESOURCE_PATH}#{"/#{URI.encode_www_form_component(operation)}" unless operation.nil?}"
|
|
20
|
+
AnalyticsRule.new(rule_name, @api_call)
|
|
28
21
|
end
|
|
29
22
|
end
|
|
30
23
|
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Typesense
|
|
4
|
+
class AnalyticsRulesV1
|
|
5
|
+
RESOURCE_PATH = '/analytics/rules'
|
|
6
|
+
|
|
7
|
+
def initialize(api_call)
|
|
8
|
+
@api_call = api_call
|
|
9
|
+
@analytics_rules = {}
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def upsert(rule_name, params)
|
|
13
|
+
@api_call.put(endpoint_path(rule_name), params)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def retrieve
|
|
17
|
+
@api_call.get(endpoint_path)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def [](rule_name)
|
|
21
|
+
@analytics_rules[rule_name] ||= AnalyticsRuleV1.new(rule_name, @api_call)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def endpoint_path(operation = nil)
|
|
27
|
+
"#{AnalyticsRulesV1::RESOURCE_PATH}#{"/#{URI.encode_www_form_component(operation)}" unless operation.nil?}"
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Typesense
|
|
4
|
+
class AnalyticsV1
|
|
5
|
+
RESOURCE_PATH = '/analytics'
|
|
6
|
+
|
|
7
|
+
def initialize(api_call)
|
|
8
|
+
@api_call = api_call
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def rules
|
|
12
|
+
@rules ||= AnalyticsRulesV1.new(@api_call)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def events
|
|
16
|
+
@events ||= AnalyticsEventsV1.new(@api_call)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
data/lib/typesense/client.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module Typesense
|
|
4
4
|
class Client
|
|
5
5
|
attr_reader :configuration, :collections, :aliases, :keys, :debug, :health, :metrics, :stats, :operations,
|
|
6
|
-
:multi_search, :analytics, :presets, :stemming, :nl_search_models
|
|
6
|
+
:multi_search, :analytics, :analytics_v1, :presets, :stemming, :nl_search_models, :synonym_sets, :curation_sets
|
|
7
7
|
|
|
8
8
|
def initialize(options = {})
|
|
9
9
|
@configuration = Configuration.new(options)
|
|
@@ -18,9 +18,12 @@ module Typesense
|
|
|
18
18
|
@stats = Stats.new(@api_call)
|
|
19
19
|
@operations = Operations.new(@api_call)
|
|
20
20
|
@analytics = Analytics.new(@api_call)
|
|
21
|
+
@analytics_v1 = AnalyticsV1.new(@api_call)
|
|
21
22
|
@stemming = Stemming.new(@api_call)
|
|
22
23
|
@presets = Presets.new(@api_call)
|
|
23
24
|
@nl_search_models = NlSearchModels.new(@api_call)
|
|
25
|
+
@synonym_sets = SynonymSets.new(@api_call)
|
|
26
|
+
@curation_sets = CurationSets.new(@api_call)
|
|
24
27
|
end
|
|
25
28
|
end
|
|
26
29
|
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Typesense
|
|
4
|
+
class CurationSet
|
|
5
|
+
attr_reader :items
|
|
6
|
+
|
|
7
|
+
def initialize(curation_set_name, api_call)
|
|
8
|
+
@curation_set_name = curation_set_name
|
|
9
|
+
@api_call = api_call
|
|
10
|
+
@items = CurationSetItems.new(@curation_set_name, @api_call)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def upsert(curation_set_data)
|
|
14
|
+
@api_call.put(endpoint_path, curation_set_data)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def retrieve
|
|
18
|
+
@api_call.get(endpoint_path)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def delete
|
|
22
|
+
@api_call.delete(endpoint_path)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
def endpoint_path
|
|
28
|
+
"#{CurationSets::RESOURCE_PATH}/#{URI.encode_www_form_component(@curation_set_name)}"
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Typesense
|
|
4
|
+
class CurationSetItem
|
|
5
|
+
def initialize(curation_set_name, item_id, api_call)
|
|
6
|
+
@curation_set_name = curation_set_name
|
|
7
|
+
@item_id = item_id
|
|
8
|
+
@api_call = api_call
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def retrieve
|
|
12
|
+
@api_call.get(endpoint_path)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def upsert(params)
|
|
16
|
+
@api_call.put(endpoint_path, params)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def delete
|
|
20
|
+
@api_call.delete(endpoint_path)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def endpoint_path
|
|
26
|
+
"#{CurationSets::RESOURCE_PATH}/#{URI.encode_www_form_component(@curation_set_name)}/items/#{URI.encode_www_form_component(@item_id)}"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Typesense
|
|
4
|
+
class CurationSetItems
|
|
5
|
+
def initialize(curation_set_name, api_call)
|
|
6
|
+
@curation_set_name = curation_set_name
|
|
7
|
+
@api_call = api_call
|
|
8
|
+
@items = {}
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def retrieve
|
|
12
|
+
@api_call.get(endpoint_path)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def [](item_id)
|
|
16
|
+
@items[item_id] ||= CurationSetItem.new(@curation_set_name, item_id, @api_call)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
def endpoint_path(operation = nil)
|
|
22
|
+
"#{CurationSets::RESOURCE_PATH}/#{URI.encode_www_form_component(@curation_set_name)}/items#{"/#{operation}" unless operation.nil?}"
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Typesense
|
|
4
|
+
class CurationSets
|
|
5
|
+
RESOURCE_PATH = '/curation_sets'
|
|
6
|
+
|
|
7
|
+
def initialize(api_call)
|
|
8
|
+
@api_call = api_call
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def upsert(curation_set_name, curation_set_data)
|
|
12
|
+
@api_call.put("#{self.class::RESOURCE_PATH}/#{URI.encode_www_form_component(curation_set_name)}", curation_set_data)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def retrieve
|
|
16
|
+
@api_call.get(self.class::RESOURCE_PATH)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def [](curation_set_name)
|
|
20
|
+
CurationSet.new(curation_set_name, @api_call)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Typesense
|
|
4
|
+
class SynonymSet
|
|
5
|
+
def initialize(synonym_set_name, api_call)
|
|
6
|
+
@synonym_set_name = synonym_set_name
|
|
7
|
+
@api_call = api_call
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def retrieve
|
|
11
|
+
@api_call.get(endpoint_path)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def delete
|
|
15
|
+
@api_call.delete(endpoint_path)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
private
|
|
19
|
+
|
|
20
|
+
def endpoint_path
|
|
21
|
+
"#{SynonymSets::RESOURCE_PATH}/#{URI.encode_www_form_component(@synonym_set_name)}"
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Typesense
|
|
4
|
+
class SynonymSets
|
|
5
|
+
RESOURCE_PATH = '/synonym_sets'
|
|
6
|
+
|
|
7
|
+
def initialize(api_call)
|
|
8
|
+
@api_call = api_call
|
|
9
|
+
@synonym_sets = {}
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def upsert(synonym_set_name, params)
|
|
13
|
+
@api_call.put(endpoint_path(synonym_set_name), params)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def retrieve
|
|
17
|
+
@api_call.get(endpoint_path)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def [](synonym_set_name)
|
|
21
|
+
@synonym_sets[synonym_set_name] ||= SynonymSet.new(synonym_set_name, @api_call)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def endpoint_path(operation = nil)
|
|
27
|
+
"#{RESOURCE_PATH}#{"/#{URI.encode_www_form_component(operation)}" unless operation.nil?}"
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
data/lib/typesense/version.rb
CHANGED
data/lib/typesense.rb
CHANGED
|
@@ -16,14 +16,21 @@ require_relative 'typesense/overrides'
|
|
|
16
16
|
require_relative 'typesense/override'
|
|
17
17
|
require_relative 'typesense/synonyms'
|
|
18
18
|
require_relative 'typesense/synonym'
|
|
19
|
+
require_relative 'typesense/synonym_sets'
|
|
20
|
+
require_relative 'typesense/synonym_set'
|
|
19
21
|
require_relative 'typesense/aliases'
|
|
20
22
|
require_relative 'typesense/alias'
|
|
21
23
|
require_relative 'typesense/keys'
|
|
22
24
|
require_relative 'typesense/key'
|
|
23
25
|
require_relative 'typesense/multi_search'
|
|
24
26
|
require_relative 'typesense/analytics'
|
|
27
|
+
require_relative 'typesense/analytics_events'
|
|
25
28
|
require_relative 'typesense/analytics_rules'
|
|
26
29
|
require_relative 'typesense/analytics_rule'
|
|
30
|
+
require_relative 'typesense/analytics_v1'
|
|
31
|
+
require_relative 'typesense/analytics_events_v1'
|
|
32
|
+
require_relative 'typesense/analytics_rules_v1'
|
|
33
|
+
require_relative 'typesense/analytics_rule_v1'
|
|
27
34
|
require_relative 'typesense/presets'
|
|
28
35
|
require_relative 'typesense/preset'
|
|
29
36
|
require_relative 'typesense/debug'
|
|
@@ -37,3 +44,7 @@ require_relative 'typesense/stemming_dictionaries'
|
|
|
37
44
|
require_relative 'typesense/stemming_dictionary'
|
|
38
45
|
require_relative 'typesense/nl_search_models'
|
|
39
46
|
require_relative 'typesense/nl_search_model'
|
|
47
|
+
require_relative 'typesense/curation_sets'
|
|
48
|
+
require_relative 'typesense/curation_set'
|
|
49
|
+
require_relative 'typesense/curation_set_items'
|
|
50
|
+
require_relative 'typesense/curation_set_item'
|
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:
|
|
4
|
+
version: 5.0.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: 2026-01-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|
|
@@ -84,13 +84,22 @@ files:
|
|
|
84
84
|
- lib/typesense/alias.rb
|
|
85
85
|
- lib/typesense/aliases.rb
|
|
86
86
|
- lib/typesense/analytics.rb
|
|
87
|
+
- lib/typesense/analytics_events.rb
|
|
88
|
+
- lib/typesense/analytics_events_v1.rb
|
|
87
89
|
- lib/typesense/analytics_rule.rb
|
|
90
|
+
- lib/typesense/analytics_rule_v1.rb
|
|
88
91
|
- lib/typesense/analytics_rules.rb
|
|
92
|
+
- lib/typesense/analytics_rules_v1.rb
|
|
93
|
+
- lib/typesense/analytics_v1.rb
|
|
89
94
|
- lib/typesense/api_call.rb
|
|
90
95
|
- lib/typesense/client.rb
|
|
91
96
|
- lib/typesense/collection.rb
|
|
92
97
|
- lib/typesense/collections.rb
|
|
93
98
|
- lib/typesense/configuration.rb
|
|
99
|
+
- lib/typesense/curation_set.rb
|
|
100
|
+
- lib/typesense/curation_set_item.rb
|
|
101
|
+
- lib/typesense/curation_set_items.rb
|
|
102
|
+
- lib/typesense/curation_sets.rb
|
|
94
103
|
- lib/typesense/debug.rb
|
|
95
104
|
- lib/typesense/document.rb
|
|
96
105
|
- lib/typesense/documents.rb
|
|
@@ -112,6 +121,8 @@ files:
|
|
|
112
121
|
- lib/typesense/stemming_dictionaries.rb
|
|
113
122
|
- lib/typesense/stemming_dictionary.rb
|
|
114
123
|
- lib/typesense/synonym.rb
|
|
124
|
+
- lib/typesense/synonym_set.rb
|
|
125
|
+
- lib/typesense/synonym_sets.rb
|
|
115
126
|
- lib/typesense/synonyms.rb
|
|
116
127
|
- lib/typesense/version.rb
|
|
117
128
|
- typesense.gemspec
|