Skip to content

Commit d8ab53b

Browse files
authored
Merge branch 'master' into test-from-PR-27
2 parents ea2e0fb + 5a47fef commit d8ab53b

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,29 +40,32 @@ For more details, visit [http://redisearch.io](http://redisearch.io)
4040
from redisearch import Client, TextField
4141

4242
# Creating a client with a given index name
43-
client = Client('myIndex')
43+
client = Client("myIndex")
4444

4545
# Creating the index definition and schema
46-
client.create_index((TextField('title', weight=5.0), TextField('body')))
46+
client.create_index((TextField("title", weight=5.0), TextField("body")))
4747

4848
# Indexing a document
49-
client.add_document('doc1', title = 'RediSearch', body = 'Redisearch impements a search engine on top of redis')
49+
client.add_document(
50+
"doc1",
51+
title="RediSearch",
52+
body="Redisearch implements a search engine on top of redis",
53+
)
5054

5155
# Simple search
5256
res = client.search("search engine")
5357

5458
# Searching with snippets
55-
res = client.search("search engine", snippet_sizes = {'body': 50})
59+
res = client.search("search engine", snippet_sizes={"body": 50})
5660

57-
# Searching with complext parameters:
58-
q = Query("search engine").verbatim().no_content().with_scores().paging(0,5)
61+
# Searching with complex parameters:
62+
q = Query("search engine").verbatim().no_content().with_scores().paging(0, 5)
5963
res = client.search(q)
6064

6165

62-
# the result has the total number of results, and a list of documents
63-
print res.total # "1"
64-
print res.docs[0].title
65-
66+
# The result has the total number of results, and a list of documents
67+
print(res.total) # "1"
68+
print(res.docs[0].title)
6669
```
6770

6871
## Installing

redisearch/aggregation.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ class Group(object):
8686
This object automatically created in the `AggregateRequest.group_by()`
8787
"""
8888
def __init__(self, fields, reducers):
89-
if not fields:
90-
raise ValueError('need at least one field')
9189
if not reducers:
9290
raise ValueError('Need at least one reducer')
9391

test/test_builder.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ def testGroup(self):
4040
# Check the group class on its own
4141
self.assertRaises(ValueError, a.Group, [], [])
4242
self.assertRaises(ValueError, a.Group, ['foo'], [])
43-
self.assertRaises(ValueError, a.Group, [], r.count())
43+
44+
# Zero fields, single reducer
45+
g = a.Group([], r.count())
46+
ret = g.build_args()
47+
self.assertEqual(['GROUPBY', '0', 'REDUCE', 'COUNT', '0'], ret)
4448

4549
# Single field, single reducer
4650
g = a.Group('foo', r.count())

0 commit comments

Comments
 (0)