redisearch-rb 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +1 -2
- data/README.md +2 -1
- data/lib/redisearch.rb +1 -1
- data/lib/redisearch/version.rb +1 -1
- data/test/redisearch_test.rb +34 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 99d803efbd160ce83d3cf58a50b2e739540f143666dc87f18b04c3ff10766577
|
4
|
+
data.tar.gz: d83a8a81049e5b6266130f351d2c82381b12abaf93c1f616e7d602b2503d5abb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abf6a993f32a3c93979763b3cf22e72a959fffd3d14c8ccf2fa44031b5f1c65a30ddad8715c1226ff7467f2b3ad4146be3edc806248073ec5e6926f75fc233fe
|
7
|
+
data.tar.gz: 524ed525611003f0ef515d2eee40ab4a4fcdef851083fa75b053011c1219187f1c2d1ff22c7d3fb6e456b7c53e6a0af42d12f9f6b32701bd91f0ea9a4d8be568
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
[![Gem Version](https://badge.fury.io/rb/redisearch-rb.svg)](https://badge.fury.io/rb/redisearch-rb)
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/redisearch-rb.svg)](https://badge.fury.io/rb/redisearch-rb)
|
2
|
+
[![travis-ci](https://travis-ci.org/vruizext/redisearch-rb.svg?branch=master)](https://travis-ci.org/vruizext/redisearch-rb)
|
2
3
|
|
3
4
|
# redisearch-rb
|
4
5
|
|
data/lib/redisearch.rb
CHANGED
@@ -18,7 +18,7 @@ class RediSearch
|
|
18
18
|
create: [:nooffsets, :nofreqs, :nohl, :nofields],
|
19
19
|
del: [:dd],
|
20
20
|
drop: [:keepdocs],
|
21
|
-
search: [:nocontent, :verbatim, :nostopwords, :withscores, :withsortkeys],
|
21
|
+
search: [:nocontent, :verbatim, :nostopwords, :withscores, :withsortkeys, :highlight, :summarize],
|
22
22
|
sugadd: [:incr],
|
23
23
|
sugget: [:fuzzy, :withscores],
|
24
24
|
}
|
data/lib/redisearch/version.rb
CHANGED
data/test/redisearch_test.rb
CHANGED
@@ -189,6 +189,40 @@ class RediSearchTest < Minitest::Test
|
|
189
189
|
assert_equal 'id_2', matches[0]['id']
|
190
190
|
end
|
191
191
|
|
192
|
+
def test_search_summarize
|
193
|
+
assert(@redisearch_client.create_index(@schema))
|
194
|
+
long_director = 'Steven ' * 80 + 'Sofia Coppola' + ' ' + 'Steven ' * 80
|
195
|
+
docs = [['id_1', ['title', 'Lost in translation', 'director', long_director, 'year', '2004']],
|
196
|
+
['id_2', ['title', 'Ex Machina', 'director', 'Alex Garland', 'year', '2014']],
|
197
|
+
['id_3', ['title', 'Terminator', 'director', 'James Cameron', 'year', '1984']],
|
198
|
+
['id_4', ['title', 'Blade Runner', 'director', 'Ridley Scott', 'year', '1982']]]
|
199
|
+
assert(@redisearch_client.add_docs(docs))
|
200
|
+
matches = @redisearch_client.search('Sofia', summarize: false)
|
201
|
+
assert_equal 1, matches.count
|
202
|
+
assert_equal long_director.size, matches[0]['director'].size
|
203
|
+
|
204
|
+
matches = @redisearch_client.search('Sofia', summarize: true)
|
205
|
+
assert_equal 1, matches.count
|
206
|
+
assert_in_epsilon 122, matches[0]['director'].size, 20
|
207
|
+
end
|
208
|
+
|
209
|
+
def test_search_highlight
|
210
|
+
assert(@redisearch_client.create_index(@schema))
|
211
|
+
long_director = 'Steven ' * 80 + 'Sofia Coppola' + ' ' + 'Steven ' * 80
|
212
|
+
docs = [['id_1', ['title', 'Lost in translation', 'director', long_director, 'year', '2004']],
|
213
|
+
['id_2', ['title', 'Ex Machina', 'director', 'Alex Garland', 'year', '2014']],
|
214
|
+
['id_3', ['title', 'Terminator', 'director', 'James Cameron', 'year', '1984']],
|
215
|
+
['id_4', ['title', 'Blade Runner', 'director', 'Ridley Scott', 'year', '1982']]]
|
216
|
+
assert(@redisearch_client.add_docs(docs))
|
217
|
+
matches = @redisearch_client.search('Sofia', highlight: false)
|
218
|
+
assert_equal 1, matches.count
|
219
|
+
assert_match(/^[^<]+$/, matches[0]['director'])
|
220
|
+
|
221
|
+
matches = @redisearch_client.search('Sofia', highlight: true)
|
222
|
+
assert_equal 1, matches.count
|
223
|
+
assert_match(/<b>/, matches[0]['director'])
|
224
|
+
end
|
225
|
+
|
192
226
|
def test_index_info
|
193
227
|
assert(@redisearch_client.create_index(@schema))
|
194
228
|
doc = ['id_1', ['title', 'Lost in translation', 'director', 'Sofia Coppola', 'year', '2004']]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redisearch-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
A simple Ruby client library for RediSearch.
|
@@ -52,8 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '0'
|
54
54
|
requirements: []
|
55
|
-
|
56
|
-
rubygems_version: 2.6.11
|
55
|
+
rubygems_version: 3.0.3
|
57
56
|
signing_key:
|
58
57
|
specification_version: 4
|
59
58
|
summary: A simple Ruby client library for RediSearch
|