@@ -15,7 +15,7 @@ It is the "official" client of redisearch, and should be regarded as its canonic
1515
1616## Features
1717
18- RediSearch is an open- source (AGPL ), high performance search engine implemented as a [ Redis Module] ( https://redis.io/topics/modules-intro ) .
18+ RediSearch is a source avaliable (RSAL ), high performance search engine implemented as a [ Redis Module] ( https://redis.io/topics/modules-intro ) .
1919It uses custom data types to allow fast, stable and feature rich full-text search inside redis.
2020
2121This client is a wrapper around the RediSearch API protocol, that allows you to utilize its features easily.
@@ -42,12 +42,22 @@ from redisearch import Client, TextField
4242# Creating a client with a given index name
4343client = Client(" myIndex" )
4444
45+ # IndexDefinition is avaliable for RediSearch 2.0+
46+ definition = IndexDefinition(prefix = [' doc:' , ' article:' ])
47+
4548# Creating the index definition and schema
46- client.create_index((TextField(" title" , weight = 5.0 ), TextField(" body" )))
49+ client.create_index((TextField(" title" , weight = 5.0 ), TextField(" body" )), definition = definition)
50+
51+ # Indexing a document for RediSearch 2.0+
52+ client.redis.hset(' doc:1' ,
53+ mapping = {
54+ ' title' : ' RediSearch' ,
55+ ' body' : ' Redisearch impements a search engine on top of redis'
56+ })
4757
48- # Indexing a document
58+ # Indexing a document for RediSearch 1.x
4959client.add_document(
50- " doc1 " ,
60+ " doc:2 " ,
5161 title = " RediSearch" ,
5262 body = " Redisearch implements a search engine on top of redis" ,
5363)
@@ -62,19 +72,15 @@ res = client.search("search engine", snippet_sizes={"body": 50})
6272q = Query(" search engine" ).verbatim().no_content().with_scores().paging(0 , 5 )
6373res = client.search(q)
6474
65-
6675# The result has the total number of results, and a list of documents
6776print (res.total) # "1"
6877print (res.docs[0 ].title)
6978```
7079
7180## Installing
7281
73- 1 . Install Redis 4.0 or above
74-
75- 2 . [ Install RediSearch] ( http://redisearch.io/Quick_Start/#building-and-running )
76-
77- 3 . Install the python client
82+ 1 . [ Install RediSearch] (http://redisearch.io/Quick_Start
83+ 2 . Install the python client:
7884
7985``` sh
8086$ pip install redisearch
0 commit comments