Skip to content

Commit 5a47fef

Browse files
authored
Updated example to py3 syntax and fixed a few typos in the code snippet (#62)
1 parent 0d6f17f commit 5a47fef

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
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

0 commit comments

Comments
 (0)