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 选项。
RETURN
127.0.0.1:6379> FT.SEARCH myIdx "hello world" LIMIT 0 10 RETURN 2 title url
请参见: https://oss.redislabs.com/redisearch/Commands/#ftsearch