File: Quick_Start.md

package info (click to toggle)
redisearch 1%3A1.2.1-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 12,076 kB
  • sloc: ansic: 79,131; python: 3,419; pascal: 1,644; makefile: 431; yacc: 422; sh: 5
file content (69 lines) | stat: -rw-r--r-- 1,268 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

# Quick Start Guide for RediSearch

## Running with Docker

```sh
docker run -p 6379:6379 goodform/redisearch:latest
```

## Building and running from source

```sh
git clone https://github.com/goodform/RediSearch.git
cd RediSearch/src
make all

# Assuming you have a Redis build from the unstable branch:
/path/to/redis-server --loadmodule ./redisearch.so
```

## Creating an index with fields and weights (default weight is 1.0)

```
127.0.0.1:6379> FT.CREATE myIdx SCHEMA title TEXT WEIGHT 5.0 body TEXT url TEXT
OK 

``` 

## Adding documents to the index
```
127.0.0.1:6379> FT.ADD myIdx doc1 1.0 FIELDS title "hello world" body "lorem ipsum" url "http://redis.io" 
OK
```

## Searching the index

```
127.0.0.1:6379> FT.SEARCH myIdx "hello world" LIMIT 0 10
1) (integer) 1
2) "doc1"
3) 1) "title"
   2) "hello world"
   3) "body"
   4) "lorem ipsum"
   5) "url"
   6) "http://redis.io"
```

!!! note
    Input is expected to be valid utf-8 or ASCII. The engine cannot handle wide character unicode at the moment. 


## Dropping the index

```
127.0.0.1:6379> FT.DROP myIdx
OK
```

## Adding and getting Auto-complete suggestions

```
127.0.0.1:6379> FT.SUGADD autocomplete "hello world" 100
OK

127.0.0.1:6379> FT.SUGGET autocomplete "he"
1) "hello world"

```