lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject lucenenet git commit: .NETification of SearcherManager
Date Sat, 23 Apr 2016 23:21:31 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/master b6c703d93 -> 176d2c058


.NETification of SearcherManager


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/176d2c05
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/176d2c05
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/176d2c05

Branch: refs/heads/master
Commit: 176d2c05895ab26a594a85b2f2665c91b0ef8237
Parents: b6c703d
Author: Itamar Syn-Hershko <itamar@code972.com>
Authored: Sun Apr 24 02:20:40 2016 +0300
Committer: Itamar Syn-Hershko <itamar@code972.com>
Committed: Sun Apr 24 02:20:40 2016 +0300

----------------------------------------------------------------------
 src/Lucene.Net.Core/Search/SearcherFactory.cs |  2 ++
 src/Lucene.Net.Core/Search/SearcherManager.cs | 18 ++++++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/176d2c05/src/Lucene.Net.Core/Search/SearcherFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/SearcherFactory.cs b/src/Lucene.Net.Core/Search/SearcherFactory.cs
index e8f2bb4..fcd28e0 100644
--- a/src/Lucene.Net.Core/Search/SearcherFactory.cs
+++ b/src/Lucene.Net.Core/Search/SearcherFactory.cs
@@ -1,3 +1,5 @@
+using Lucene.Net.Index;
+
 namespace Lucene.Net.Search
 {
     /*

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/176d2c05/src/Lucene.Net.Core/Search/SearcherManager.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/SearcherManager.cs b/src/Lucene.Net.Core/Search/SearcherManager.cs
index cc74646..f2eeb4a 100644
--- a/src/Lucene.Net.Core/Search/SearcherManager.cs
+++ b/src/Lucene.Net.Core/Search/SearcherManager.cs
@@ -60,7 +60,7 @@ namespace Lucene.Net.Search
     public sealed class SearcherManager : ReferenceManager<IndexSearcher>
     {
         private readonly SearcherFactory SearcherFactory;
-
+        
         /// <summary>
         /// Creates and returns a new SearcherManager from the given
         /// <seealso cref="IndexWriter"/>.
@@ -82,7 +82,7 @@ namespace Lucene.Net.Search
         ///          custom behavior.
         /// </param>
         /// <exception cref="IOException"> if there is a low-level I/O error </exception>
-        public SearcherManager(IndexWriter writer, bool applyAllDeletes, SearcherFactory
searcherFactory)
+        public SearcherManager(IndexWriter writer, bool applyAllDeletes, SearcherFactory
searcherFactory = null)
         {
             if (searcherFactory == null)
             {
@@ -190,5 +190,19 @@ namespace Lucene.Net.Search
             }
             return searcher;
         }
+
+        public delegate void SearchExecutor(IndexSearcher arg);
+        public void ExecuteSearch(SearchExecutor searchFunc)
+        {
+            var s = Acquire();
+            try
+            {
+                searchFunc(s);
+            }
+            finally
+            {
+                Release(s);
+            }
+        }
     }
 }
\ No newline at end of file


Mime
View raw message