diff --git a/src/Examine.Core/Search/FacetLabel.cs b/src/Examine.Core/Search/FacetLabel.cs
index 53275d4c..1723ccc3 100644
--- a/src/Examine.Core/Search/FacetLabel.cs
+++ b/src/Examine.Core/Search/FacetLabel.cs
@@ -1,20 +1,29 @@
using System;
using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Examine.Search
{
+ ///
+ /// Holds a sequence of string components, specifying the hierarchical name of a category.
+ ///
public readonly struct FacetLabel : IFacetLabel
{
private readonly string[] _components;
+ ///
+ /// Constructor
+ ///
+ /// The components of this FacetLabel
public FacetLabel(string[] components)
{
_components = components;
}
+
+ ///
+ /// Constructor
+ ///
+ /// The name of the dimension that stores this FacetLabel
+ /// >The components of this FacetLabel
public FacetLabel(string dimension, string[] components)
{
_components = new string[1 + components.Length];
@@ -22,8 +31,10 @@ public FacetLabel(string dimension, string[] components)
Array.Copy(components, 0, _components, 1, components.Length);
}
+ ///
public string[] Components => _components;
+ ///
public int Length => _components.Length;
// From Lucene.NET
diff --git a/src/Examine.Lucene/Directories/DirectoryFactory.cs b/src/Examine.Lucene/Directories/DirectoryFactory.cs
index 003345aa..c55000ba 100644
--- a/src/Examine.Lucene/Directories/DirectoryFactory.cs
+++ b/src/Examine.Lucene/Directories/DirectoryFactory.cs
@@ -27,6 +27,8 @@ protected override Directory CreateDirectory(LuceneIndex luceneIndex, bool force
}
return dir;
}
+
+ ///
protected override Directory CreateTaxonomyDirectory(LuceneIndex luceneIndex, bool forceUnlock)
{
Directory dir = _taxonomyDirectoryFactory(luceneIndex.Name + "taxonomy");
diff --git a/src/Examine.Lucene/Directories/DirectoryFactoryBase.cs b/src/Examine.Lucene/Directories/DirectoryFactoryBase.cs
index 5cede493..3658d0b2 100644
--- a/src/Examine.Lucene/Directories/DirectoryFactoryBase.cs
+++ b/src/Examine.Lucene/Directories/DirectoryFactoryBase.cs
@@ -23,6 +23,7 @@ Directory IDirectoryFactory.CreateTaxonomyDirectory(LuceneIndex luceneIndex, boo
///
protected abstract Directory CreateDirectory(LuceneIndex luceneIndex, bool forceUnlock);
+ ///
protected abstract Directory CreateTaxonomyDirectory(LuceneIndex luceneIndex, bool forceUnlock);
///
diff --git a/src/Examine.Lucene/Directories/FileSystemDirectoryFactory.cs b/src/Examine.Lucene/Directories/FileSystemDirectoryFactory.cs
index 85c2be05..f1274735 100644
--- a/src/Examine.Lucene/Directories/FileSystemDirectoryFactory.cs
+++ b/src/Examine.Lucene/Directories/FileSystemDirectoryFactory.cs
@@ -36,6 +36,7 @@ protected override Directory CreateDirectory(LuceneIndex luceneIndex, bool force
return dir;
}
+ ///
protected override Directory CreateTaxonomyDirectory(LuceneIndex luceneIndex, bool forceUnlock)
{
var path = Path.Combine(_baseDir.FullName, luceneIndex.Name,"taxonomy");
diff --git a/src/Examine.Lucene/Directories/SyncedTaxonomyFileSystemDirectoryFactory.cs b/src/Examine.Lucene/Directories/SyncedTaxonomyFileSystemDirectoryFactory.cs
index 88d37db6..55a9b377 100644
--- a/src/Examine.Lucene/Directories/SyncedTaxonomyFileSystemDirectoryFactory.cs
+++ b/src/Examine.Lucene/Directories/SyncedTaxonomyFileSystemDirectoryFactory.cs
@@ -24,8 +24,9 @@ public class SyncedTaxonomyFileSystemDirectoryFactory : FileSystemDirectoryFacto
{
private readonly DirectoryInfo _localDir;
private readonly ILoggerFactory _loggerFactory;
- private ExamineTaxonomyReplicator _replicator;
+ private ExamineTaxonomyReplicator? _replicator;
+ ///
public SyncedTaxonomyFileSystemDirectoryFactory(
DirectoryInfo localDir,
DirectoryInfo mainDir,
@@ -37,6 +38,7 @@ public SyncedTaxonomyFileSystemDirectoryFactory(
_loggerFactory = loggerFactory;
}
+ ///
protected override Directory CreateDirectory(LuceneIndex luceneIndex, bool forceUnlock)
{
var luceneTaxonomyIndex = luceneIndex as LuceneIndex;
@@ -98,6 +100,7 @@ protected override Directory CreateDirectory(LuceneIndex luceneIndex, bool force
return localLuceneDir;
}
+ ///
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
diff --git a/src/Examine.Lucene/ExamineTaxonomyReplicator.cs b/src/Examine.Lucene/ExamineTaxonomyReplicator.cs
index f369f7f0..574d118d 100644
--- a/src/Examine.Lucene/ExamineTaxonomyReplicator.cs
+++ b/src/Examine.Lucene/ExamineTaxonomyReplicator.cs
@@ -27,6 +27,14 @@ public class ExamineTaxonomyReplicator : IDisposable
private bool _started = false;
private readonly ILogger _logger;
+ ///
+ /// Constructor
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public ExamineTaxonomyReplicator(
ILoggerFactory loggerFactory,
LuceneIndex sourceIndex,
@@ -99,6 +107,11 @@ public void ReplicateIndex()
_localReplicationClient.UpdateNow();
}
+ ///
+ /// Starts a thread that will replicate the index on a schedule
+ ///
+ /// Interval
+ ///
public void StartIndexReplicationOnSchedule(int milliseconds)
{
lock (_locker)
@@ -140,6 +153,7 @@ private void SourceIndex_IndexCommitted(object sender, EventArgs e)
_replicator.Publish(rev);
}
+ ///
protected virtual void Dispose(bool disposing)
{
if (!_disposedValue)
@@ -154,6 +168,7 @@ protected virtual void Dispose(bool disposing)
}
}
+ ///
public void Dispose()
{
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
diff --git a/src/Examine.Lucene/Providers/BaseLuceneSearcher.cs b/src/Examine.Lucene/Providers/BaseLuceneSearcher.cs
index b6e2b48a..9b313f77 100644
--- a/src/Examine.Lucene/Providers/BaseLuceneSearcher.cs
+++ b/src/Examine.Lucene/Providers/BaseLuceneSearcher.cs
@@ -67,6 +67,7 @@ public override ISearchResults Search(string searchText, QueryOptions? options =
return sc.Execute(options);
}
+ ///
public virtual void Dispose()
{
diff --git a/src/Examine.Lucene/Providers/IIndexCommiter.cs b/src/Examine.Lucene/Providers/IIndexCommiter.cs
index e4721a2c..eae24995 100644
--- a/src/Examine.Lucene/Providers/IIndexCommiter.cs
+++ b/src/Examine.Lucene/Providers/IIndexCommiter.cs
@@ -2,9 +2,19 @@
namespace Examine.Lucene.Providers
{
+ ///
+ /// This queues up a commit for the index so that a commit doesn't happen on every individual write since that is quite expensive
+ ///
public interface IIndexCommiter : IDisposable
{
+ ///
+ /// Commits the index to directory
+ ///
void CommitNow();
+
+ ///
+ /// Schedules the index to be commited to the directory
+ ///
void ScheduleCommit();
}
}
diff --git a/src/Examine.Lucene/Providers/LuceneIndex.cs b/src/Examine.Lucene/Providers/LuceneIndex.cs
index 24d60df4..a41e3310 100644
--- a/src/Examine.Lucene/Providers/LuceneIndex.cs
+++ b/src/Examine.Lucene/Providers/LuceneIndex.cs
@@ -949,11 +949,16 @@ private class IndexCommiter : DisposableObjectSlim, IIndexCommiter
///
private const int MaxWaitMilliseconds = 300000;
+ ///
+ /// Constructor
+ ///
+ /// Index to commit
public IndexCommiter(LuceneIndex index)
{
_index = index;
}
+ ///
public void CommitNow()
{
_index._taxonomyWriter?.Commit();
@@ -961,6 +966,7 @@ public void CommitNow()
_index.IndexCommitted?.Invoke(_index, EventArgs.Empty);
}
+ ///
public void ScheduleCommit()
{
lock (_locker)
diff --git a/src/Examine.Lucene/Providers/LuceneTaxonomySearcher.cs b/src/Examine.Lucene/Providers/LuceneTaxonomySearcher.cs
index 9f61ebfc..08e13fc4 100644
--- a/src/Examine.Lucene/Providers/LuceneTaxonomySearcher.cs
+++ b/src/Examine.Lucene/Providers/LuceneTaxonomySearcher.cs
@@ -17,9 +17,10 @@ public class LuceneTaxonomySearcher : BaseLuceneSearcher, IDisposable, ILuceneTa
/// Constructor allowing for creating a NRT instance based on a given writer
///
///
- ///
+ ///
///
///
+ ///
public LuceneTaxonomySearcher(string name, SearcherTaxonomyManager searcherManager, Analyzer analyzer, FieldValueTypeCollection fieldValueTypeCollection, FacetsConfig facetsConfig)
: base(name, analyzer, facetsConfig)
{
@@ -27,13 +28,18 @@ public LuceneTaxonomySearcher(string name, SearcherTaxonomyManager searcherManag
_fieldValueTypeCollection = fieldValueTypeCollection;
}
+ ///
public override ISearchContext GetSearchContext()
=> new TaxonomySearchContext(_searcherManager, _fieldValueTypeCollection);
-
+ ///
+ /// Gets the Taxonomy SearchContext
+ ///
+ ///
public virtual ITaxonomySearchContext GetTaxonomySearchContext()
=> new TaxonomySearchContext(_searcherManager, _fieldValueTypeCollection);
+ ///
protected virtual void Dispose(bool disposing)
{
if (!_disposedValue)
@@ -47,6 +53,7 @@ protected virtual void Dispose(bool disposing)
}
}
+ ///
public void Dispose()
{
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
diff --git a/src/Examine.Lucene/Search/ITaxonomySearchContext.cs b/src/Examine.Lucene/Search/ITaxonomySearchContext.cs
index 6c6aeee8..1e954a38 100644
--- a/src/Examine.Lucene/Search/ITaxonomySearchContext.cs
+++ b/src/Examine.Lucene/Search/ITaxonomySearchContext.cs
@@ -1,7 +1,14 @@
namespace Examine.Lucene.Search
{
+ ///
+ /// Search Context for Taxonomy Searcher
+ ///
public interface ITaxonomySearchContext : ISearchContext
{
+ ///
+ /// Gets the Search and Taxonomny Reader reference
+ ///
+ ///
ITaxonomySearcherReference GetTaxonomyAndSearcher();
}
}
diff --git a/src/Examine.Lucene/Search/ITaxonomySearcherReference.cs b/src/Examine.Lucene/Search/ITaxonomySearcherReference.cs
index 91472c72..94b839d7 100644
--- a/src/Examine.Lucene/Search/ITaxonomySearcherReference.cs
+++ b/src/Examine.Lucene/Search/ITaxonomySearcherReference.cs
@@ -2,8 +2,14 @@
namespace Examine.Lucene.Search
{
+ ///
+ /// Represents a Taxonomy Searcher Reference
+ ///
public interface ITaxonomySearcherReference : ISearcherReference
{
+ ///
+ /// Taxonomy Reader for the sidecar taxonomy index
+ ///
DirectoryTaxonomyReader TaxonomyReader { get; }
}
}
diff --git a/src/Examine.Lucene/Search/LuceneFacetLabel.cs b/src/Examine.Lucene/Search/LuceneFacetLabel.cs
index 8c56a76d..a8187842 100644
--- a/src/Examine.Lucene/Search/LuceneFacetLabel.cs
+++ b/src/Examine.Lucene/Search/LuceneFacetLabel.cs
@@ -1,26 +1,33 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using Lucene.Net.Facet.Taxonomy;
namespace Examine.Lucene.Search
{
+ ///
+ /// Lucene Facet Label
+ ///
public class LuceneFacetLabel : Examine.Search.IFacetLabel
{
private readonly FacetLabel _facetLabel;
+ ///
+ /// Constructor
+ ///
+ /// Lucene Facet Label
public LuceneFacetLabel(FacetLabel facetLabel)
{
_facetLabel = facetLabel;
}
+ ///
public string[] Components => _facetLabel.Components;
+ ///
public int Length => _facetLabel.Length;
+ ///
public int CompareTo(Examine.Search.IFacetLabel other) => _facetLabel.CompareTo(new FacetLabel(other.Components));
+
+ ///
public Examine.Search.IFacetLabel Subpath(int length) => new LuceneFacetLabel(_facetLabel.Subpath(length));
}
}
diff --git a/src/Examine.Lucene/Search/LuceneQueryOptions.cs b/src/Examine.Lucene/Search/LuceneQueryOptions.cs
index 994ac374..c941c37c 100644
--- a/src/Examine.Lucene/Search/LuceneQueryOptions.cs
+++ b/src/Examine.Lucene/Search/LuceneQueryOptions.cs
@@ -17,7 +17,7 @@ public class LuceneQueryOptions : QueryOptions
/// Whether to track the maximum document score. For best performance, if not needed, leave false.
/// Whether to Track Document Scores. For best performance, if not needed, leave false.
/// Whether to apply Facet sampling to improve performance. If not required, leave null
- public LuceneQueryOptions(int skip, int? take = null, SearchAfterOptions searchAfter = null, bool trackDocumentScores = false, bool trackDocumentMaxScore = false, LuceneFacetSamplingQueryOptions facetSampling = null)
+ public LuceneQueryOptions(int skip, int? take = null, SearchAfterOptions? searchAfter = null, bool trackDocumentScores = false, bool trackDocumentMaxScore = false, LuceneFacetSamplingQueryOptions? facetSampling = null)
: base(skip, take)
{
TrackDocumentScores = trackDocumentScores;
@@ -39,7 +39,7 @@ public LuceneQueryOptions(int skip, int? take = null, SearchAfterOptions searchA
///
/// Options for Searching After. Used for efficent deep paging.
///
- public SearchAfterOptions SearchAfter { get; }
+ public SearchAfterOptions? SearchAfter { get; }
///
/// Options for Lucene Facet Sampling. If not set, no Facet Sampling is applied.
@@ -47,6 +47,6 @@ public LuceneQueryOptions(int skip, int? take = null, SearchAfterOptions searchA
///
/// Performance optimization for large sets
///
- public LuceneFacetSamplingQueryOptions FacetRandomSampling { get; }
+ public LuceneFacetSamplingQueryOptions? FacetRandomSampling { get; }
}
}
diff --git a/src/Examine.Lucene/Search/LuceneSearchResult.cs b/src/Examine.Lucene/Search/LuceneSearchResult.cs
index 96f19650..aa417025 100644
--- a/src/Examine.Lucene/Search/LuceneSearchResult.cs
+++ b/src/Examine.Lucene/Search/LuceneSearchResult.cs
@@ -1,19 +1,25 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Examine.Lucene.Search
{
+ ///
+ /// Lucene Index Search Result
+ ///
public class LuceneSearchResult : SearchResult, ISearchResult
{
+ ///
+ /// Constructor
+ ///
public LuceneSearchResult(string id, float score, Func>> lazyFieldVals, int shardId)
: base(id, score, lazyFieldVals)
{
ShardIndex = shardId;
}
+ ///
+ /// Index Shard Id
+ ///
public int ShardIndex { get; }
}
}
diff --git a/src/Examine.Lucene/Search/SearchAfterOptions.cs b/src/Examine.Lucene/Search/SearchAfterOptions.cs
index 8a6ae330..95a2312e 100644
--- a/src/Examine.Lucene/Search/SearchAfterOptions.cs
+++ b/src/Examine.Lucene/Search/SearchAfterOptions.cs
@@ -6,6 +6,13 @@ namespace Examine.Lucene.Search
public class SearchAfterOptions
{
+ ///
+ /// Constructor
+ ///
+ /// The Id of the last document in the previous result set. The search will search after this document
+ /// The Score of the last document in the previous result set. The search will search after this document
+ /// Search fields. Should contain null or J2N.Int
+ /// The index of the shard the doc belongs to
public SearchAfterOptions(int documentId, float documentScore, object[] fields, int shardIndex)
{
DocumentId = documentId;
diff --git a/src/Examine.Lucene/Search/TaxonomySearchContext.cs b/src/Examine.Lucene/Search/TaxonomySearchContext.cs
index c7c78799..80d9b856 100644
--- a/src/Examine.Lucene/Search/TaxonomySearchContext.cs
+++ b/src/Examine.Lucene/Search/TaxonomySearchContext.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Linq;
using Examine.Lucene.Indexing;
using Lucene.Net.Facet.Taxonomy;
@@ -6,20 +6,31 @@
namespace Examine.Lucene.Search
{
+ ///
+ /// Taxonomy Search Context
+ ///
public class TaxonomySearchContext : ITaxonomySearchContext
{
private readonly SearcherTaxonomyManager _searcherManager;
private readonly FieldValueTypeCollection _fieldValueTypeCollection;
private string[] _searchableFields;
+ ///
+ /// Constructor
+ ///
+ ///
+ ///
+ ///
public TaxonomySearchContext(SearcherTaxonomyManager searcherManager, FieldValueTypeCollection fieldValueTypeCollection)
{
- _searcherManager = searcherManager;
+ _searcherManager = searcherManager ?? throw new ArgumentNullException(nameof(searcherManager));
_fieldValueTypeCollection = fieldValueTypeCollection ?? throw new ArgumentNullException(nameof(fieldValueTypeCollection));
}
+ ///
public ISearcherReference GetSearcher() => new TaxonomySearcherReference(_searcherManager);
+ ///
public string[] SearchableFields
{
get
@@ -51,6 +62,7 @@ public string[] SearchableFields
}
}
+ ///
public IIndexFieldValueType GetFieldValueType(string fieldName)
{
//Get the value type for the field, or use the default if not defined
@@ -59,6 +71,7 @@ public IIndexFieldValueType GetFieldValueType(string fieldName)
_fieldValueTypeCollection.ValueTypeFactories.GetRequiredFactory(FieldDefinitionTypes.FullText));
}
+ ///
public ITaxonomySearcherReference GetTaxonomyAndSearcher() => new TaxonomySearcherReference(_searcherManager);
}
}
diff --git a/src/Examine.Lucene/Search/TaxonomySearcherReference.cs b/src/Examine.Lucene/Search/TaxonomySearcherReference.cs
index 36a3131f..1afc2c2d 100644
--- a/src/Examine.Lucene/Search/TaxonomySearcherReference.cs
+++ b/src/Examine.Lucene/Search/TaxonomySearcherReference.cs
@@ -5,17 +5,25 @@
namespace Examine.Lucene.Search
{
+ ///
+ /// Represents a Taxonomy Searcher Reference
+ ///
public class TaxonomySearcherReference : ITaxonomySearcherReference
{
private bool _disposedValue;
private readonly SearcherTaxonomyManager _searcherManager;
- private SearcherTaxonomyManager.SearcherAndTaxonomy _searcherAndTaxonomy;
+ private SearcherTaxonomyManager.SearcherAndTaxonomy? _searcherAndTaxonomy;
+ ///
+ /// Constructor
+ ///
+ /// Taxonomny Searcher Manager
public TaxonomySearcherReference(SearcherTaxonomyManager searcherManager)
{
- _searcherManager = searcherManager;
+ _searcherManager = searcherManager ?? throw new ArgumentNullException(nameof(searcherManager));
}
+ ///
public IndexSearcher IndexSearcher
{
get
@@ -27,6 +35,8 @@ public IndexSearcher IndexSearcher
return _searcherAndTaxonomy?.Searcher ?? (_searcherAndTaxonomy = _searcherManager.Acquire()).Searcher;
}
}
+
+ ///
public DirectoryTaxonomyReader TaxonomyReader
{
get
@@ -39,6 +49,7 @@ public DirectoryTaxonomyReader TaxonomyReader
}
}
+ ///
protected virtual void Dispose(bool disposing)
{
if (!_disposedValue)
@@ -55,6 +66,7 @@ protected virtual void Dispose(bool disposing)
}
}
+ ///
public void Dispose()
{
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method