struct Redis::FullText(Runnable)
- Redis::FullText(Runnable)
- Struct
- Value
- Object
Overview
Redis::FullText
wraps a Redis::Client
or Redis::Cluster
to execute
commands against a fulltext search index located on a given server.
redis = Redis::Client.new
redis.ft.create <<-INDEX
people-index ON HASH
PREFIX 1 person:
SCHEMA
name TEXT NOSTEM SORTABLE
email TEXT NOSTEM SORTABLE
location GEO
INDEX
If your Redis server is running in Cluster mode, you can
require "redis/cluster/search"
to send read-only FullText
commands to
shard replicas.
EXPERIMENTAL RediSearch support is still under development. Some APIs may change while details are discovered.
Defined in:
search.crInstance Method Summary
-
#create(string : String)
Create a search index using the syntax specified in the RediSearch
FT.CREATE
docs. -
#drop(index : String, keepdocs = false)
Drop the specified
index
. -
#dropindex(key : String, keepdocs = false)
Drop the specified
index
. -
#info(index : String)
Get information about the search index contained in
index
. -
#profile(index : String, query : String)
Profile the given search.
-
#search(index : String, query : String, nocontent = false, verbatim = false, nostopwords = false, withscores = false, withpayloads = false, withsortkeys = false, filter : Array(Filter) | Nil = nil, geofilter : GeoFilter | Nil = nil, inkeys : Array(String) | Nil = nil, infields : Array(String) | Nil = nil, return return_value : Array(String) | Nil = nil, summarize : Summarize | Nil = nil, highlight : Highlight | Nil = nil, slop : Int | Nil = nil, timeout : Time::Span | Nil = nil, inorder : Bool | Nil = nil, language : String | Nil = nil, expander : String | Nil = nil, scorer : String | Nil = nil, explainscore : Bool | Nil = nil, payload : String | Bytes | Nil = nil, sortby : SortBy | Nil = nil, limit : Tuple(Int, Int) | Nil = nil, params : NamedTuple | Hash(String, String) | Nil = nil, dialect : Int | Nil = nil)
Run the specified
query
againstindex
. - #tagvals(index : String, field : String)
Instance Method Detail
Create a search index using the syntax specified in the RediSearch
FT.CREATE
docs.
redis = Redis::Client.new
redis.ft.create <<-INDEX
people-index ON HASH
PREFIX 1 person:
SCHEMA
name TEXT NOSTEM SORTABLE
email TEXT NOSTEM SORTABLE
location GEO
INDEX
NOTE This method returns immediately, before the index is complete. You can run searches against an incomplete index, but you will also have incomplete results. To find how far along the index is, you can use the #info
method.
TODO Add a method that generates the string passed into this overload.
Get information about the search index contained in index
. For more
details, see the FT.INFO
documentation.
Profile the given search. For further details, see the FT.PROFILE
documentation.
Run the specified query
against index
. Customize the search with various other arguments. For details about what each one does and the return value, see the FT.SEARCH
documentation.
result = redis.ft.search "people-index", "@name:Jamie",
return: %w[name email],
sortby: Redis::FullText::SortBy.new("name", :asc)