简体   繁体   中英

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"

My question is, how could I request just one or two fields, eg just to get back to the "title" value ("hello world") or the "ID" and "title" fields ([1, "hello world"]). Mainly for performance reasons.

Yes, it supports it with the RETURN option.

127.0.0.1:6379> FT.SEARCH myIdx "hello world" LIMIT 0 10 RETURN 2 title url

See: https://oss.redislabs.com/redisearch/Commands/#ftsearch

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM