### Setup Pipeline Connection Source: https://github.com/redis/nredisstack/blob/master/Examples/CombinationModulesPipeline.md Gets a database instance and initializes a new pipeline for batching commands. ```csharp var db = redis.GetDatabase(); var pipeline = new Pipeline(db); ``` -------------------------------- ### Setup for Redis Search Indexing Source: https://github.com/redis/nredisstack/blob/master/README.md Import necessary namespaces and establish a connection to Redis for search operations. This setup is required before creating or querying indexes. ```csharp using NRedisStack.Search; using NRedisStack.Search.Literals.Enums; //... ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("localhost"); IDatabase db = redis.GetDatabase(); SearchCommands ft = db.FT(); JsonCommands json = db.JSON(); ``` -------------------------------- ### Setup Pipeline Connection Source: https://github.com/redis/nredisstack/blob/master/Examples/PipelineWithAsync.md Initializes a new pipeline object associated with the specified Redis database. ```csharp var pipeline = new Pipeline(db); ``` -------------------------------- ### Start Redis Instance with Docker Source: https://github.com/redis/nredisstack/blob/master/README.md Run a Redis instance using Docker, exposing the default Redis port. ```sh docker run -p 6379:6379 --name redis redis:latest ``` -------------------------------- ### Install NRedisStack Package Source: https://github.com/redis/nredisstack/blob/master/README.md Use the dotnet CLI to add the NRedisStack package to your project. ```text dotnet add package NRedisStack ``` -------------------------------- ### ConfigGet Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Gets the value of a configuration option. ```APIDOC ## ConfigGet Gets the value of a configuration option. ### Method `CONFIG GET` ### Endpoint `/search/config/get` ### Parameters #### Query Parameters - **option** (string) - Required - The configuration option to retrieve. ### Response #### Success Response (200) - **Dictionary** - A dictionary containing the configuration option and its value. ``` -------------------------------- ### Connect to Redis and Get Database Instance Source: https://github.com/redis/nredisstack/blob/master/README.md Establish a connection to a Redis instance and retrieve an IDatabase object for command execution. Ensure StackExchange.Redis is referenced. ```csharp using NRedisStack; using NRedisStack.RedisStackCommands; using StackExchange.Redis; //... ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("localhost"); IDatabase db = redis.GetDatabase(); ``` -------------------------------- ### Connect to Redis and get JSON client (Async) Source: https://github.com/redis/nredisstack/blob/master/Examples/AsyncExample.md Connects to a Redis server asynchronously and retrieves a database instance configured for JSON commands. Ensure Redis is running on localhost. ```csharp var redis = await ConnectionMultiplexer.ConnectAsync("localhost"); var db = redis.GetDatabase(); var json = db.JSON(); ``` -------------------------------- ### Get Database and Command References Source: https://github.com/redis/nredisstack/blob/master/Examples/ConvertSearchResultToJson.md Obtains references to the Redis database, search commands (FT), and JSON commands (JSON). ```csharp var db = redis.GetDatabase(); var ft = db.FT(); var json = db.JSON(); ``` -------------------------------- ### Get Redis Database and Search Clients Source: https://github.com/redis/nredisstack/blob/master/Examples/HsetAndSearch.md Obtains references to the Redis database and the full-text search client for executing commands. ```csharp var db = redis.GetDatabase(); var ft = db.FT(); ``` -------------------------------- ### Get Redis Database Reference Source: https://github.com/redis/nredisstack/blob/master/Examples/PipelineWithAsync.md Obtains a reference to the default Redis database. ```csharp var db = redis.GetDatabase(); ``` -------------------------------- ### Create JSON Search Index Source: https://github.com/redis/nredisstack/blob/master/Examples/BasicQueryOperations.md Create a RediSearch index on JSON documents. This example defines fields for ID, gender, season, description, price, city, and coordinates. ```csharp SearchCommands ft = db.FT(); try {ft.DropIndex("idx1");} catch {}; ft.Create("idx1", new FTCreateParams().On(IndexDataType.JSON) .Prefix("product:"), new Schema().AddNumericField(new FieldName("$.id", "id")) .AddTagField(new FieldName("$.gender", "gender")) .AddTagField(new FieldName("$.season.*", "season")) .AddTextField(new FieldName("$.description", "description")) .AddNumericField(new FieldName("$.price", "price")) .AddTextField(new FieldName("$.city", "city")) .AddGeoField(new FieldName("$.coords", "coords"))); ``` -------------------------------- ### Create the Search Index Source: https://github.com/redis/nredisstack/blob/master/Examples/HsetAndSearch.md Executes the FT.CREATE command to build the search index named 'example_index' with the defined schema and parameters. ```csharp ft.Create("example_index", parameters, schema); ``` -------------------------------- ### Initialize Redis and Search Clients Source: https://github.com/redis/nredisstack/blob/master/Examples/GeoShapeQueryExample.md Connect to the Redis server and obtain references to the database and search commands. Initialize WKTReader and GeometryFactory for geospatial operations. ```csharp // Connect to the Redis server: var redis = ConnectionMultiplexer.Connect("localhost"); var db = redis.GetDatabase(); // Get a reference to the database and for search commands: var ft = db.FT(); // Create WTKReader and GeometryFactory objects: WKTReader reader = new WKTReader(); GeometryFactory factory = new GeometryFactory(); ``` -------------------------------- ### Get Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Retrieves the latest data point from a TimeSeries. ```APIDOC ## Get ### Description Retrieves the latest data point from a specified TimeSeries key. By default, it fetches the latest sample. ### Method Signature static NRedisStack.TimeSeriesCommandsBuilder.Get(string! key, bool latest = false) -> NRedisStack.RedisStackCommands.SerializedCommand! ``` -------------------------------- ### SearchCommandBuilder SugLen Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Gets the number of suggestions in a suggestion index. ```APIDOC ## SearchCommandBuilder SugLen ### Description Gets the number of suggestions stored in a suggestion index. ### Method Signature `static NRedisStack.SearchCommandBuilder.SugLen(string! key) -> NRedisStack.RedisStackCommands.SerializedCommand!` ### Parameters * **key** (string!) - The key of the suggestion index. ``` -------------------------------- ### Initialize Redis Pipeline Source: https://github.com/redis/nredisstack/blob/master/Examples/PipelineExample.md Connect to the Redis server and set up a new pipeline object. This is the initial step before adding commands to the pipeline. ```csharp IDatabase db = redisFixture.Redis.GetDatabase(); var pipeline = new Pipeline(db); ``` -------------------------------- ### SugLen Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Gets the number of suggestions in a Redisearch suggestion index. ```APIDOC ## SugLen ### Description Gets the number of suggestions in a Redisearch suggestion index. ### Method `SugLen` ### Parameters - **key** (string!) - The key of the suggestion index. ### Returns - long ``` -------------------------------- ### TypeAsync Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Get the type of the JSON value at the specified path. ```APIDOC ## TypeAsync ### Description Get the type of the JSON value at the specified path. ### Method `TypeAsync(RedisKey key, string? path = null)` ### Parameters #### Path Parameters - **key** (RedisKey) - The key of the JSON document. - **path** (string?) - Optional JSON path to the value. ### Response #### Success Response (200) - **JsonType[]** - An array of JsonTypes representing the types of the values found at the specified paths. ``` -------------------------------- ### StrLenAsync Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Get the length of the string value at the specified path. ```APIDOC ## StrLenAsync ### Description Get the length of the string value at the specified path. ### Method `StrLenAsync(RedisKey key, string? path = null)` ### Parameters #### Path Parameters - **key** (RedisKey) - The key of the JSON document. - **path** (string?) - Optional JSON path to the string value. ### Response #### Success Response (200) - **long?[]** - An array of longs representing the lengths of the string values found at the specified paths. ``` -------------------------------- ### Connect to Redis Source: https://github.com/redis/nredisstack/blob/master/Examples/TransactionsExample.md Establishes a connection to the Redis server. Ensure Redis is running on localhost. ```cs var redis = await ConnectionMultiplexer.ConnectAsync("localhost"); var db = redis.GetDatabase(); ``` -------------------------------- ### Configure Search Index Parameters Source: https://github.com/redis/nredisstack/blob/master/Examples/CombinationModulesPipeline.md Sets up parameters for creating a JSON-based search index with a key prefix. ```csharp var parameters = FTCreateParams.CreateParams().On(IndexDataType.JSON).Prefix("person:"); ``` -------------------------------- ### ObjKeysAsync Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Get the keys of the JSON object at the specified path. ```APIDOC ## ObjKeysAsync ### Description Get the keys of the JSON object at the specified path. ### Method `ObjKeysAsync(RedisKey key, string? path = null)` ### Parameters #### Path Parameters - **key** (RedisKey) - The key of the JSON document. - **path** (string?) - Optional JSON path to the object. ### Response #### Success Response (200) - **IEnumerable>** - An enumerable collection of hash sets, where each hash set contains the keys of a JSON object found at the specified paths. ``` -------------------------------- ### ArrLenAsync Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Get the length of the JSON array at the specified path. ```APIDOC ## ArrLenAsync ### Description Get the length of the JSON array at the specified path. ### Method `ArrLenAsync(RedisKey key, string? path = null)` ### Parameters #### Path Parameters - **key** (RedisKey) - The key of the JSON document. - **path** (string?) - Optional JSON path to the array. ### Response #### Success Response (200) - **long?[]** - An array of longs representing the lengths of the arrays found at the specified paths. ``` -------------------------------- ### RespAsync Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Get the RESP representation of the JSON value at the specified path. ```APIDOC ## RespAsync ### Description Get the RESP representation of the JSON value at the specified path. ### Method `RespAsync(RedisKey key, string? path = null)` ### Parameters #### Path Parameters - **key** (RedisKey) - The key of the JSON document. - **path** (string?) - Optional JSON path to the value. ### Response #### Success Response (200) - **RedisResult[]** - An array of RedisResults representing the RESP encoded values. ``` -------------------------------- ### ExplainAsync Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Returns the query plan for a given search query. ```APIDOC ## ExplainAsync ### Description Returns the query plan for a given search query. ### Method `ExplainAsync` ### Parameters * **indexName** (string!) - The name of the index to explain. * **query** (string!) - The search query to explain. * **dialect** (int?) - Optional. The dialect version to use for the query. ### Returns `System.Threading.Tasks.Task` - A task that represents the asynchronous operation, returning the query plan as a string. ``` -------------------------------- ### ObjLenAsync Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Get the number of keys in the JSON object at the specified path. ```APIDOC ## ObjLenAsync ### Description Get the number of keys in the JSON object at the specified path. ### Method `ObjLenAsync(RedisKey key, string? path = null)` ### Parameters #### Path Parameters - **key** (RedisKey) - The key of the JSON document. - **path** (string?) - Optional JSON path to the object. ### Response #### Success Response (200) - **long?[]** - An array of longs representing the number of keys in the objects found at the specified paths. ``` -------------------------------- ### ExplainCliAsync Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Returns the query plan for a given search query, formatted for CLI output. ```APIDOC ## ExplainCliAsync ### Description Returns the query plan for a given search query, formatted specifically for display in a command-line interface. ### Method `ExplainCliAsync` ### Parameters - **indexName** (string) - Required - The name of the search index. - **query** (string) - Required - The search query string. - **dialect** (int?) - Optional - The query dialect version to use. ### Returns - Task - A task that represents the asynchronous operation, containing the query plan as an array of Redis results. ``` -------------------------------- ### MGetAsync Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Get JSON values from multiple keys at the specified path. ```APIDOC ## MGetAsync ### Description Get JSON values from multiple keys at the specified path. ### Method `MGetAsync(RedisKey[] keys, string path)` ### Parameters #### Path Parameters - **keys** (RedisKey[]) - An array of keys to retrieve JSON values from. - **path** (string) - The JSON path to retrieve values from. ### Response #### Success Response (200) - **RedisResult[]** - An array of RedisResults containing the JSON values. ``` -------------------------------- ### GetAsync (single path) Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Get the JSON value at the specified path. ```APIDOC ## GetAsync (single path) ### Description Get the JSON value at the specified path. Allows for pretty-printing the output. ### Method `GetAsync(RedisKey key, string? path = null)` ### Parameters #### Path Parameters - **key** (RedisKey) - The key of the JSON document. - **path** (string?) - Optional JSON path to the value. - **indent** (RedisValue?) - Optional indentation string for pretty-printing. - **newLine** (RedisValue?) - Optional newline string for pretty-printing. - **space** (RedisValue?) - Optional space string for pretty-printing. ### Response #### Success Response (200) - **RedisResult** - The JSON value at the specified path. ``` -------------------------------- ### ExplainCli Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Explains a search query for CLI output. ```APIDOC ## ExplainCli Explains a search query for CLI output. ### Method `EXPLAIN CLI` ### Endpoint `/search/explain-cli/{indexName}` ### Parameters #### Path Parameters - **indexName** (string) - Required - The name of the index. #### Query Parameters - **query** (string) - Required - The query to explain. - **dialect** (int) - Optional - The dialect version. ### Response #### Success Response (200) - **RedisResult[]** - An array of Redis results explaining the query. ``` -------------------------------- ### DebugMemoryAsync Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Get the memory usage of a JSON value at the specified path. ```APIDOC ## DebugMemoryAsync ### Description Get the memory usage in bytes of a JSON value at the specified path. ### Method `DebugMemoryAsync(string key, string? path = null)` ### Parameters #### Path Parameters - **key** (string) - The key of the JSON document. - **path** (string?) - Optional JSON path to the value. ### Response #### Success Response (200) - **long** - The memory usage in bytes. ``` -------------------------------- ### ITimeSeriesCommandsAsync.GetAsync Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Gets the latest data point from a time series. This method is asynchronous. ```APIDOC ## GetAsync ### Description Gets the latest data point from a time series. This method is asynchronous. ### Method Not applicable (asynchronous SDK method) ### Endpoint Not applicable (asynchronous SDK method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response Returns the latest TimeSeries tuple, or null if the series is empty. #### Response Example { "timestamp": 1678886460000, "value": 11.2 } ``` -------------------------------- ### Format Code Source: https://github.com/redis/nredisstack/blob/master/CONTRIBUTING.md Run this command to format your code according to project standards. This ensures consistency across the codebase. ```bash dotnet format ``` -------------------------------- ### Search All Hashes in the Index Source: https://github.com/redis/nredisstack/blob/master/Examples/HsetAndSearch.md Performs a search for all hashes within the 'example_index' without applying any additional filters. ```csharp var noFilters = ft.Search("example_index", new Query()); ``` -------------------------------- ### GetAsync Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Get and deserialize a JSON value at the specified path into a C# object. ```APIDOC ## GetAsync ### Description Get the JSON value at the specified path and deserialize it into a C# object of type T. ### Method `GetAsync(RedisKey key, string path = "$", JsonSerializerOptions? serializerOptions = null)` ### Parameters #### Path Parameters - **key** (RedisKey) - The key of the JSON document. - **path** (string) - JSON path to the value. Defaults to the root "$". - **serializerOptions** (JsonSerializerOptions?) - Optional options for JSON serialization. ### Response #### Success Response (200) - **T?** - The deserialized object of type T, or null if not found. ``` -------------------------------- ### GetAsync (multiple paths) Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Get JSON values at multiple specified paths. ```APIDOC ## GetAsync (multiple paths) ### Description Get JSON values at multiple specified paths from a JSON document. Allows for pretty-printing the output. ### Method `GetAsync(RedisKey key, string[] paths, RedisValue? indent = null, RedisValue? newLine = null, RedisValue? space = null)` ### Parameters #### Path Parameters - **key** (RedisKey) - The key of the JSON document. - **paths** (string[]) - An array of JSON paths to retrieve values from. - **indent** (RedisValue?) - Optional indentation string for pretty-printing. - **newLine** (RedisValue?) - Optional newline string for pretty-printing. - **space** (RedisValue?) - Optional space string for pretty-printing. ### Response #### Success Response (200) - **RedisResult** - A RedisResult containing the JSON values at the specified paths. ``` -------------------------------- ### Explain Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Explains the query plan for a given Redisearch query. ```APIDOC ## Explain ### Description Explains the query plan for a given Redisearch query. ### Method `Explain` ### Parameters - **indexName** (string!) - The name of the index. - **query** (string!) - The query string. - **dialect** (int?) - Optional. The query dialect to use. ### Returns - string! ``` -------------------------------- ### Query Construction and Options Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt This section covers the core methods for building a search query, including initializing the query, specifying return fields, and setting various options to refine the search. ```APIDOC ## NRedisStack.Search.Query ### Description Provides methods to construct and configure search queries for Redis. ### Methods #### Query(string queryString) Initializes a new query with the given query string. #### ReturnFields(params Field[] fields) Specifies the fields to be returned in the search results. #### ReturnFields(params string[] fields) Specifies the fields to be returned in the search results using string names. #### SetExpander(string field) Sets an expander for the query. #### SetInOrder() Enables in-order processing for the query. #### SetLanguage(string language) Sets the language for the query. #### SetNoContent(bool value = true) Disables returning document content in the results. #### SetNoStopwords(bool value = true) Disables stopword filtering for the query. #### SetPayload(string payload) Sets a payload for the query. #### SetScorer(string scorer) Sets a custom scorer for the query. #### SetSortBy(string field, bool? ascending = null) Specifies a field to sort the results by. #### SetVerbatim(bool value = true) Enables verbatim mode for the query. #### SetWithPayloads() Includes payloads in the search results. #### SetWithScores(bool value = true) Includes scores in the search results. #### Slop(int slop) Sets the slop value for fuzzy matching. #### SummarizeFields(int contextLen, int fragmentCount, string? separator, params string[] fields) Configures summarization of specified fields with context length, fragment count, and separator. #### SummarizeFields(params string[] fields) Configures summarization of specified fields. #### Timeout(long timeout) Sets a timeout for the query execution. ### Properties #### Scorer Gets or sets the scorer for the query. #### SortAscending Gets or sets whether the sort order is ascending. #### SortBy Gets or sets the field to sort by. #### Verbatim Gets or sets whether verbatim mode is enabled. #### WithPayloads Gets or sets whether payloads are included. #### WithScores Gets or sets whether scores are included. ``` -------------------------------- ### GetEnumerableAsync Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Get a JSON array at the specified path and deserialize its elements into C# objects. ```APIDOC ## GetEnumerableAsync ### Description Get a JSON array at the specified path and deserialize its elements into an enumerable collection of C# objects of type T. ### Method `GetEnumerableAsync(RedisKey key, string path = "$")` ### Parameters #### Path Parameters - **key** (RedisKey) - The key of the JSON document. - **path** (string) - JSON path to the array. Defaults to the root "$". ### Response #### Success Response (200) - **IEnumerable** - An enumerable collection of deserialized objects of type T. ``` -------------------------------- ### CmsCommands - InitByDim Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Initializes a Count-Min Sketch with the specified width and depth. ```APIDOC ## CmsCommands.InitByDim ### Description Initializes a Count-Min Sketch with the specified width and depth. ### Method `NRedisStack.CmsCommands.InitByDim(StackExchange.Redis.RedisKey key, long width, long depth) -> bool` ``` -------------------------------- ### ExplainAsync Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Returns the query plan for a given search query on a specific index. ```APIDOC ## ExplainAsync ### Description Returns the query plan for a given search query executed against a specific index. This is useful for understanding how the query will be processed. ### Method `ExplainAsync` ### Parameters - **indexName** (string) - Required - The name of the search index. - **query** (string) - Required - The search query string. - **dialect** (int?) - Optional - The query dialect version to use. ### Returns - Task - A task that represents the asynchronous operation, containing the query plan as a string. ``` -------------------------------- ### Run Local Redis Stack Server Source: https://github.com/redis/nredisstack/blob/master/CONTRIBUTING.md Use this command to run a local Redis Stack server instance for testing purposes. Ensure the port is exposed. ```bash docker run -p 6379:6379 -it redis/redis-stack-server:edge ``` -------------------------------- ### Get TimeSeries Database Reference Source: https://github.com/redis/nredisstack/blob/master/Examples/PipelineWithAsync.md Obtains a specific reference for TimeSeries commands from the Redis database. ```csharp var ts = db.TS(); ``` -------------------------------- ### Configure Index Creation Parameters Source: https://github.com/redis/nredisstack/blob/master/Examples/HsetAndSearch.md Sets parameters for index creation, including filtering by age greater than 16 and applying prefixes 'student:' or 'pupil:'. ```csharp var parameters = FTCreateParams.CreateParams().Filter("@age>16").Prefix("student:", "pupil:"); ``` -------------------------------- ### Connect to Redis Server Source: https://github.com/redis/nredisstack/blob/master/Examples/CombinationModulesPipeline.md Establishes a connection to the Redis server using ConnectionMultiplexer. ```csharp var redis = ConnectionMultiplexer.Connect("localhost"); ``` -------------------------------- ### Sample JSON Data Set Source: https://github.com/redis/nredisstack/blob/master/Examples/AdvancedJsonExamples.md This is the sample JSON data used for the array filtering examples. ```JSON { "city": "Boston", "location": "42.361145, -71.057083", "inventory": [ { "id": 15970, "gender": "Men", "season":["Fall", "Winter"], "description": "Turtle Check Men Navy Blue Shirt", "price": 34.95 }, { "id": 59263, "gender": "Women", "season": ["Fall", "Winter", "Spring", "Summer"], "description": "Titan Women Silver Watch", "price": 129.99 }, { "id": 46885, "gender": "Boys", "season": ["Fall"], "description": "Ben 10 Boys Navy Blue Slippers", "price": 45.99 } ] } ``` -------------------------------- ### Import necessary namespaces Source: https://github.com/redis/nredisstack/blob/master/Examples/GeoShapeQueryExample.md Include these namespaces for Redis, RediSearch, and NetTopologySuite functionalities. ```csharp using StackExchange.Redis; using NRedisStack.RedisStackCommands; using NRedisStack.Search; using NetTopologySuite.Geometries; using NetTopologySuite.IO; ``` -------------------------------- ### Array Manipulation Commands Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Commands for manipulating JSON arrays, including appending, inserting, trimming, and getting array length. ```APIDOC ## ArrAppend ### Description Appends JSON values to an array stored at a given path. ### Method `ArrAppend(RedisKey key, string? path = null, params object[] values)` ### Parameters - **key** (RedisKey) - The key of the JSON document. - **path** (string, optional) - The JSON path to the array. - **values** (object[]) - The JSON values to append. ### Return Value `long?[]` - An array of longs indicating the new length of the arrays after appending. ``` ```APIDOC ## ArrIndex ### Description Returns the index of the first occurrence of a specified value within a JSON array. ### Method `ArrIndex(RedisKey key, string path, object value, long? start = null, long? stop = null)` ### Parameters - **key** (RedisKey) - The key of the JSON document. - **path** (string) - The JSON path to the array. - **value** (object) - The value to search for. - **start** (long?, optional) - The start index for the search. - **stop** (long?, optional) - The stop index for the search. ### Return Value `long?[]` - An array of longs representing the indices of the found values. ``` ```APIDOC ## ArrInsert ### Description Inserts JSON values into an array at a specified index. ### Method `ArrInsert(RedisKey key, string path, long index, params object[] values)` ### Parameters - **key** (RedisKey) - The key of the JSON document. - **path** (string) - The JSON path to the array. - **index** (long) - The index at which to insert the values. - **values** (object[]) - The JSON values to insert. ### Return Value `long?[]` - An array of longs indicating the new length of the arrays after insertion. ``` ```APIDOC ## ArrLen ### Description Returns the length of a JSON array at a specified path. ### Method `ArrLen(RedisKey key, string? path = null)` ### Parameters - **key** (RedisKey) - The key of the JSON document. - **path** (string, optional) - The JSON path to the array. ### Return Value `long?[]` - An array of longs representing the lengths of the arrays. ``` ```APIDOC ## ArrPop ### Description Removes and returns a JSON value from an array at a specified index. ### Method `ArrPop(RedisKey key, string? path = null, long? index = null)` ### Parameters - **key** (RedisKey) - The key of the JSON document. - **path** (string, optional) - The JSON path to the array. - **index** (long?, optional) - The index of the element to remove. If null, the last element is removed. ### Return Value `RedisResult[]` - An array of RedisResults representing the removed values. ``` ```APIDOC ## ArrTrim ### Description Trims a JSON array to a specified range of elements. ### Method `ArrTrim(RedisKey key, string path, long start, long stop)` ### Parameters - **key** (RedisKey) - The key of the JSON document. - **path** (string) - The JSON path to the array. - **start** (long) - The starting index of the range (inclusive). - **stop** (long) - The ending index of the range (inclusive). ### Return Value `long?[]` - An array of longs indicating the new length of the arrays after trimming. ``` -------------------------------- ### Instantiate Redis Module Commands Source: https://github.com/redis/nredisstack/blob/master/README.md Obtain command objects for various NRedisStack modules from an existing IDatabase instance. ```csharp BloomCommands bf = db.BF(); CuckooCommands cf = db.CF(); CmsCommands cms = db.CMS(); TopKCommands topk = db.TOPK(); TdigestCommands tdigest = db.TDIGEST(); SearchCommands ft = db.FT(); JsonCommands json = db.JSON(); TimeSeriesCommands ts = db.TS(); ``` -------------------------------- ### FTCreateParams Methods Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Configuration object for creating a new Redis Search index. ```APIDOC ## FTCreateParams Methods ### Description Used to configure the parameters when creating a new Redis Search index. It provides methods to set various options such as prefixes, filters, language, and indexing behavior. ### Constructors - **FTCreateParams()** ### Methods - **AddParams(List args)**: `void` - Adds custom parameters to the index creation. - **AddPrefix(string prefix)**: `FTCreateParams` - Adds a prefix to the index. - **Filter(string filter)**: `FTCreateParams` - Adds a filter to the index. - **Language(string defaultLanguage)**: `FTCreateParams` - Sets the default language for the index. - **LanguageField(string languageAttribute)**: `FTCreateParams` - Specifies a field that contains the language for each document. - **MaxTextFields()**: `FTCreateParams` - Configures the index to handle maximum text fields. - **NoFields()**: `FTCreateParams` - Disables field storage in the index. - **NoFreq()**: `FTCreateParams` - Disables frequency information storage. - **NoHighlights()**: `FTCreateParams` - Disables highlighting in search results. - **NoHL()**: `FTCreateParams` - Alias for `NoHighlights()`. - **NoOffsets()**: `FTCreateParams` - Disables offset storage for terms. - **NoStopwords()**: `FTCreateParams` - Disables the use of stopwords. - **On(IndexDataType dataType)**: `FTCreateParams` - Specifies the data type for the index. ``` -------------------------------- ### Get Latest or Specific Data Point Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Retrieves the latest data point or a specific data point from a time series key. ```APIDOC ## Get ### Description Retrieves the latest data point or a specific data point from a time series. ### Method `ITimeSeriesCommands.Get` ### Parameters - **key** (string!) - The key of the time series. - **latest** (bool) - If true, retrieves the latest data point (default is false). ### Returns - **TimeSeriesTuple?** - The retrieved data point, or null if not found. ``` -------------------------------- ### ExplainCli Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Explains the query plan for a given Redisearch query, suitable for CLI output. ```APIDOC ## ExplainCli ### Description Explains the query plan for a given Redisearch query, suitable for CLI output. ### Method `ExplainCli` ### Parameters - **indexName** (string!) - The name of the index. - **query** (string!) - The query string. - **dialect** (int?) - Optional. The query dialect to use. ### Returns - StackExchange.Redis.RedisResult![]! ``` -------------------------------- ### SearchCommandBuilder ExplainCli Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Explains a search query for CLI. ```APIDOC ## SearchCommandBuilder ExplainCli ### Description Explains a search query for use with the Redis CLI. ### Method Signature `static NRedisStack.SearchCommandBuilder.ExplainCli(string! indexName, string! query, int? dialect) -> NRedisStack.RedisStackCommands.SerializedCommand!` ### Parameters * **indexName** (string!) - The name of the index. * **query** (string!) - The search query string. * **dialect** (int?) - Optional. The dialect version to use for the query. ``` -------------------------------- ### XReadAsync Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Reads entries from a stream key, starting from a specified position. Allows limiting the number of entries and setting a timeout for the operation. ```APIDOC ## XReadAsync ### Description Reads entries from a stream key starting from a specified position. Allows limiting the number of entries and setting a timeout. ### Method `XReadAsync` ### Parameters - **db** (StackExchange.Redis.IDatabase) - The database instance. - **key** (StackExchange.Redis.RedisKey) - The key of the stream to read from. - **position** (StackExchange.Redis.RedisValue) - The position to start reading from. - **count** (int?) - Optional. The maximum number of entries to return. - **timeoutMilliseconds** (int?) - Optional. The maximum time to wait for entries in milliseconds. ``` -------------------------------- ### Prefix Search in NRedisStack Source: https://github.com/redis/nredisstack/blob/master/Examples/BasicQueryOperations.md Find documents where a field value starts with a specific prefix. Use this for auto-completion or filtering by beginnings of words. ```csharp foreach (var doc in ft.Search("idx1", new Query("@description:Nav*")) .ToJson()) { Console.WriteLine(doc); } ``` -------------------------------- ### Run Tests Source: https://github.com/redis/nredisstack/blob/master/CONTRIBUTING.md Execute this command to run all project tests. Ensure your code changes pass all tests before submitting a pull request. ```bash dotnet test ``` -------------------------------- ### Get Updated Total Amounts Source: https://github.com/redis/nredisstack/blob/master/Examples/TransactionsExample.md Retrieves the updated 'totalAmount' for both Jeeva and Shachar after the debit and credit operations. Note the specific path to the field. ```cs var totalAmtOfJeeva = tran.Json.GetAsync("accdetails:Jeeva", path:"$.totalAmount"); var totalAmtOfShachar = tran.Json.GetAsync("accdetails:Shachar", path:"$.totalAmount"); ``` -------------------------------- ### Create Search Index in Pipeline Source: https://github.com/redis/nredisstack/blob/master/Examples/CombinationModulesPipeline.md Adds the FT.CREATE command to the pipeline to create a search index on JSON data. ```csharp pipeline.Ft.CreateAsync("person-idx", parameters, schema); ``` -------------------------------- ### Create (with parameters) Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Creates a new TimeSeries using specified parameters. ```APIDOC ## Create ### Description Creates a new TimeSeries. This overload uses a `TsCreateParams` object for defining the series properties. ### Method Signature static NRedisStack.TimeSeriesCommandsBuilder.Create(string! key, NRedisStack.TsCreateParams! parameters) -> NRedisStack.RedisStackCommands.SerializedCommand! ``` -------------------------------- ### Delete Single Item from JSON Array Source: https://github.com/redis/nredisstack/blob/master/Examples/BasicJsonExamples.md Deletes a specific item from a JSON array by its index. This example removes the first element from an array. ```csharp json.Set("ex4:4", "$", new { arr1 = new[] {"val1", "val2", "val3"} }); json.Del("ex4:4", "$.arr1[0]"); Console.WriteLine(json.Get(key: "ex4:4", indent: "\t", newLine: "\n" )); ``` -------------------------------- ### Get Time Series Information Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Retrieves detailed information about a time series key, including its properties and statistics. Can optionally include debug information. ```APIDOC ## Info ### Description Retrieves information about a time series. ### Method `ITimeSeriesCommands.Info` ### Parameters - **key** (string!) - The key of the time series. - **debug** (bool) - If true, includes debug information (default is false). ### Returns - **TimeSeriesInformation!** - An object containing the time series information. ``` -------------------------------- ### Delete Single Property from JSON Object Source: https://github.com/redis/nredisstack/blob/master/Examples/BasicJsonExamples.md Deletes a specific property from a JSON object. This example sets an object with two fields and then deletes one of them. ```csharp json.Set("ex4:2", "$", new { field1 = "val1", field2 = "val2" }); json.Del("ex4:2", "$.field1"); Console.WriteLine(json.Get(key: "ex4:2", indent: "\t", newLine: "\n" )); ``` -------------------------------- ### Create Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Creates a new Redisearch index. ```APIDOC ## Create ### Description Creates a new Redisearch index. ### Method `Create` ### Parameters - **indexName** (string!) - The name of the index to create. - **parameters** (NRedisStack.Search.FTCreateParams!) - Parameters for creating the index. - **schema** (NRedisStack.Search.Schema!) - The schema definition for the index. ### Returns - bool ``` -------------------------------- ### Clear JSON Field in Pipeline Source: https://github.com/redis/nredisstack/blob/master/Examples/PipelineExample.md Removes a specific field from a JSON object within the pipeline using Json.ClearAsync. This example clears the 'nicknames' array. ```csharp pipeline.Json.ClearAsync("person", "$.nicknames"); ``` -------------------------------- ### Create Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Creates a new search index. ```APIDOC ## Create Creates a new search index. ### Method `CREATE` ### Endpoint `/search/create/{indexName}` ### Parameters #### Path Parameters - **indexName** (string) - Required - The name of the index to create. #### Request Body - **parameters** (FTCreateParams) - Optional - Parameters for creating the index. - **schema** (Schema) - Required - The schema for the index. ### Response #### Success Response (200) - **bool** - True if the index was created successfully, false otherwise. ``` -------------------------------- ### Regex Search for Begins With in JSON Array Source: https://github.com/redis/nredisstack/blob/master/Examples/AdvancedJsonExamples.md Fetches items from a JSON array where a string field starts with a specified expression, using a regex pattern. ```csharp Console.WriteLine(json.Get(key: "warehouse:1", path: "$.inventory[?(@.description =~ "^T")]", indent: "\t", newLine: "\n" )); ``` -------------------------------- ### Create (direct values) Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Creates a new TimeSeries with direct configuration values. ```APIDOC ## Create ### Description Creates a new TimeSeries key with optional parameters like retention time, labels, chunk size, and duplicate policy. ### Method Signature static NRedisStack.TimeSeriesCommandsBuilder.Create(string! key, long? retentionTime = null, System.Collections.Generic.IReadOnlyCollection? labels = null, bool? uncompressed = null, long? chunkSizeBytes = null, NRedisStack.Literals.Enums.TsDuplicatePolicy? duplicatePolicy = null) -> NRedisStack.RedisStackCommands.SerializedCommand! ``` -------------------------------- ### Search Hashes with First Name Starting with 'Jo' Source: https://github.com/redis/nredisstack/blob/master/Examples/HsetAndSearch.md Searches the index for hashes where the 'first' name field begins with 'Jo'. This demonstrates prefix matching. ```csharp var startWithJo = ft.Search("example_index", new Query("@first:Jo*")); ``` -------------------------------- ### Search JSON for Specific Genders Source: https://github.com/redis/nredisstack/blob/master/Examples/AdvancedQueryOperations.md Retrieves all inventory items in Dallas that are for 'Women' or 'Girls'. This example demonstrates filtering by multiple conditions using OR logic within JSONPath. ```csharp foreach (var doc in ft.Search("wh_idx", new Query("@city:(Dallas)") .ReturnFields(new FieldName("$.inventory[?(@.gender=="Women" || @.gender=="Girls")]", "result")) .Dialect(3)) .Documents.Select(x => x["result"])) { Console.WriteLine(doc); } ``` -------------------------------- ### Create a Redis Search Index Source: https://github.com/redis/nredisstack/blob/master/README.md Define and create a search index on HASH data types with specified fields and weights. Documents with the 'doc:' prefix will be automatically indexed. ```csharp // FT.CREATE myIdx ON HASH PREFIX 1 doc: SCHEMA title TEXT WEIGHT 5.0 body TEXT url TEXT ft.Create("myIndex", new FTCreateParams().On(IndexDataType.HASH) .Prefix("doc:"), new Schema().AddTextField("title", 5.0) .AddTextField("body") .AddTextField("url")); ``` -------------------------------- ### Update Nested Property in JSON Object Source: https://github.com/redis/nredisstack/blob/master/Examples/BasicJsonExamples.md Use this example to update a property within a nested JSON object. The path specifies the nested location of the property to be modified. ```csharp json.Set("ex3:3", "$", new { obj1 = new { str1 = "val1", num2 = 2 } }); json.Set("ex3:3", "$.obj1.num2", 3); Console.WriteLine(json.Get(key: "ex3:3", indent: "\t", newLine: "\n" )); ``` -------------------------------- ### Explain Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Explains a search query. ```APIDOC ## Explain Explains a search query. ### Method `EXPLAIN` ### Endpoint `/search/explain/{indexName}` ### Parameters #### Path Parameters - **indexName** (string) - Required - The name of the index. #### Query Parameters - **query** (string) - Required - The query to explain. - **dialect** (int) - Optional - The dialect version. ### Response #### Success Response (200) - **string** - A string explaining the query. ``` -------------------------------- ### CreateAsync Source: https://github.com/redis/nredisstack/blob/master/src/NRedisStack/PublicAPI/PublicAPI.Shipped.txt Asynchronously creates a new Redis Search index with specified parameters and schema. ```APIDOC ## CreateAsync ### Description Asynchronously creates a new Redis Search index with specified parameters and schema. ### Method NRedisStack.SearchCommandsAsync.CreateAsync ### Parameters #### Path Parameters - **indexName** (string) - Required - The name of the index to create. - **parameters** (NRedisStack.Search.FTCreateParams) - Required - The parameters for creating the index. - **schema** (NRedisStack.Search.Schema) - Required - The schema for the index. ### Response #### Success Response - **Task** - A task that represents the asynchronous operation, returning true if the index was created successfully. ```