使用 RediSearch 请求特定字段(不是所有字段)
Request specific fields (not all fields) with RediSearch
Here's an official example of a RediSearch query:
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"
我的问题是,我怎么能只请求一个或两个字段,例如只是为了回到 "title" 值 ("hello world") 或 "ID" 和 "title" 字段 ([1, "hello world"])。主要是出于性能原因。
是的,它支持 RETURN
选项。
127.0.0.1:6379> FT.SEARCH myIdx "hello world" LIMIT 0 10 RETURN 2 title url
Here's an official example of a RediSearch query:
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"
我的问题是,我怎么能只请求一个或两个字段,例如只是为了回到 "title" 值 ("hello world") 或 "ID" 和 "title" 字段 ([1, "hello world"])。主要是出于性能原因。
是的,它支持 RETURN
选项。
127.0.0.1:6379> FT.SEARCH myIdx "hello world" LIMIT 0 10 RETURN 2 title url