typesense 3.2.0 → 4.1.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 +2 -2
- data/Gemfile +1 -1
- data/docker-compose.yml +18 -0
- data/lib/typesense/api_call.rb +4 -4
- data/lib/typesense/documents.rb +4 -4
- data/lib/typesense/stemming_dictionaries.rb +2 -2
- data/lib/typesense/version.rb +1 -1
- data/typesense.gemspec +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a062220aa04eb79fee094b740800c3d44a37e561719c1b116d9bea78aaab23f3
|
4
|
+
data.tar.gz: 8ea4367d99be582cbb65e939444fdd1cf0ef51ebb824cf685b70248d67da2877
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 564395bc7f23080983a6f263687594138917bd99c01cf42fe1fb1f1e998060d0eae721c391211ad43470b7b71e892b89b1e00ecbeb1f67410ae6a00f066b31de
|
7
|
+
data.tar.gz: 8b2b7b00c3f011b5b3bd8e77eaed719fe0be05bb3243d6443ee80fbcee60a0cefb32fef47595728c5baaa09cbd11507c655200c94ef02ebc2a7ac25e224a44ca
|
data/.github/workflows/tests.yml
CHANGED
@@ -10,10 +10,10 @@ jobs:
|
|
10
10
|
runs-on: ubuntu-latest
|
11
11
|
strategy:
|
12
12
|
matrix:
|
13
|
-
ruby-version: ['3.0', '3.2', '3.3']
|
13
|
+
ruby-version: ['3.0', '3.2', '3.3', '3.4']
|
14
14
|
services:
|
15
15
|
typesense:
|
16
|
-
image: typesense/typesense:
|
16
|
+
image: typesense/typesense:29.0
|
17
17
|
ports:
|
18
18
|
- 8108:8108
|
19
19
|
volumes:
|
data/Gemfile
CHANGED
@@ -15,7 +15,7 @@ gem 'rake', '~> 13.0'
|
|
15
15
|
gem 'rspec', '~> 3.9'
|
16
16
|
gem 'rspec_junit_formatter', '~> 0.4'
|
17
17
|
gem 'rspec-legacy_formatters', '~> 1.0' # For codecov formatter
|
18
|
-
gem 'rubocop', '
|
18
|
+
gem 'rubocop', '1.72.2'
|
19
19
|
gem 'rubocop-rspec', '~> 3.6', require: false
|
20
20
|
gem 'simplecov', '~> 0.18'
|
21
21
|
gem 'timecop', '~> 0.9'
|
data/docker-compose.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
services:
|
2
|
+
typesense:
|
3
|
+
image: typesense/typesense:29.0
|
4
|
+
ports:
|
5
|
+
- "127.0.0.1:8108:8108"
|
6
|
+
volumes:
|
7
|
+
- data:/data
|
8
|
+
- analytics:/analytics
|
9
|
+
environment:
|
10
|
+
TYPESENSE_API_KEY: xyz
|
11
|
+
TYPESENSE_DATA_DIR: /data
|
12
|
+
TYPESENSE_ENABLE_CORS: true
|
13
|
+
TYPESENSE_ANALYTICS_DIR: /analytics
|
14
|
+
TYPESENSE_ENABLE_SEARCH_ANALYTICS: true
|
15
|
+
|
16
|
+
volumes:
|
17
|
+
data:
|
18
|
+
analytics:
|
data/lib/typesense/api_call.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'faraday'
|
4
|
-
require '
|
4
|
+
require 'json'
|
5
5
|
|
6
6
|
module Typesense
|
7
7
|
class ApiCall
|
@@ -81,7 +81,7 @@ module Typesense
|
|
81
81
|
req.params = query_parameters unless query_parameters.nil?
|
82
82
|
unless body_parameters.nil?
|
83
83
|
body = body_parameters
|
84
|
-
body =
|
84
|
+
body = JSON.dump(body_parameters) if headers['Content-Type'] == 'application/json'
|
85
85
|
req.body = body
|
86
86
|
end
|
87
87
|
end
|
@@ -90,7 +90,7 @@ module Typesense
|
|
90
90
|
@logger.debug "Request #{method}:#{uri_for(endpoint, node)} to Node #{node[:index]} was successfully made (at the network layer). response.status was #{response.status}."
|
91
91
|
|
92
92
|
parsed_response = if response.headers && (response.headers['content-type'] || '').include?('application/json')
|
93
|
-
|
93
|
+
JSON.parse(response.body)
|
94
94
|
else
|
95
95
|
response.body
|
96
96
|
end
|
@@ -112,7 +112,7 @@ module Typesense
|
|
112
112
|
last_exception = e
|
113
113
|
@logger.warn "Request #{method}:#{uri_for(endpoint, node)} to Node #{node[:index]} failed due to \"#{e.class}: #{e.message}\""
|
114
114
|
@logger.warn "Sleeping for #{@retry_interval_seconds}s and then retrying request..."
|
115
|
-
sleep @retry_interval_seconds
|
115
|
+
sleep @retry_interval_seconds if num_tries <= @num_retries_per_request
|
116
116
|
end
|
117
117
|
end
|
118
118
|
@logger.debug "No retries left. Raising last error \"#{last_exception.class}: #{last_exception.message}\"..."
|
data/lib/typesense/documents.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'json'
|
4
4
|
|
5
5
|
module Typesense
|
6
6
|
class Documents
|
@@ -36,7 +36,7 @@ module Typesense
|
|
36
36
|
# @param [Array,String] documents An array of document hashes or a JSONL string of documents.
|
37
37
|
def import(documents, options = {})
|
38
38
|
documents_in_jsonl_format = if documents.is_a?(Array)
|
39
|
-
documents.map { |document|
|
39
|
+
documents.map { |document| JSON.dump(document) }.join("\n")
|
40
40
|
else
|
41
41
|
documents
|
42
42
|
end
|
@@ -51,8 +51,8 @@ module Typesense
|
|
51
51
|
|
52
52
|
if documents.is_a?(Array)
|
53
53
|
results_in_jsonl_format.split("\n").map do |r|
|
54
|
-
|
55
|
-
rescue
|
54
|
+
JSON.parse(r)
|
55
|
+
rescue JSON::ParserError => e
|
56
56
|
{
|
57
57
|
'success' => false,
|
58
58
|
'exception' => e.class.name,
|
@@ -11,7 +11,7 @@ module Typesense
|
|
11
11
|
|
12
12
|
def upsert(dict_id, words_and_roots_combinations)
|
13
13
|
words_and_roots_combinations_in_jsonl = if words_and_roots_combinations.is_a?(Array)
|
14
|
-
words_and_roots_combinations.map { |combo|
|
14
|
+
words_and_roots_combinations.map { |combo| JSON.dump(combo) }.join("\n")
|
15
15
|
else
|
16
16
|
words_and_roots_combinations
|
17
17
|
end
|
@@ -25,7 +25,7 @@ module Typesense
|
|
25
25
|
)
|
26
26
|
|
27
27
|
if words_and_roots_combinations.is_a?(Array)
|
28
|
-
result_in_jsonl.split("\n").map { |r|
|
28
|
+
result_in_jsonl.split("\n").map { |r| JSON.parse(r) }
|
29
29
|
else
|
30
30
|
result_in_jsonl
|
31
31
|
end
|
data/lib/typesense/version.rb
CHANGED
data/typesense.gemspec
CHANGED
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: 4.1.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: 2025-
|
11
|
+
date: 2025-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base64
|
@@ -39,19 +39,19 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.8'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: json
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '2.9'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '2.9'
|
55
55
|
description: Typesense is an open source search engine for building a delightful search
|
56
56
|
experience.
|
57
57
|
email:
|
@@ -72,6 +72,7 @@ files:
|
|
72
72
|
- bin/console
|
73
73
|
- bin/setup
|
74
74
|
- codecov.yml
|
75
|
+
- docker-compose.yml
|
75
76
|
- examples/aliases.rb
|
76
77
|
- examples/client_initialization.rb
|
77
78
|
- examples/collections_and_documents.rb
|