-
-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates various places to reduce the need to acquire a searcher/reade…
…r which causes overhead for each search, lots of TODOs and WIPs
- Loading branch information
Showing
13 changed files
with
234 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Lucene.Net.Analysis; | ||
using Lucene.Net.Analysis.Standard; | ||
using Lucene.Net.Index; | ||
|
||
namespace Examine.Lucene | ||
{ | ||
|
||
public class LuceneIndexOptions : IndexOptions | ||
{ | ||
public bool NrtEnabled { get; set; } = true; | ||
Check warning on line 10 in src/Examine.Lucene/LuceneIndexOptions.cs GitHub Actions / build
Check warning on line 10 in src/Examine.Lucene/LuceneIndexOptions.cs GitHub Actions / build
|
||
|
||
public double NrtTargetMaxStaleSec { get; set; } = 5.0; | ||
|
||
public double NrtTargetMinStaleSec { get; set; } = 1.0; | ||
|
||
public IndexDeletionPolicy IndexDeletionPolicy { get; set; } | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
Examine.Lucene.Directories.SyncedFileSystemDirectoryFactory.SyncedFileSystemDirectoryFactory(System.IO.DirectoryInfo localDir, System.IO.DirectoryInfo mainDir, Examine.Lucene.Directories.ILockFactory lockFactory, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, bool tryFixMainIndexIfCorrupt) -> void | ||
Examine.Lucene.LuceneIndexOptions.NrtTargetMaxStaleSec.get -> double | ||
Examine.Lucene.LuceneIndexOptions.NrtTargetMaxStaleSec.set -> void | ||
Examine.Lucene.LuceneIndexOptions.NrtTargetMinStaleSec.get -> double | ||
Examine.Lucene.LuceneIndexOptions.NrtTargetMinStaleSec.set -> void | ||
virtual Examine.Lucene.Providers.LuceneIndex.UpdateLuceneDocument(Lucene.Net.Index.Term term, Lucene.Net.Documents.Document doc) -> long? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,49 +3,43 @@ | |
|
||
namespace Examine.Lucene.Search | ||
{ | ||
public class SearcherReference : ISearcherReference | ||
// TODO: struct | ||
public readonly struct SearcherReference : ISearcherReference | ||
Check warning on line 7 in src/Examine.Lucene/Search/SearcherReference.cs GitHub Actions / build
|
||
{ | ||
private bool _disposedValue; | ||
//private bool _disposedValue; | ||
private readonly SearcherManager _searcherManager; | ||
private IndexSearcher _searcher; | ||
private readonly IndexSearcher _searcher; | ||
|
||
public SearcherReference(SearcherManager searcherManager) | ||
{ | ||
_searcherManager = searcherManager; | ||
_searcher = _searcherManager.Acquire(); | ||
} | ||
|
||
public IndexSearcher IndexSearcher | ||
{ | ||
get | ||
{ | ||
if (_disposedValue) | ||
{ | ||
throw new ObjectDisposedException($"{nameof(SearcherReference)} is disposed"); | ||
} | ||
return _searcher ?? (_searcher = _searcherManager.Acquire()); | ||
} | ||
} | ||
|
||
protected virtual void Dispose(bool disposing) | ||
{ | ||
if (!_disposedValue) | ||
{ | ||
if (disposing) | ||
{ | ||
if (_searcher != null) | ||
{ | ||
_searcherManager.Release(_searcher); | ||
} | ||
} | ||
//if (_disposedValue) | ||
//{ | ||
// throw new ObjectDisposedException($"{nameof(SearcherReference)} is disposed"); | ||
//} | ||
|
||
_disposedValue = true; | ||
//return _searcher ??= _searcherManager.Acquire(); | ||
return _searcher; | ||
} | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method | ||
Dispose(disposing: true); | ||
//if (!_disposedValue) | ||
//{ | ||
//if (_searcher != null) | ||
//{ | ||
_searcherManager.Release(_searcher); | ||
//} | ||
// _disposedValue = true; | ||
//} | ||
} | ||
} | ||
} |
Oops, something went wrong.