redisearch-rb 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -16
  3. data/lib/redisearch/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 38fdd275f958d4e5df2905efaca54d8d50d98c5b
4
- data.tar.gz: f96e95211a060b7ba444be7d6edc8d264fd77f03
3
+ metadata.gz: 989e86efdc440fc616ee1741256c81b829ca69b0
4
+ data.tar.gz: 2f2d59a65e355750b045f317dc7e6619d120bb0b
5
5
  SHA512:
6
- metadata.gz: a1e81b076d263436bbbf1586df2ad7397be0804bce9c0885f79e54d0cc5b43db735cf6e880656aff995d0bef0ae09df1d8cf8b28cd72c34014cc323dc9ccb76c
7
- data.tar.gz: 5cc4a44605e1e420319d5daa68482e4c684321bdbcb2bb2af1401509b964b952781c4c2cd46fe285e9ccfebce7c2fba73b150aa7510823716e3d95d3b3b80de4
6
+ metadata.gz: 3b61fc7f81b2d86c33142c3c01a3b2b79647b5d40c0f5cfdca094ac9710104c439e153f8c8ab68a29503c97cbedc64a7f440824e02521051f7b0a304a59c25e4
7
+ data.tar.gz: 9208b2b791c07ce5a0dc7b700e9cefc99030a255444500a5bc99103a053b6af167baa17a14120cd7111c8b55a6804bb65ad81e393406a6e642a4a28a6f2f0253
data/README.md CHANGED
@@ -10,8 +10,8 @@ http://redisearch.io/
10
10
 
11
11
  First of all, you need to install RediSearch, if you haven't yet:
12
12
 
13
- 1. Install Redis 4.0.0-rc3 https://github.com/antirez/redis/releases/tag/4.0-rc3
14
- 2. Install RediSearch 0.16 http://redisearch.io/Quick_Start/
13
+ 1. Install Redis 4.0.1 https://github.com/antirez/redis/releases/tag/4.0.1
14
+ 2. Install RediSearch http://redisearch.io/Quick_Start/
15
15
  3. Edit your `redis.conf` file and add a `loadmodule` directive to load the RediSearch module built in the step 2.
16
16
 
17
17
  To install this gem, add this line to your application's Gemfile:
@@ -33,16 +33,9 @@ In order to run the tests, it's necessary to set some env variables (see .env.ex
33
33
 
34
34
  - `REDIS_SERVER_PATH`, the path to the `redis-server` executable
35
35
 
36
- - `REDIS_MODULE_PATH`, the path to the RediSearch module
36
+ - `REDIS_MODULE_PATH`, the path to the `redisearch.so` module
37
37
 
38
- - `REDIS_PORT`, the TCP port used by Redis server
39
-
40
- - `REDIS_TEST_URL` is the Redis url where the server will be available. The port has to match the port specified in
41
- `REDIS_PORT` or in the redis config file
42
-
43
- - `REDIS_CONF_PATH`, is the path to your redis conf file. You can configure the port and the path to RediSearch module in
44
- a config file if you prefer. If the path to the config file is given, `REDIS_MODULE_PATH` and `REDIS_PORT` will be
45
- ignored
38
+ - `REDIS_CONF_PATH`, the two previous parameters can be configured using a redis conf file. In case `REDIS_CONF_PATH` is given, the values of the env vars `REDIS_SERVER_PATH` and `REDIS_MODULE_PATH` are ignored.
46
39
 
47
40
 
48
41
  ## Usage
@@ -55,23 +48,27 @@ redisearch_client = RediSearch.new('test_idx', redis)
55
48
 
56
49
  schema = ['title', 'TEXT', 'WEIGHT', '2.0',
57
50
  'director', 'TEXT', 'WEIGHT', '1.0',
58
- 'year', 'NUMERIC']
51
+ 'year', 'NUMERIC', 'SORTABLE']
59
52
 
60
- redisearch_client.create_index(schema)
53
+ redisearch_client.create_index(schema, { nooffsets: true })
61
54
  # => "OK"
62
55
 
63
56
  docs = [['id_1', ['title', 'Lost in translation', 'director', 'Sofia Coppola', 'year', '2004']],
64
57
  ['id_2', ['title', 'Ex Machina', 'director', 'Alex Garland', 'year', '2014']]]
65
- redisearch_client.add_docs(docs)
58
+ redisearch_client.add_docs(docs, { replace: true })
66
59
  # => ["OK", "OK"]
67
60
 
68
61
  # See query syntax here: http://redisearch.io/Query_Syntax/
69
- redisearch_client.search('lost|machina', { withscores: true })
62
+ redisearch_client.search('lost|machina', { withscores: true, limit: ['0', '2'] })
70
63
  # => [{"title"=>"Ex Machina", "director"=>"Alex Garland", "year"=>"2014", "score"=>"2", "id"=>"id_2"},
71
64
  # {"title"=>"Lost in translation", "director"=>"Sofia Coppola", "year"=>"2004", "score"=>"1", "id"=>"id_1"}]
72
65
 
73
- redisearch_client.search('@year:[2003 2004]')
66
+ redisearch_client.search('@year:[2003 2017]', { sortby: ['year', 'asc'], limit: ['0', '1'] })
74
67
  # => [{"title"=>"Lost in translation", "director"=>"Sofia Coppola", "year"=>"2004", "id"=>"id_1"}]
68
+
69
+ redisearch_client.search('@year:[2003 2017]', { sortby: ['year', 'asc'], limit: ['1', '1'] })
70
+ # => [{"title"=>"Ex Machina", "director"=>"Alex Garland", "year"=>"2014", "score"=>"2", "id"=>"id_2"}
71
+
75
72
  ```
76
73
 
77
74
  ## Contributing
@@ -1,3 +1,3 @@
1
1
  class RediSearch
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redisearch-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Ruiz