From c8c001684fcec5d0c91ce74768587aabab46b7a1 Mon Sep 17 00:00:00 2001 From: Igor Malinovskiy Date: Wed, 1 Mar 2023 11:18:34 +0100 Subject: [PATCH 1/3] Fix code examples in README - Specify all required dependencies - Add missing db initialization line - Use anonymous type to make JSON example runnable --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a503da24..3ce541d4 100644 --- a/README.md +++ b/README.md @@ -49,8 +49,11 @@ This launches [Redis Stack](https://redis.io/docs/stack/), an extension of Redis Now, you need to connect to Redis, exactly the same way you do it in [StackExchange.Redis](https://github.com/StackExchange/StackExchange.Redis): ```csharp using NRedisStack; -... +using NRedisStack.RedisStackCommands; +using StackExchange.Redis; +//... ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("localhost"); +IDatabase db = redis.GetDatabase(); ``` Now you can create a variable from any type of module in the following way: ```csharp @@ -78,7 +81,7 @@ IDatabase db = redis.GetDatabase(); IJsonCommands json = db.JSON(); var key = "myKey"; -json.Set(key, "$", new Person() { Age = 35, Name = "Alice" }); +json.Set(key, "$", new { Age = 35, Name = "Alice" }); ``` ### Index and search From c6d53aaa59b7c9e009b166c29c9947e936fc45e7 Mon Sep 17 00:00:00 2001 From: Igor Malinovskiy Date: Wed, 1 Mar 2023 11:32:22 +0100 Subject: [PATCH 2/3] Use consistent style for examples in README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3ce541d4..a9645ae5 100644 --- a/README.md +++ b/README.md @@ -90,9 +90,9 @@ Now, to execute a search for objects, we need to index them on the server, and Setup: ```csharp -using NRedisStack; -... -IDatabase db = redisFixture.Redis.GetDatabase(); +ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("localhost"); +IDatabase db = redis.GetDatabase(); + ISearchCommands ft = db.FT(); IJsonCommands json = db.JSON(); ``` From 282f7d230652533cd77b2b2ef1e6c9e18cffa36b Mon Sep 17 00:00:00 2001 From: Igor Malinovskiy Date: Wed, 1 Mar 2023 13:43:29 +0100 Subject: [PATCH 3/3] Fix FT.CREATE example --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a9645ae5..a017e915 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,9 @@ Now, to execute a search for objects, we need to index them on the server, and Setup: ```csharp +using NRedisStack.Search; +using NRedisStack.Search.Literals.Enums; +//... ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("localhost"); IDatabase db = redis.GetDatabase(); @@ -100,7 +103,7 @@ IJsonCommands json = db.JSON(); Create an index with fields and weights: ```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) +ft.Create("myIndex", new FTCreateParams().On(IndexDataType.HASH) .Prefix("doc:"), new Schema().AddTextField("title", 5.0) .AddTextField("body")