ExRedi v0.1.0 ExRedi View Source
Documentation for ExRedi.
Link to this section Summary
Types
Document format for multi-ops
Error returned from a failed operation
RediSearch field definition
Document ID
The name of your RediSearch index
Operation options
RediSearch query string
RediSearch schema definition
Functions
Adds a document to the index
Adds a document to the index from an existing HASH key in Redis
Adds multiple document to the index via Redis ‘MULTI’
Adds a suggestion string to an auto-complete suggestion dictionary
Runs a search query and performs aggregate transformations on the results
Creates an index with the given spec
Deletes a document from the index
Deletes a string from a suggestion index
Deletes all the keys associated with the index
Checks if the index exists
Prints the execution plan for a query
Returns the full contents of a document
Gets completion suggestions for a prefix
Returns information and statistics on the index
Returns the full contents of multiple documents
Searches the index with the given query, returning either documents or ids
Gets the size of an auto-complete suggestion dictionary
Returns the distinct tags indexed in a Tag field
Link to this section Types
Document format for multi-ops
Error returned from a failed operation
RediSearch field definition
Document ID
The name of your RediSearch index
Operation options
RediSearch query string
RediSearch schema definition
Link to this section Functions
Adds a document to the index.
Example
iex> ExRedi.add("myIdx", "1", ["title", "foo", "body", "bar"])
:ok
Adds a document to the index from an existing HASH key in Redis.
Examples
iex> Redix.command(:ex_redi, ["HMSET", "doc-1", "title", "hello world"])
{:ok, "OK"}
iex> ExRedi.add_hash("myIdx", "doc-1")
:ok
iex> ExRedi.add_hash("myIdx", "nothing-here")
{:error, "Could not load document"}
Adds multiple document to the index via Redis ‘MULTI’.
Example
iex> docs = [
...> {"1", ["title", "foo", "body", "hello"]},
...> {"2", ["title", "bar", "body", "world"]}
...> ]
...> ExRedi.add_multi("myIdx", docs)
[:ok, :ok]
Adds a suggestion string to an auto-complete suggestion dictionary.
Runs a search query and performs aggregate transformations on the results.
Creates an index with the given spec.
Examples
iex> ExRedi.create("myIdx", ["title", "TEXT", "WEIGHT", "5.0", "body", "TEXT"])
:ok
iex> ExRedi.create("myIdx", ["title", "TEXT"])
{:error, "Index already exists. Drop it first!"}
Deletes a document from the index.
Returns 1 if the document was removed from the index, otherwise 0.
Examples
iex> ExRedi.del("myIdx", "1")
1
iex> ExRedi.del("myIdx", "nothing-here")
0
Deletes a string from a suggestion index.
Returns 1 if the string was removed, otherwise 0.
Deletes all the keys associated with the index.
Examples
iex> ExRedi.create("myIdx", ["title", "TEXT"])
:ok
iex> ExRedi.drop("myIdx")
:ok
iex> ExRedi.info("myIdx")
{:error, "Unknown Index name"}
iex> ExRedi.drop("notMyIdx")
{:error, "Unknown Index name"}
Prints the execution plan for a query
Returns the full contents of a document.
Gets completion suggestions for a prefix.
Returns information and statistics on the index.
Example
iex> ExRedi.info(“myIdx”) %{
"bytes_per_record_avg" => "...",
"doc_table_size_mb" => "...",
"fields" => [...],
...
}
Returns the full contents of multiple documents.
Searches the index with the given query, returning either documents or ids.
Gets the size of an auto-complete suggestion dictionary.
Returns the distinct tags indexed in a Tag field.