struct

Redis::FullText(Runnable)

Inherits Struct < Value < Object

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.

Instance methods

aggregate(index : String, query : String, load fields : Enumerable(String) | Nil = nil, timeout : Time::Span | Nil = nil, groupby : GroupBy | Nil = nil, apply : Apply | Nil = nil, sortby : SortByAggregate | String | Nil = nil, params : NamedTuple | Hash(String, String) | Nil = nil, dialect : Int | Nil = nil)
Source
aggregate!(*args, **kwargs)
Source
create(string : String)

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.

Source
drop(index : String, keepdocs = false)

Drop the specified index.

Source
dropindex(index : String, dd = false)

Drop the specified index and, if dd: true is passed, deletes the indexed documents from Redis.

Source
info(index : String)

Get information about the search index contained in index. For more details, see the FT.INFO documentation.

Source
profile(index : String, query : String)

Profile the given search. For further details, see the FT.PROFILE documentation.

Source
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 | Nil = nil, dialect : Int | Nil = nil)

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)
Source
tagvals(index : String, field : String)
Source

Nested types