From bcf286b2c75e3fbee335a5f07a7ce8061b6e9a72 Mon Sep 17 00:00:00 2001 From: Drew Scoggins Date: Fri, 1 Dec 2023 14:03:07 -0800 Subject: [PATCH 1/7] Add full type name for Lucene lock type In net9.0 the runtime now exposes it's own `Lock` type, https://github.com/dotnet/runtime/pull/87672. This causes a build break as there is a collision between the Lucene type and the runtime type. --- .../OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs index 13b7cb8fcee..d66b4be9ca9 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs @@ -395,7 +395,7 @@ private async Task WriteAsync(string indexName, Action action, bool var config = new IndexWriterConfig(LuceneSettings.DefaultVersion, analyzer) { OpenMode = OpenMode.CREATE_OR_APPEND, - WriteLockTimeout = Lock.LOCK_POLL_INTERVAL * 3 + WriteLockTimeout = Lucene.Net.Store.Lock.LOCK_POLL_INTERVAL * 3 }; writer = new IndexWriterWrapper(directory, config); From 79d4f999f956bbd6c9ada6d09ea7cbecf352c97e Mon Sep 17 00:00:00 2001 From: Drew Scoggins Date: Fri, 1 Dec 2023 14:19:44 -0800 Subject: [PATCH 2/7] Fix namespace collision errors --- .../Services/LuceneIndexManager.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs index d66b4be9ca9..22220180478 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs @@ -11,7 +11,7 @@ using Lucene.Net.Search; using Lucene.Net.Spatial.Prefix; using Lucene.Net.Spatial.Prefix.Tree; -using Lucene.Net.Store; +using LStore = Lucene.Net.Store; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using OrchardCore.Contents.Indexing; @@ -362,7 +362,7 @@ private Document CreateLuceneDocument(DocumentIndex documentIndex, LuceneIndexSe return doc; } - private BaseDirectory CreateDirectory(string indexName) + private LStore.BaseDirectory CreateDirectory(string indexName) { lock (this) { @@ -376,7 +376,7 @@ private BaseDirectory CreateDirectory(string indexName) // Lucene is not thread safe on this call. lock (_synLock) { - return FSDirectory.Open(path); + return LStore.FSDirectory.Open(path); } } } @@ -395,7 +395,7 @@ private async Task WriteAsync(string indexName, Action action, bool var config = new IndexWriterConfig(LuceneSettings.DefaultVersion, analyzer) { OpenMode = OpenMode.CREATE_OR_APPEND, - WriteLockTimeout = Lucene.Net.Store.Lock.LOCK_POLL_INTERVAL * 3 + WriteLockTimeout = LStore.Lock.LOCK_POLL_INTERVAL * 3 }; writer = new IndexWriterWrapper(directory, config); @@ -428,7 +428,7 @@ private IndexReaderPool.IndexReaderLease GetReader(string indexName) var pool = _indexPools.GetOrAdd(indexName, n => { var path = new DirectoryInfo(PathExtensions.Combine(_rootPath, indexName)); - var reader = DirectoryReader.Open(FSDirectory.Open(path)); + var reader = DirectoryReader.Open(LStore.FSDirectory.Open(path)); return new IndexReaderPool(reader); }); From 0fefe272cfc7ba5285436a862c14a6a8ec3100df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Ros?= Date: Tue, 19 Dec 2023 11:38:51 -0800 Subject: [PATCH 3/7] Update src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs Co-authored-by: Hisham Bin Ateya --- .../OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs index 22220180478..b39e8281eaf 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs @@ -362,7 +362,7 @@ private Document CreateLuceneDocument(DocumentIndex documentIndex, LuceneIndexSe return doc; } - private LStore.BaseDirectory CreateDirectory(string indexName) + private BaseDirectory CreateDirectory(string indexName) { lock (this) { From 0f04aabd7747de9117b7478981c6e9f6694bdab3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Ros?= Date: Tue, 19 Dec 2023 11:38:57 -0800 Subject: [PATCH 4/7] Update src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs Co-authored-by: Hisham Bin Ateya --- .../OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs index b39e8281eaf..e83c7a16c91 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs @@ -11,7 +11,8 @@ using Lucene.Net.Search; using Lucene.Net.Spatial.Prefix; using Lucene.Net.Spatial.Prefix.Tree; -using LStore = Lucene.Net.Store; +using Lucene.Net.Store; +using LuceneLock = Lucene.Net.Store.Lock; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using OrchardCore.Contents.Indexing; From 3b9102d807405e7086957e27b49ac9798bb3febd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Ros?= Date: Tue, 19 Dec 2023 11:39:02 -0800 Subject: [PATCH 5/7] Update src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs Co-authored-by: Hisham Bin Ateya --- .../OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs index e83c7a16c91..eb37dd650d2 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs @@ -377,7 +377,7 @@ private BaseDirectory CreateDirectory(string indexName) // Lucene is not thread safe on this call. lock (_synLock) { - return LStore.FSDirectory.Open(path); + return FSDirectory.Open(path); } } } From bba70751aa8eb9fa87a46089e303729c308323ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Ros?= Date: Tue, 19 Dec 2023 11:39:08 -0800 Subject: [PATCH 6/7] Update src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs Co-authored-by: Hisham Bin Ateya --- .../OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs index eb37dd650d2..f151682291e 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs @@ -396,7 +396,7 @@ private async Task WriteAsync(string indexName, Action action, bool var config = new IndexWriterConfig(LuceneSettings.DefaultVersion, analyzer) { OpenMode = OpenMode.CREATE_OR_APPEND, - WriteLockTimeout = LStore.Lock.LOCK_POLL_INTERVAL * 3 + WriteLockTimeout = LuceneLock.LOCK_POLL_INTERVAL * 3 }; writer = new IndexWriterWrapper(directory, config); From e83982d27145b383e4e0d271aa9c7a2eef99c6d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Ros?= Date: Tue, 19 Dec 2023 11:39:13 -0800 Subject: [PATCH 7/7] Update src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs Co-authored-by: Hisham Bin Ateya --- .../OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs index f151682291e..fac25709bf3 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs @@ -429,7 +429,7 @@ private IndexReaderPool.IndexReaderLease GetReader(string indexName) var pool = _indexPools.GetOrAdd(indexName, n => { var path = new DirectoryInfo(PathExtensions.Combine(_rootPath, indexName)); - var reader = DirectoryReader.Open(LStore.FSDirectory.Open(path)); + var reader = DirectoryReader.Open(FSDirectory.Open(path)); return new IndexReaderPool(reader); });