From f82ae8cbf7eba5ba4b7f548f270dae20c5ac3422 Mon Sep 17 00:00:00 2001 From: Jakub Syty Date: Mon, 18 Dec 2023 14:04:45 +0100 Subject: [PATCH 1/2] Fix docs for synchronous index building --- docs/v2/articles/indexing.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/v2/articles/indexing.md b/docs/v2/articles/indexing.md index 94632837..42043055 100644 --- a/docs/v2/articles/indexing.md +++ b/docs/v2/articles/indexing.md @@ -116,9 +116,10 @@ myIndex.IndexItem(new ValueSet( Be default all indexing is done asynchronously. If you need to run indexing synchronously you should create a synchronous scope. This is for instance a necessary step for unit tests. ```cs -using (myIndex.ProcessNonAsync()) +using (var luceneIndex = (myIndex as LuceneIndex)) +using (var syncIndexContext = luceneIndex.WithThreadingMode(IndexThreadingMode.Synchronous)) { - myIndex.IndexItem(new ValueSet( + luceneIndex.IndexItem(new ValueSet( "SKU987", "Product", new Dictionary() From c5a0403b1030098c9466ba84a901c1c2ab4ed2f1 Mon Sep 17 00:00:00 2001 From: Jakub Syty Date: Mon, 18 Dec 2023 19:32:15 +0100 Subject: [PATCH 2/2] Update indexing.md --- docs/v2/articles/indexing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/v2/articles/indexing.md b/docs/v2/articles/indexing.md index 42043055..34ee2dad 100644 --- a/docs/v2/articles/indexing.md +++ b/docs/v2/articles/indexing.md @@ -116,7 +116,7 @@ myIndex.IndexItem(new ValueSet( Be default all indexing is done asynchronously. If you need to run indexing synchronously you should create a synchronous scope. This is for instance a necessary step for unit tests. ```cs -using (var luceneIndex = (myIndex as LuceneIndex)) +using (var luceneIndex = (LuceneIndex)myIndex) using (var syncIndexContext = luceneIndex.WithThreadingMode(IndexThreadingMode.Synchronous)) { luceneIndex.IndexItem(new ValueSet( @@ -253,4 +253,4 @@ private void IndexCommited(object sender, EventArgs e) { // Triggered when the index is commited } -``` \ No newline at end of file +```