diff --git a/src/Examine.Core/BaseIndexProvider.cs b/src/Examine.Core/BaseIndexProvider.cs
index 047ea6e63..303e9bec3 100644
--- a/src/Examine.Core/BaseIndexProvider.cs
+++ b/src/Examine.Core/BaseIndexProvider.cs
@@ -6,7 +6,6 @@
namespace Examine
{
- ///
///
/// Base class for an Examine Index Provider
///
@@ -18,9 +17,9 @@ public abstract class BaseIndexProvider : IIndex
///
/// Constructor for creating an indexer at runtime
///
+ ///
///
- ///
- ///
+ ///
protected BaseIndexProvider(ILoggerFactory loggerFactory, string name,
IOptionsMonitor indexOptions)
{
@@ -33,7 +32,12 @@ protected BaseIndexProvider(ILoggerFactory loggerFactory, string name,
_indexOptions = indexOptions.GetNamedOptions(name);
}
+ ///
+ /// The factory used to create instances of .
+ ///
protected ILoggerFactory LoggerFactory { get; }
+
+ ///
public virtual string Name { get; }
///
@@ -73,11 +77,11 @@ protected abstract void PerformDeleteFromIndex(IEnumerable itemIds,
#region IIndex members
+ ///
public abstract ISearcher Searcher { get; }
- ///
///
- /// Validates the items and calls
+ /// Validates the items and calls
///
///
public void IndexItems(IEnumerable values)
@@ -91,21 +95,14 @@ public void IndexItems(IEnumerable values)
public void DeleteFromIndex(IEnumerable itemIds)
=> PerformDeleteFromIndex(itemIds, OnIndexOperationComplete);
- ///
- /// Creates a new index, any existing index will be deleted
- ///
+ ///
public abstract void CreateIndex();
- ///
- /// Returns the mappings for field types to index field types
- ///
+ ///
public ReadOnlyFieldDefinitionCollection FieldDefinitions =>
_indexOptions.FieldDefinitions ?? new FieldDefinitionCollection();
- ///
- /// Check if the index exists
- ///
- ///
+ ///
public abstract bool IndexExists();
#endregion
@@ -125,12 +122,16 @@ public void DeleteFromIndex(IEnumerable itemIds)
#region Protected Event callers
+ ///
+ /// Run when a index operation completes
+ ///
+ ///
protected void OnIndexOperationComplete(IndexOperationEventArgs e) => IndexOperationComplete?.Invoke(this, e);
///
- /// Raises the event.
+ /// Raises the event.
///
- /// The instance containing the event data.
+ /// The instance containing the event data.
protected virtual void OnIndexingError(IndexingErrorEventArgs e)
{
_logger.LogError(e.Exception, e.Message);
@@ -138,7 +139,7 @@ protected virtual void OnIndexingError(IndexingErrorEventArgs e)
}
///
- /// Raises the event.
+ /// Raises the event.
///
/// The instance containing the event data.
protected virtual void OnTransformingIndexValues(IndexingItemEventArgs e) =>
diff --git a/src/Examine.Core/BaseSearchProvider.cs b/src/Examine.Core/BaseSearchProvider.cs
index 8da5c2e1b..ede6492bc 100644
--- a/src/Examine.Core/BaseSearchProvider.cs
+++ b/src/Examine.Core/BaseSearchProvider.cs
@@ -8,20 +8,17 @@ namespace Examine
///
public abstract class BaseSearchProvider : ISearcher
{
+ ///
protected BaseSearchProvider(string name)
{
if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value cannot be null or whitespace.", nameof(name));
Name = name;
}
+ ///
public string Name { get; }
- ///
- /// Searches the index
- ///
- ///
- ///
- ///
+ ///
public abstract ISearchResults Search(string searchText, QueryOptions options = null);
///
diff --git a/src/Examine.Core/DisposableObjectSlim.cs b/src/Examine.Core/DisposableObjectSlim.cs
index 04a4bdcd8..676748330 100644
--- a/src/Examine.Core/DisposableObjectSlim.cs
+++ b/src/Examine.Core/DisposableObjectSlim.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
namespace Examine
{
@@ -10,11 +10,13 @@ public abstract class DisposableObjectSlim : IDisposable
{
private readonly object _locko = new object();
- // gets a value indicating whether this instance is disposed.
- // for internal tests only (not thread safe)
+ ///
+ /// Gets a value indicating whether this instance is disposed.
+ /// for internal tests only (not thread safe)
+ ///
protected bool Disposed { get; private set; }
- // implements IDisposable
+ ///
public void Dispose()
{
Dispose(true);
@@ -32,6 +34,9 @@ private void Dispose(bool disposing)
DisposeResources();
}
+ ///
+ /// Used to dispose resources
+ ///
protected abstract void DisposeResources();
}
-}
\ No newline at end of file
+}
diff --git a/src/Examine.Core/EmptySearchResults.cs b/src/Examine.Core/EmptySearchResults.cs
index 77d5763dc..9c3223615 100644
--- a/src/Examine.Core/EmptySearchResults.cs
+++ b/src/Examine.Core/EmptySearchResults.cs
@@ -4,34 +4,45 @@
namespace Examine
{
+ ///
+ /// Represents with no elements
+ ///
public sealed class EmptySearchResults : ISearchResults
{
private EmptySearchResults()
{
}
+ ///
+ /// Gets the static instance
+ ///
public static ISearchResults Instance { get; } = new EmptySearchResults();
+ ///
public IEnumerator GetEnumerator()
{
return Enumerable.Empty().GetEnumerator();
}
- IEnumerator IEnumerable.GetEnumerator()
+ ///
+ IEnumerator IEnumerable.GetEnumerator()
{
return Enumerable.Empty().GetEnumerator();
}
+ ///
public long TotalItemCount => 0;
- public IEnumerable Skip(int skip)
+ ///
+ public IEnumerable Skip(int skip)
{
return Enumerable.Empty();
}
+ ///
public IEnumerable SkipTake(int skip, int? take = null)
{
return Enumerable.Empty();
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Examine.Core/Examine.Core.csproj b/src/Examine.Core/Examine.Core.csproj
index d25704669..3b1069354 100644
--- a/src/Examine.Core/Examine.Core.csproj
+++ b/src/Examine.Core/Examine.Core.csproj
@@ -5,6 +5,7 @@
false
Examine is an abstraction for indexing and search operations with implementations such as Lucene.Net
examine search index
+ True
diff --git a/src/Examine.Core/ExamineExtensions.cs b/src/Examine.Core/ExamineExtensions.cs
index ae3041bf3..93935e82e 100644
--- a/src/Examine.Core/ExamineExtensions.cs
+++ b/src/Examine.Core/ExamineExtensions.cs
@@ -8,6 +8,14 @@ namespace Examine
///
public static class ExamineExtensions
{
+ ///
+ /// Gets named options from an
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public static T GetNamedOptions(this IOptionsMonitor optionsMonitor, string name)
where T : class
{
@@ -36,6 +44,11 @@ public static IIndex GetIndex(this IExamineManager examineManager, string indexN
throw new InvalidOperationException("No index found with name " + indexName);
}
+ ///
+ /// Deletes a node from the index
+ ///
+ ///
+ ///
public static void DeleteFromIndex(this IIndex index, string itemId)
{
index.DeleteFromIndex(new[] {itemId});
diff --git a/src/Examine.Core/ExamineFieldNames.cs b/src/Examine.Core/ExamineFieldNames.cs
index 01a85f72e..5592dad54 100644
--- a/src/Examine.Core/ExamineFieldNames.cs
+++ b/src/Examine.Core/ExamineFieldNames.cs
@@ -1,5 +1,8 @@
namespace Examine
{
+ ///
+ /// Constant names for speciffic fields
+ ///
public static class ExamineFieldNames
{
///
@@ -22,6 +25,9 @@ public static class ExamineFieldNames
///
public const string ItemIdFieldName = "__NodeId";
+ ///
+ /// Used to store the item type for a document
+ ///
public const string ItemTypeFieldName = "__NodeTypeAlias";
///
diff --git a/src/Examine.Core/ExamineManager.cs b/src/Examine.Core/ExamineManager.cs
index 35500bd5f..a922fa5d5 100644
--- a/src/Examine.Core/ExamineManager.cs
+++ b/src/Examine.Core/ExamineManager.cs
@@ -10,6 +10,7 @@ namespace Examine
///
public class ExamineManager : IDisposable, IExamineManager
{
+ ///
public ExamineManager(IEnumerable indexes, IEnumerable searchers)
{
foreach(IIndex i in indexes)
@@ -68,6 +69,8 @@ private ISearcher AddSearcher(ISearcher searcher)
public void Dispose() => Dispose(true);
private bool _disposed = false;
+
+ ///
protected virtual void Dispose(bool disposing)
{
if (!_disposed)
diff --git a/src/Examine.Core/FieldDefinition.cs b/src/Examine.Core/FieldDefinition.cs
index 1513d1084..2d92b383e 100644
--- a/src/Examine.Core/FieldDefinition.cs
+++ b/src/Examine.Core/FieldDefinition.cs
@@ -30,14 +30,17 @@ public FieldDefinition(string name, string type)
///
public string Type { get; }
+ ///
public bool Equals(FieldDefinition other) => string.Equals(Name, other.Name) && string.Equals(Type, other.Type);
+ ///
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
return obj is FieldDefinition definition && Equals(definition);
}
+ ///
public override int GetHashCode()
{
unchecked
@@ -46,8 +49,10 @@ public override int GetHashCode()
}
}
+ ///
public static bool operator ==(FieldDefinition left, FieldDefinition right) => left.Equals(right);
+ ///
public static bool operator !=(FieldDefinition left, FieldDefinition right) => !left.Equals(right);
}
}
diff --git a/src/Examine.Core/FieldDefinitionCollection.cs b/src/Examine.Core/FieldDefinitionCollection.cs
index 93e1625da..b55c2b061 100644
--- a/src/Examine.Core/FieldDefinitionCollection.cs
+++ b/src/Examine.Core/FieldDefinitionCollection.cs
@@ -2,16 +2,29 @@
namespace Examine
{
+ ///
public class FieldDefinitionCollection : ReadOnlyFieldDefinitionCollection
{
+ ///
public FieldDefinitionCollection(params FieldDefinition[] definitions) : base(definitions)
{
}
+ ///
public FieldDefinitionCollection()
{
}
+ ///
+ /// Adds a key/value pair to the
+ /// by using the specified function if the key does not already exist, or returns
+ /// the existing value if the key exists.
+ ///
+ ///
+ ///
+ ///
+ /// fieldName or add is null
+ /// The dictionary already contains the maximum number of elements ()
public FieldDefinition GetOrAdd(string fieldName, Func add) => Definitions.GetOrAdd(fieldName, add);
///
@@ -20,6 +33,16 @@ public FieldDefinitionCollection()
///
public void AddOrUpdate(FieldDefinition definition) => Definitions.AddOrUpdate(definition.Name, definition, (s, factory) => definition);
+ ///
+ /// Attempts to add the specified key and value to the .
+ ///
+ ///
+ ///
+ /// True if the key/value pair was added to the
+ /// successfully; false if the key already exists.
+ ///
+ /// definition.Name is null
+ /// The dictionary already contains the maximum number of elements ()
public bool TryAdd(FieldDefinition definition) => Definitions.TryAdd(definition.Name, definition);
}
}
diff --git a/src/Examine.Core/FieldDefinitionTypes.cs b/src/Examine.Core/FieldDefinitionTypes.cs
index d3b140020..619c41909 100644
--- a/src/Examine.Core/FieldDefinitionTypes.cs
+++ b/src/Examine.Core/FieldDefinitionTypes.cs
@@ -1,3 +1,5 @@
+using System;
+
namespace Examine
{
///
@@ -5,15 +7,54 @@ namespace Examine
///
public static class FieldDefinitionTypes
{
+ ///
+ /// Will be indexed as an integer
+ ///
public const string Integer = "int";
+
+ ///
+ /// Will be indexed as a float
+ ///
public const string Float = "float";
+
+ ///
+ /// Will be indexed as a double
+ ///
public const string Double = "double";
+
+ ///
+ /// Will be indexed as a long
+ ///
public const string Long = "long";
+
+ ///
+ /// Will be indexed DateTime represented as a long
+ ///
public const string DateTime = "datetime";
+
+ ///
+ /// Will be indexed DateTime but with precision only to the year represented as a long
+ ///
public const string DateYear = "date.year";
+
+ ///
+ /// Will be indexed DateTime but with precision only to the month represented as a long
+ ///
public const string DateMonth = "date.month";
+
+ ///
+ /// Will be indexed DateTime but with precision only to the day represented as a long
+ ///
public const string DateDay = "date.day";
+
+ ///
+ /// Will be indexed DateTime but with precision only to the hour represented as a long
+ ///
public const string DateHour = "date.hour";
+
+ ///
+ /// Will be indexed DateTime but with precision only to the minute represented as a long
+ ///
public const string DateMinute = "date.minute";
///
diff --git a/src/Examine.Core/IExamineManager.cs b/src/Examine.Core/IExamineManager.cs
index 10087604f..994321f75 100644
--- a/src/Examine.Core/IExamineManager.cs
+++ b/src/Examine.Core/IExamineManager.cs
@@ -3,6 +3,9 @@
namespace Examine
{
+ ///
+ /// Exposes searchers and indexers
+ ///
public interface IExamineManager
{
///
@@ -17,10 +20,13 @@ public interface IExamineManager
/// Gets a list of all manually configured search providers
///
///
- /// This returns only those searchers explicitly registered with or config based searchers
+ /// This returns only those searchers explicitly registered with AddExamineSearcher or config based searchers
///
IEnumerable RegisteredSearchers { get; }
+ ///
+ /// Disposes the
+ ///
void Dispose();
///
@@ -32,7 +38,7 @@ public interface IExamineManager
bool TryGetIndex(string indexName, out IIndex index);
///
- /// Returns a searcher that was registered with or via config
+ /// Returns a searcher that was registered with AddExamineSearcher or via config
///
///
///
diff --git a/src/Examine.Core/IIndex.cs b/src/Examine.Core/IIndex.cs
index e6f1b5651..b584abead 100644
--- a/src/Examine.Core/IIndex.cs
+++ b/src/Examine.Core/IIndex.cs
@@ -9,6 +9,9 @@ namespace Examine
///
public interface IIndex
{
+ ///
+ /// The index name
+ ///
string Name { get; }
///
diff --git a/src/Examine.Core/IIndexStats.cs b/src/Examine.Core/IIndexStats.cs
index 0c68ff984..d551caef9 100644
--- a/src/Examine.Core/IIndexStats.cs
+++ b/src/Examine.Core/IIndexStats.cs
@@ -3,9 +3,21 @@
namespace Examine
{
+ ///
+ /// Represents stats for a
+ ///
public interface IIndexStats
{
+ ///
+ /// Gets the ammount of documents in the index
+ ///
+ ///
long GetDocumentCount();
+
+ ///
+ /// Gets the field names in the index
+ ///
+ ///
IEnumerable GetFieldNames();
}
}
diff --git a/src/Examine.Core/ISearchResult.cs b/src/Examine.Core/ISearchResult.cs
index de21b2401..047da52f7 100644
--- a/src/Examine.Core/ISearchResult.cs
+++ b/src/Examine.Core/ISearchResult.cs
@@ -1,11 +1,20 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
namespace Examine
{
+ ///
+ /// Represents a search result
+ ///
public interface ISearchResult
{
+ ///
+ /// The id of the search result
+ ///
string Id { get; }
+ ///
+ /// The score of the search result
+ ///
float Score { get; }
///
@@ -43,4 +52,4 @@ public interface ISearchResult
///
string this[string key] { get; }
}
-}
\ No newline at end of file
+}
diff --git a/src/Examine.Core/ISearchResults.cs b/src/Examine.Core/ISearchResults.cs
index 3e50f11ac..5957eb8f3 100644
--- a/src/Examine.Core/ISearchResults.cs
+++ b/src/Examine.Core/ISearchResults.cs
@@ -2,6 +2,9 @@
namespace Examine
{
+ ///
+ /// Represents search results from a query
+ ///
public interface ISearchResults : IEnumerable
{
///
diff --git a/src/Examine.Core/ISearcher.cs b/src/Examine.Core/ISearcher.cs
index 08fc6bec5..9b6c7c482 100644
--- a/src/Examine.Core/ISearcher.cs
+++ b/src/Examine.Core/ISearcher.cs
@@ -7,13 +7,16 @@ namespace Examine
///
public interface ISearcher
{
+ ///
+ /// The searchers name
+ ///
string Name { get; }
///
/// Searches the index
///
/// The search text or a native query
- ///
+ ///
/// Search Results
ISearchResults Search(string searchText, QueryOptions options = null);
diff --git a/src/Examine.Core/IValueSetValidator.cs b/src/Examine.Core/IValueSetValidator.cs
index f535eda78..06a7f0408 100644
--- a/src/Examine.Core/IValueSetValidator.cs
+++ b/src/Examine.Core/IValueSetValidator.cs
@@ -5,6 +5,11 @@ namespace Examine
///
public interface IValueSetValidator
{
+ ///
+ /// Validates the value set
+ ///
+ ///
+ ///
ValueSetValidationResult Validate(ValueSet valueSet);
}
}
diff --git a/src/Examine.Core/IndexOperationEventArgs.cs b/src/Examine.Core/IndexOperationEventArgs.cs
index 166719a81..a83e9d19c 100644
--- a/src/Examine.Core/IndexOperationEventArgs.cs
+++ b/src/Examine.Core/IndexOperationEventArgs.cs
@@ -2,15 +2,26 @@
namespace Examine
{
+ ///
+ /// Represents index operation event arguments
+ ///
public class IndexOperationEventArgs : EventArgs
{
+ ///
+ /// The index of the event
+ ///
public IIndex Index { get; }
+
+ ///
+ /// The items indexed in operation
+ ///
public int ItemsIndexed { get; }
+ ///
public IndexOperationEventArgs(IIndex index, int itemsIndexed)
{
Index = index;
ItemsIndexed = itemsIndexed;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Examine.Core/IndexOperationType.cs b/src/Examine.Core/IndexOperationType.cs
index c209f98de..1b645a8f8 100644
--- a/src/Examine.Core/IndexOperationType.cs
+++ b/src/Examine.Core/IndexOperationType.cs
@@ -5,7 +5,14 @@ namespace Examine
///
public enum IndexOperationType
{
+ ///
+ /// An additive operation
+ ///
Add,
+
+ ///
+ /// A delete operation
+ ///
Delete
}
-}
\ No newline at end of file
+}
diff --git a/src/Examine.Core/IndexOptions.cs b/src/Examine.Core/IndexOptions.cs
index c773f2f3d..75cfafc79 100644
--- a/src/Examine.Core/IndexOptions.cs
+++ b/src/Examine.Core/IndexOptions.cs
@@ -1,10 +1,21 @@
namespace Examine
{
+ ///
+ /// Represents the index options for a
+ ///
public class IndexOptions
{
+ ///
public IndexOptions() => FieldDefinitions = new FieldDefinitionCollection();
+ ///
+ /// The field definitions for the
+ ///
public FieldDefinitionCollection FieldDefinitions { get; set; }
+
+ ///
+ /// The validator for the
+ ///
public IValueSetValidator Validator { get; set; }
}
}
diff --git a/src/Examine.Core/IndexingErrorEventArgs.cs b/src/Examine.Core/IndexingErrorEventArgs.cs
index f31f961d6..90c23534c 100644
--- a/src/Examine.Core/IndexingErrorEventArgs.cs
+++ b/src/Examine.Core/IndexingErrorEventArgs.cs
@@ -5,9 +5,12 @@
namespace Examine
{
+ ///
+ /// Indexing error event arguments
+ ///
public class IndexingErrorEventArgs : EventArgs
{
-
+ ///
public IndexingErrorEventArgs(IIndex index, string message, string itemId, Exception exception)
{
Index = index;
@@ -16,9 +19,24 @@ public IndexingErrorEventArgs(IIndex index, string message, string itemId, Excep
Exception = exception;
}
+ ///
+ /// The exception of the error
+ ///
public Exception Exception { get; }
+
+ ///
+ /// The message of the error
+ ///
public string Message { get; }
+
+ ///
+ /// The index where the error originated
+ ///
public IIndex Index { get; }
+
+ ///
+ /// The item id
+ ///
public string ItemId { get; }
}
}
diff --git a/src/Examine.Core/IndexingItemEventArgs.cs b/src/Examine.Core/IndexingItemEventArgs.cs
index 1071ea739..f714ee8b4 100644
--- a/src/Examine.Core/IndexingItemEventArgs.cs
+++ b/src/Examine.Core/IndexingItemEventArgs.cs
@@ -4,18 +4,32 @@
namespace Examine
{
+ ///
+ /// Represents indexing item event arguments
+ ///
public class IndexingItemEventArgs : CancelEventArgs
{
+ ///
+ /// The index of the event
+ ///
public IIndex Index { get; }
+ ///
+ /// The value set of the event
+ ///
public ValueSet ValueSet { get; private set; }
+ ///
public IndexingItemEventArgs(IIndex index, ValueSet valueSet)
{
Index = index;
ValueSet = valueSet;
}
+ ///
+ /// Sets the value of the
+ ///
+ ///
public void SetValues(IDictionary> values)
=> ValueSet = new ValueSet(ValueSet.Id, ValueSet.Category, ValueSet.ItemType, values);
}
diff --git a/src/Examine.Core/ObjectExtensions.cs b/src/Examine.Core/ObjectExtensions.cs
index de5805446..783e89743 100644
--- a/src/Examine.Core/ObjectExtensions.cs
+++ b/src/Examine.Core/ObjectExtensions.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -14,6 +14,9 @@
namespace Examine
{
+ ///
+ /// Extensions for objects
+ ///
public static class ObjectExtensions
{
///
diff --git a/src/Examine.Core/OrderedDictionary.cs b/src/Examine.Core/OrderedDictionary.cs
index fa9f3dac7..3b2b96010 100644
--- a/src/Examine.Core/OrderedDictionary.cs
+++ b/src/Examine.Core/OrderedDictionary.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
@@ -12,14 +12,17 @@ namespace Examine
///
public class OrderedDictionary : KeyedCollection>, IDictionary, IReadOnlyDictionary
{
+ ///
public OrderedDictionary()
{
}
+ ///
public OrderedDictionary(IEqualityComparer comparer) : base(comparer)
{
}
-
+
+ ///
public TVal GetItem(int index)
{
if (index >= Count) throw new IndexOutOfRangeException();
@@ -29,6 +32,7 @@ public TVal GetItem(int index)
return base[found.Key].Value;
}
+ ///
public int IndexOf(TKey key)
{
if (base.Dictionary == null) return -1;
@@ -39,16 +43,19 @@ public int IndexOf(TKey key)
return -1;
}
+ ///
protected override TKey GetKeyForItem(KeyValuePair item)
{
return item.Key;
}
+ ///
public bool ContainsKey(TKey key)
{
return base.Contains(key);
}
+ ///
public void Add(TKey key, TVal value)
{
if (base.Contains(key)) throw new ArgumentException("The key " + key + " already exists in this collection");
@@ -56,6 +63,7 @@ public void Add(TKey key, TVal value)
base.Add(new KeyValuePair(key, value));
}
+ ///
public bool TryGetValue(TKey key, out TVal value)
{
if (base.Dictionary == null)
@@ -109,8 +117,10 @@ TVal IDictionary.this[TKey key]
private static readonly ICollection EmptyCollection = new List();
private static readonly ICollection EmptyValues = new List();
+ ///
public ICollection Keys => base.Dictionary != null ? base.Dictionary.Keys : EmptyCollection;
+ ///
public ICollection Values => base.Dictionary != null ? base.Dictionary.Values.Select(x => x.Value).ToArray() : EmptyValues;
}
-}
\ No newline at end of file
+}
diff --git a/src/Examine.Core/ReadOnlyFieldDefinitionCollection.cs b/src/Examine.Core/ReadOnlyFieldDefinitionCollection.cs
index 13e5c11bf..15605ddad 100644
--- a/src/Examine.Core/ReadOnlyFieldDefinitionCollection.cs
+++ b/src/Examine.Core/ReadOnlyFieldDefinitionCollection.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -11,17 +11,20 @@ namespace Examine
///
public class ReadOnlyFieldDefinitionCollection : IEnumerable
{
+ ///
public ReadOnlyFieldDefinitionCollection()
: this(Enumerable.Empty())
{
}
+ ///
public ReadOnlyFieldDefinitionCollection(params FieldDefinition[] definitions)
: this((IEnumerable)definitions)
{
}
+ ///
public ReadOnlyFieldDefinitionCollection(IEnumerable definitions)
{
if (definitions == null) return;
@@ -50,12 +53,20 @@ public ReadOnlyFieldDefinitionCollection(IEnumerable definition
///
public virtual bool TryGetValue(string fieldName, out FieldDefinition fieldDefinition) => Definitions.TryGetValue(fieldName, out fieldDefinition);
+ ///
+ /// Gets the ammount of key/value paris in the collection
+ ///
public int Count => Definitions.Count;
+ ///
+ /// A collection of field definitions
+ ///
protected ConcurrentDictionary Definitions { get; } = new ConcurrentDictionary(StringComparer.InvariantCultureIgnoreCase);
+ ///
public IEnumerator GetEnumerator() => Definitions.Values.GetEnumerator();
+ ///
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
}
diff --git a/src/Examine.Core/Search/BooleanOperation.cs b/src/Examine.Core/Search/BooleanOperation.cs
index 0054bb991..1eefb5b76 100644
--- a/src/Examine.Core/Search/BooleanOperation.cs
+++ b/src/Examine.Core/Search/BooleanOperation.cs
@@ -1,7 +1,23 @@
-namespace Examine.Search
+namespace Examine.Search
{
+ ///
+ /// Represents types of boolean operations
+ ///
public enum BooleanOperation
{
- And, Or, Not
+ ///
+ /// And modifier
+ ///
+ And,
+
+ ///
+ /// Or modifier
+ ///
+ Or,
+
+ ///
+ /// Not modifier
+ ///
+ Not
}
}
diff --git a/src/Examine.Core/Search/ExamineValue.cs b/src/Examine.Core/Search/ExamineValue.cs
index c49eeac00..06cb5668e 100644
--- a/src/Examine.Core/Search/ExamineValue.cs
+++ b/src/Examine.Core/Search/ExamineValue.cs
@@ -1,14 +1,17 @@
-using Examine.Search;
+using Examine.Search;
namespace Examine.Search
{
+ ///
public struct ExamineValue : IExamineValue
{
+ ///
public ExamineValue(Examineness vagueness, string value)
: this(vagueness, value, 1)
{
}
+ ///
public ExamineValue(Examineness vagueness, string value, float level)
{
Examineness = vagueness;
@@ -16,10 +19,13 @@ public ExamineValue(Examineness vagueness, string value, float level)
Level = level;
}
+ ///
public Examineness Examineness { get; }
+ ///
public string Value { get; }
+ ///
public float Level { get; }
}
diff --git a/src/Examine.Core/Search/FacetResult.cs b/src/Examine.Core/Search/FacetResult.cs
index 1d18b9d32..41f18804c 100644
--- a/src/Examine.Core/Search/FacetResult.cs
+++ b/src/Examine.Core/Search/FacetResult.cs
@@ -4,16 +4,19 @@
namespace Examine.Search
{
+ ///
public class FacetResult : IFacetResult
{
private readonly IEnumerable _values;
private IDictionary _dictValues;
+ ///
public FacetResult(IEnumerable values)
{
_values = values;
}
+ ///
public IEnumerator GetEnumerator()
{
return _values.GetEnumerator();
@@ -27,18 +30,21 @@ private void SetValuesDictionary()
}
}
+ ///
public IFacetValue Facet(string label)
{
SetValuesDictionary();
return _dictValues[label];
}
+ ///
public bool TryGetFacet(string label, out IFacetValue facetValue)
{
SetValuesDictionary();
return _dictValues.TryGetValue(label, out facetValue);
}
+ ///
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
diff --git a/src/Examine.Core/Search/FacetValue.cs b/src/Examine.Core/Search/FacetValue.cs
index 799a84b84..e8fa1e2fd 100644
--- a/src/Examine.Core/Search/FacetValue.cs
+++ b/src/Examine.Core/Search/FacetValue.cs
@@ -1,11 +1,15 @@
namespace Examine.Search
{
+ ///
public readonly struct FacetValue : IFacetValue
{
+ ///
public string Label { get; }
+ ///
public float Value { get; }
+ ///
public FacetValue(string label, float value)
{
Label = label;
diff --git a/src/Examine.Core/Search/IExamineValue.cs b/src/Examine.Core/Search/IExamineValue.cs
index 5c89f5288..12302211f 100644
--- a/src/Examine.Core/Search/IExamineValue.cs
+++ b/src/Examine.Core/Search/IExamineValue.cs
@@ -1,10 +1,24 @@
namespace Examine.Search
{
+ ///
+ /// Represents a value used in a query like
+ ///
public interface IExamineValue
{
+ ///
+ /// Different ways to match terms
+ ///
Examineness Examineness { get; }
+
+ ///
+ /// The level
+ ///
float Level { get; }
+
+ ///
+ /// The value
+ ///
string Value { get; }
}
}
diff --git a/src/Examine.Core/Search/IFacetQueryField.cs b/src/Examine.Core/Search/IFacetQueryField.cs
index 3838b780b..1d6d4521b 100644
--- a/src/Examine.Core/Search/IFacetQueryField.cs
+++ b/src/Examine.Core/Search/IFacetQueryField.cs
@@ -1,5 +1,8 @@
namespace Examine.Search
{
+ ///
+ /// Represents a facet fulltext query field
+ ///
public interface IFacetQueryField
{
///
diff --git a/src/Examine.Core/Search/IFacetResult.cs b/src/Examine.Core/Search/IFacetResult.cs
index af6236735..a5af2362d 100644
--- a/src/Examine.Core/Search/IFacetResult.cs
+++ b/src/Examine.Core/Search/IFacetResult.cs
@@ -2,6 +2,9 @@
namespace Examine.Search
{
+ ///
+ /// Represents a facet results consisting of
+ ///
public interface IFacetResult : IEnumerable
{
///
@@ -10,5 +13,13 @@ public interface IFacetResult : IEnumerable
///
///
IFacetValue Facet(string label);
+
+ ///
+ /// Trys to get a facet value for a label
+ ///
+ ///
+ ///
+ ///
+ bool TryGetFacet(string label, out IFacetValue facetValue);
}
}
diff --git a/src/Examine.Core/Search/IFacetResults.cs b/src/Examine.Core/Search/IFacetResults.cs
index d23032dbc..b4eec92ef 100644
--- a/src/Examine.Core/Search/IFacetResults.cs
+++ b/src/Examine.Core/Search/IFacetResults.cs
@@ -2,6 +2,9 @@
namespace Examine.Search
{
+ ///
+ /// Represents a search result containing facets
+ ///
public interface IFacetResults
{
///
diff --git a/src/Examine.Core/Search/IFacetValue.cs b/src/Examine.Core/Search/IFacetValue.cs
index d2d0e16c6..90e0eaa55 100644
--- a/src/Examine.Core/Search/IFacetValue.cs
+++ b/src/Examine.Core/Search/IFacetValue.cs
@@ -1,5 +1,8 @@
namespace Examine.Search
{
+ ///
+ /// Represents a single facet value
+ ///
public interface IFacetValue
{
///
diff --git a/src/Examine.Core/Search/INestedBooleanOperation.cs b/src/Examine.Core/Search/INestedBooleanOperation.cs
index cd18c2770..f3bf504c9 100644
--- a/src/Examine.Core/Search/INestedBooleanOperation.cs
+++ b/src/Examine.Core/Search/INestedBooleanOperation.cs
@@ -1,7 +1,10 @@
-using System;
+using System;
namespace Examine.Search
{
+ ///
+ /// Represents a nested boolean operation
+ ///
public interface INestedBooleanOperation
{
///
@@ -46,4 +49,4 @@ public interface INestedBooleanOperation
///
INestedBooleanOperation AndNot(Func inner, BooleanOperation defaultOp = BooleanOperation.And);
}
-}
\ No newline at end of file
+}
diff --git a/src/Examine.Core/Search/INestedQuery.cs b/src/Examine.Core/Search/INestedQuery.cs
index 1f544772e..12c3fa141 100644
--- a/src/Examine.Core/Search/INestedQuery.cs
+++ b/src/Examine.Core/Search/INestedQuery.cs
@@ -1,11 +1,12 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
namespace Examine.Search
{
+ ///
+ /// Represents a nested query
+ ///
public interface INestedQuery
{
-
-
///
/// Query on the specified field for a struct value which will try to be auto converted with the correct query
///
@@ -100,4 +101,4 @@ public interface INestedQuery
///
INestedBooleanOperation RangeQuery(string[] fields, T? min, T? max, bool minInclusive = true, bool maxInclusive = true) where T : struct;
}
-}
\ No newline at end of file
+}
diff --git a/src/Examine.Core/Search/IOrdering.cs b/src/Examine.Core/Search/IOrdering.cs
index 41b304fe2..00acae926 100644
--- a/src/Examine.Core/Search/IOrdering.cs
+++ b/src/Examine.Core/Search/IOrdering.cs
@@ -3,6 +3,9 @@
namespace Examine.Search
{
+ ///
+ /// Represents a ordering operation
+ ///
public interface IOrdering : IQueryExecutor
{
///
@@ -29,7 +32,7 @@ public interface IOrdering : IQueryExecutor
///
/// Return only the specified field. Use when possible as internally a new HashSet is created on each call
///
- /// The field name of the field to load
+ /// The field name of the field to load
///
IOrdering SelectField(string fieldName);
diff --git a/src/Examine.Core/Search/OrderingExtensions.cs b/src/Examine.Core/Search/OrderingExtensions.cs
index d0c5f5cbf..03ed6ec22 100644
--- a/src/Examine.Core/Search/OrderingExtensions.cs
+++ b/src/Examine.Core/Search/OrderingExtensions.cs
@@ -1,12 +1,16 @@
-using System;
+using System;
namespace Examine.Search
{
+ ///
+ /// Extensions on the interface
+ ///
public static class OrderingExtensions
{
///
/// Allows for selecting facets to return in your query
///
+ ///
///
///
public static IQueryExecutor WithFacets(this IOrdering ordering, Action facets)
diff --git a/src/Examine.Core/Search/QueryOptions.cs b/src/Examine.Core/Search/QueryOptions.cs
index ec026eaf2..c3974cc67 100644
--- a/src/Examine.Core/Search/QueryOptions.cs
+++ b/src/Examine.Core/Search/QueryOptions.cs
@@ -2,12 +2,30 @@
namespace Examine.Search
{
+ ///
+ /// Represents options for querying
+ ///
public class QueryOptions
{
+ ///
+ /// The default maximum ammount of results
+ ///
public const int DefaultMaxResults = 500;
+
+ ///
+ /// Creates a with the specified parameters
+ ///
+ ///
+ ///
+ ///
public static QueryOptions SkipTake(int skip, int? take = null) => new QueryOptions(skip, take ?? DefaultMaxResults);
+
+ ///
+ /// Creates a default
+ ///
public static QueryOptions Default { get; } = new QueryOptions(0, DefaultMaxResults);
+ ///
public QueryOptions(int skip, int? take = null)
{
if (skip < 0)
@@ -24,7 +42,14 @@ public QueryOptions(int skip, int? take = null)
Take = take ?? DefaultMaxResults;
}
+ ///
+ /// The ammount of items to skip
+ ///
public int Skip { get; }
+
+ ///
+ /// The ammount of items to take
+ ///
public int Take { get; }
}
}
diff --git a/src/Examine.Core/SearchResult.cs b/src/Examine.Core/SearchResult.cs
index 11fd7df0b..1706f2c99 100644
--- a/src/Examine.Core/SearchResult.cs
+++ b/src/Examine.Core/SearchResult.cs
@@ -1,10 +1,11 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
namespace Examine
{
+ ///
public class SearchResult : ISearchResult
{
private OrderedDictionary _fields;
@@ -33,7 +34,10 @@ public SearchResult(string id, float score, Func
public string Id { get; }
+
+ ///
public float Score { get; }
///
diff --git a/src/Examine.Core/ValueSet.cs b/src/Examine.Core/ValueSet.cs
index b083e52cf..e5fb2bbc4 100644
--- a/src/Examine.Core/ValueSet.cs
+++ b/src/Examine.Core/ValueSet.cs
@@ -38,9 +38,24 @@ public class ValueSet
/// normally used for deletions
public ValueSet(string id) => Id = id;
+ ///
+ /// Creates a value set from an object
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public static ValueSet FromObject(string id, string category, string itemType, object values)
=> new ValueSet(id, category, itemType, ObjectExtensions.ConvertObjectToDictionary(values));
+ ///
+ /// Creates a value set from an object
+ ///
+ ///
+ ///
+ ///
+ ///
public static ValueSet FromObject(string id, string category, object values)
=> new ValueSet(id, category, ObjectExtensions.ConvertObjectToDictionary(values));
@@ -139,6 +154,10 @@ private static IEnumerable
public override string SortableFieldName => FieldName;
+ ///
public DateTimeType(string fieldName, ILoggerFactory logger, DateResolution resolution, bool store, bool isFacetable)
: base(fieldName, logger, store)
{
@@ -30,6 +36,7 @@ public DateTimeType(string fieldName, ILoggerFactory logger, DateResolution reso
_isFacetable = isFacetable;
}
+ ///
public DateTimeType(string fieldName, ILoggerFactory logger, DateResolution resolution, bool store = true)
: base(fieldName, logger, store)
{
@@ -37,6 +44,7 @@ public DateTimeType(string fieldName, ILoggerFactory logger, DateResolution reso
_isFacetable = false;
}
+ ///
protected override void AddSingleValue(Document doc, object value)
{
if (!TryConvert(value, out DateTime parsedVal))
@@ -63,6 +71,7 @@ protected long DateToLong(DateTime date)
return DateTools.Round(date, Resolution).Ticks;
}
+ ///
public override Query GetQuery(string query)
{
if (!TryConvert(query, out DateTime parsedVal))
@@ -71,6 +80,7 @@ public override Query GetQuery(string query)
return GetQuery(parsedVal, parsedVal);
}
+ ///
public override Query GetQuery(DateTime? lower, DateTime? upper, bool lowerInclusive = true, bool upperInclusive = true)
{
return NumericRangeQuery.NewInt64Range(FieldName,
@@ -78,6 +88,7 @@ public override Query GetQuery(DateTime? lower, DateTime? upper, bool lowerInclu
upper != null ? DateToLong(upper.Value) : (long?)null, lowerInclusive, upperInclusive);
}
+ ///
public virtual IEnumerable> ExtractFacets(IFacetExtractionContext facetExtractionContext, IFacetField field)
=> field.ExtractFacets(facetExtractionContext);
}
diff --git a/src/Examine.Lucene/Indexing/DoubleType.cs b/src/Examine.Lucene/Indexing/DoubleType.cs
index f036afdc9..b37ede540 100644
--- a/src/Examine.Lucene/Indexing/DoubleType.cs
+++ b/src/Examine.Lucene/Indexing/DoubleType.cs
@@ -10,16 +10,21 @@
namespace Examine.Lucene.Indexing
{
+ ///
+ /// Represents a Double
+ ///
public class DoubleType : IndexFieldRangeValueType, IIndexFacetValueType
{
private readonly bool _isFacetable;
+ ///
public DoubleType(string fieldName, ILoggerFactory logger, bool store, bool isFacetable)
: base(fieldName, logger, store)
{
_isFacetable = isFacetable;
}
+ ///
public DoubleType(string fieldName, ILoggerFactory logger, bool store = true)
: base(fieldName, logger, store)
{
@@ -31,6 +36,7 @@ public DoubleType(string fieldName, ILoggerFactory logger, bool store = true)
///
public override string SortableFieldName => FieldName;
+ ///
protected override void AddSingleValue(Document doc, object value)
{
if (!TryConvert(value, out double parsedVal))
@@ -45,17 +51,21 @@ protected override void AddSingleValue(Document doc, object value)
}
}
+ ///
public override Query GetQuery(string query)
{
return !TryConvert(query, out double parsedVal) ? null : GetQuery(parsedVal, parsedVal);
}
+ ///
public override Query GetQuery(double? lower, double? upper, bool lowerInclusive = true, bool upperInclusive = true)
{
return NumericRangeQuery.NewDoubleRange(FieldName,
lower ?? double.MinValue,
upper ?? double.MaxValue, lowerInclusive, upperInclusive);
}
+
+ ///
public virtual IEnumerable> ExtractFacets(IFacetExtractionContext facetExtractionContext, IFacetField field)
=> field.ExtractFacets(facetExtractionContext);
}
diff --git a/src/Examine.Lucene/Indexing/FullTextType.cs b/src/Examine.Lucene/Indexing/FullTextType.cs
index 0c347b3cf..da73e9c4d 100644
--- a/src/Examine.Lucene/Indexing/FullTextType.cs
+++ b/src/Examine.Lucene/Indexing/FullTextType.cs
@@ -34,10 +34,12 @@ public class FullTextType : IndexFieldValueTypeBase, IIndexFacetValueType
/// Constructor
///
///
+ ///
+ ///
+ ///
///
/// Defaults to
///
- ///
public FullTextType(string fieldName, ILoggerFactory logger, bool sortable = false, bool isFacetable = false, Analyzer analyzer = null)
: base(fieldName, logger, true)
{
@@ -50,6 +52,7 @@ public FullTextType(string fieldName, ILoggerFactory logger, bool sortable = fal
/// Constructor
///
///
+ ///
///
/// Defaults to
///
@@ -67,8 +70,10 @@ public FullTextType(string fieldName, ILoggerFactory logger, Analyzer analyzer =
///
public override string SortableFieldName => _sortable ? ExamineFieldNames.SortedFieldNamePrefix + FieldName : null;
+ ///
public override Analyzer Analyzer => _analyzer;
+ ///
protected override void AddSingleValue(Document doc, object value)
{
if (TryConvert(value, out var str))
@@ -91,6 +96,13 @@ protected override void AddSingleValue(Document doc, object value)
}
}
+ ///
+ /// Generates a full text query
+ ///
+ ///
+ ///
+ ///
+ ///
public static Query GenerateQuery(string fieldName, string query, Analyzer analyzer)
{
if (query == null)
@@ -162,13 +174,13 @@ public static Query GenerateQuery(string fieldName, string query, Analyzer analy
/// Builds a full text search query
///
///
- ///
///
public override Query GetQuery(string query)
{
return GenerateQuery(FieldName, query, _analyzer);
}
+ ///
public virtual IEnumerable> ExtractFacets(IFacetExtractionContext facetExtractionContext, IFacetField field)
=> field.ExtractFacets(facetExtractionContext);
}
diff --git a/src/Examine.Lucene/Indexing/GenericAnalyzerFieldValueType.cs b/src/Examine.Lucene/Indexing/GenericAnalyzerFieldValueType.cs
index f5b261d81..4957737b4 100644
--- a/src/Examine.Lucene/Indexing/GenericAnalyzerFieldValueType.cs
+++ b/src/Examine.Lucene/Indexing/GenericAnalyzerFieldValueType.cs
@@ -15,6 +15,7 @@ public class GenericAnalyzerFieldValueType : IndexFieldValueTypeBase
private readonly Analyzer _analyzer;
private readonly bool _sortable;
+ ///
public GenericAnalyzerFieldValueType(string fieldName, ILoggerFactory logger, Analyzer analyzer, bool sortable = false)
: base(fieldName, logger, true)
{
@@ -27,8 +28,10 @@ public GenericAnalyzerFieldValueType(string fieldName, ILoggerFactory logger, An
///
public override string SortableFieldName => _sortable ? ExamineFieldNames.SortedFieldNamePrefix + FieldName : null;
+ ///
public override Analyzer Analyzer => _analyzer;
+ ///
protected override void AddSingleValue(Document doc, object value)
{
if (TryConvert(value, out var str))
diff --git a/src/Examine.Lucene/Indexing/IIndexFacetValueType.cs b/src/Examine.Lucene/Indexing/IIndexFacetValueType.cs
index 55740e208..1ecb8eb87 100644
--- a/src/Examine.Lucene/Indexing/IIndexFacetValueType.cs
+++ b/src/Examine.Lucene/Indexing/IIndexFacetValueType.cs
@@ -4,13 +4,15 @@
namespace Examine.Lucene.Indexing
{
+ ///
+ /// Represents a facet index value type
+ ///
public interface IIndexFacetValueType
{
///
/// Extracts the facets from the field
///
- ///
- ///
+ ///
///
/// A dictionary of facets for this field
IEnumerable> ExtractFacets(IFacetExtractionContext facetExtractionContext, IFacetField field);
diff --git a/src/Examine.Lucene/Indexing/IIndexFieldValueType.cs b/src/Examine.Lucene/Indexing/IIndexFieldValueType.cs
index 38d68a3ad..243c08e79 100644
--- a/src/Examine.Lucene/Indexing/IIndexFieldValueType.cs
+++ b/src/Examine.Lucene/Indexing/IIndexFieldValueType.cs
@@ -10,13 +10,20 @@ namespace Examine.Lucene.Indexing
///
public interface IIndexFieldValueType
{
+ ///
+ /// The field name
+ ///
string FieldName { get; }
///
/// Returns the sortable field name or null if the value isn't sortable
///
+ /// By default it will not be sortable
string SortableFieldName { get; }
+ ///
+ /// Should the value be stored
+ ///
bool Store { get; }
///
@@ -24,8 +31,18 @@ public interface IIndexFieldValueType
///
Analyzer Analyzer { get; }
+ ///
+ /// Adds a value to the document
+ ///
+ ///
+ ///
void AddValue(Document doc, object value);
-
+
+ ///
+ /// Gets a query as
+ ///
+ ///
+ ///
Query GetQuery(string query);
//IHighlighter GetHighlighter(Query query, Searcher searcher, FacetsLoader facetsLoader);
diff --git a/src/Examine.Lucene/Indexing/IIndexRangeValueType.cs b/src/Examine.Lucene/Indexing/IIndexRangeValueType.cs
index 4a18937d8..e4af04524 100644
--- a/src/Examine.Lucene/Indexing/IIndexRangeValueType.cs
+++ b/src/Examine.Lucene/Indexing/IIndexRangeValueType.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Search;
+using Lucene.Net.Search;
namespace Examine.Lucene.Indexing
{
@@ -7,6 +7,14 @@ namespace Examine.Lucene.Indexing
///
public interface IIndexRangeValueType
{
+ ///
+ /// Gets a query as
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
Query GetQuery(string lower, string upper, bool lowerInclusive = true, bool upperInclusive = true);
}
@@ -16,6 +24,14 @@ public interface IIndexRangeValueType
///
public interface IIndexRangeValueType where T : struct
{
+ ///
+ /// Gets a query as
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
Query GetQuery(T? lower, T? upper, bool lowerInclusive = true, bool upperInclusive = true);
}
-}
\ No newline at end of file
+}
diff --git a/src/Examine.Lucene/Indexing/IndexFieldRangeValueType.cs b/src/Examine.Lucene/Indexing/IndexFieldRangeValueType.cs
index a0b54b01e..07620796f 100644
--- a/src/Examine.Lucene/Indexing/IndexFieldRangeValueType.cs
+++ b/src/Examine.Lucene/Indexing/IndexFieldRangeValueType.cs
@@ -3,15 +3,22 @@
namespace Examine.Lucene.Indexing
{
+ ///
+ /// Used for value range types when the type is known
+ ///
+ ///
public abstract class IndexFieldRangeValueType : IndexFieldValueTypeBase, IIndexRangeValueType, IIndexRangeValueType
where T : struct
{
+ ///
protected IndexFieldRangeValueType(string fieldName, ILoggerFactory logger, bool store = true) : base(fieldName, logger, store)
{
}
+ ///
public abstract Query GetQuery(T? lower, T? upper, bool lowerInclusive = true, bool upperInclusive = true);
+ ///
public Query GetQuery(string lower, string upper, bool lowerInclusive = true, bool upperInclusive = true)
{
var lowerParsed = TryConvert(lower, out var lowerValue);
diff --git a/src/Examine.Lucene/Indexing/IndexFieldValueTypeBase.cs b/src/Examine.Lucene/Indexing/IndexFieldValueTypeBase.cs
index 30a490ea2..4f4e843d5 100644
--- a/src/Examine.Lucene/Indexing/IndexFieldValueTypeBase.cs
+++ b/src/Examine.Lucene/Indexing/IndexFieldValueTypeBase.cs
@@ -8,15 +8,19 @@
namespace Examine.Lucene.Indexing
{
+ ///
public abstract class IndexFieldValueTypeBase : IIndexFieldValueType
{
+ ///
public string FieldName { get; }
- //by default it will not be sortable
+ ///
public virtual string SortableFieldName => null;
+ ///
public bool Store { get; }
+ ///
protected IndexFieldValueTypeBase(string fieldName, ILoggerFactory loggerFactory, bool store = true)
{
FieldName = fieldName;
@@ -24,10 +28,15 @@ protected IndexFieldValueTypeBase(string fieldName, ILoggerFactory loggerFactory
Store = store;
}
+ ///
public virtual Analyzer Analyzer => null;
+ ///
+ /// The logger
+ ///
public ILogger Logger { get; }
+ ///
public virtual void AddValue(Document doc, object value) => AddSingleValueInternal(doc, value);
private void AddSingleValueInternal(Document doc, object value)
@@ -38,6 +47,11 @@ private void AddSingleValueInternal(Document doc, object value)
}
}
+ ///
+ /// Adds a single value to the document
+ ///
+ ///
+ ///
protected abstract void AddSingleValue(Document doc, object value);
///
diff --git a/src/Examine.Lucene/Indexing/Int32Type.cs b/src/Examine.Lucene/Indexing/Int32Type.cs
index 5ac9207ec..dc55820e5 100644
--- a/src/Examine.Lucene/Indexing/Int32Type.cs
+++ b/src/Examine.Lucene/Indexing/Int32Type.cs
@@ -10,16 +10,21 @@
namespace Examine.Lucene.Indexing
{
+ ///
+ /// Represents a Int32
+ ///
public class Int32Type : IndexFieldRangeValueType, IIndexFacetValueType
{
private readonly bool _isFacetable;
+ ///
public Int32Type(string fieldName, ILoggerFactory logger, bool store, bool isFacetable)
: base(fieldName, logger, store)
{
_isFacetable = isFacetable;
}
+ ///
public Int32Type(string fieldName, ILoggerFactory logger, bool store = true)
: base(fieldName, logger, store)
{
@@ -31,6 +36,7 @@ public Int32Type(string fieldName, ILoggerFactory logger, bool store = true)
///
public override string SortableFieldName => FieldName;
+ ///
protected override void AddSingleValue(Document doc, object value)
{
if (!TryConvert(value, out int parsedVal))
@@ -45,11 +51,13 @@ protected override void AddSingleValue(Document doc, object value)
}
}
+ ///
public override Query GetQuery(string query)
{
return !TryConvert(query, out int parsedVal) ? null : GetQuery(parsedVal, parsedVal);
}
+ ///
public override Query GetQuery(int? lower, int? upper, bool lowerInclusive = true, bool upperInclusive = true)
{
return NumericRangeQuery.NewInt32Range(FieldName,
@@ -57,6 +65,7 @@ public override Query GetQuery(int? lower, int? upper, bool lowerInclusive = tru
upper, lowerInclusive, upperInclusive);
}
+ ///
public virtual IEnumerable> ExtractFacets(IFacetExtractionContext facetExtractionContext, IFacetField field)
=> field.ExtractFacets(facetExtractionContext);
}
diff --git a/src/Examine.Lucene/Indexing/Int64Type.cs b/src/Examine.Lucene/Indexing/Int64Type.cs
index 1b55aae55..b2a1f9668 100644
--- a/src/Examine.Lucene/Indexing/Int64Type.cs
+++ b/src/Examine.Lucene/Indexing/Int64Type.cs
@@ -10,16 +10,21 @@
namespace Examine.Lucene.Indexing
{
+ ///
+ /// Represents a Int64
+ ///
public class Int64Type : IndexFieldRangeValueType, IIndexFacetValueType
{
private readonly bool _isFacetable;
+ ///
public Int64Type(string fieldName, ILoggerFactory logger, bool store, bool isFacetable)
: base(fieldName, logger, store)
{
_isFacetable = isFacetable;
}
+ ///
public Int64Type(string fieldName, ILoggerFactory logger, bool store = true)
: base(fieldName, logger, store)
{
@@ -31,6 +36,7 @@ public Int64Type(string fieldName, ILoggerFactory logger, bool store = true)
///
public override string SortableFieldName => FieldName;
+ ///
protected override void AddSingleValue(Document doc, object value)
{
if (!TryConvert(value, out long parsedVal))
@@ -45,17 +51,21 @@ protected override void AddSingleValue(Document doc, object value)
}
}
+ ///
public override Query GetQuery(string query)
{
return !TryConvert(query, out long parsedVal) ? null : GetQuery(parsedVal, parsedVal);
}
+ ///
public override Query GetQuery(long? lower, long? upper, bool lowerInclusive = true, bool upperInclusive = true)
{
return NumericRangeQuery.NewInt64Range(FieldName,
lower,
upper, lowerInclusive, upperInclusive);
}
+
+ ///
public virtual IEnumerable> ExtractFacets(IFacetExtractionContext facetExtractionContext, IFacetField field)
=> field.ExtractFacets(facetExtractionContext);
}
diff --git a/src/Examine.Lucene/Indexing/RawStringType.cs b/src/Examine.Lucene/Indexing/RawStringType.cs
index 68ebf412e..011d41114 100644
--- a/src/Examine.Lucene/Indexing/RawStringType.cs
+++ b/src/Examine.Lucene/Indexing/RawStringType.cs
@@ -18,13 +18,16 @@ public class RawStringType : IndexFieldValueTypeBase
/// Constructor
///
///
+ ///
///
public RawStringType(string fieldName, ILoggerFactory logger, bool store = true)
: base(fieldName, logger, store)
=> _analyzer = new KeywordAnalyzer();
+ ///
public override Analyzer Analyzer => _analyzer;
+ ///
protected override void AddSingleValue(Document doc, object value)
{
switch (value)
diff --git a/src/Examine.Lucene/Indexing/SingleType.cs b/src/Examine.Lucene/Indexing/SingleType.cs
index 6db66b326..48651939a 100644
--- a/src/Examine.Lucene/Indexing/SingleType.cs
+++ b/src/Examine.Lucene/Indexing/SingleType.cs
@@ -10,16 +10,21 @@
namespace Examine.Lucene.Indexing
{
+ ///
+ /// Represents a float/single
+ ///
public class SingleType : IndexFieldRangeValueType, IIndexFacetValueType
{
private readonly bool _isFacetable;
+ ///
public SingleType(string fieldName, ILoggerFactory logger, bool store, bool isFacetable)
: base(fieldName, logger, store)
{
_isFacetable = isFacetable;
}
+ ///
public SingleType(string fieldName, ILoggerFactory logger, bool store = true)
: base(fieldName, logger, store)
{
@@ -31,6 +36,7 @@ public SingleType(string fieldName, ILoggerFactory logger, bool store = true)
///
public override string SortableFieldName => FieldName;
+ ///
protected override void AddSingleValue(Document doc, object value)
{
if (!TryConvert(value, out float parsedVal))
@@ -45,11 +51,13 @@ protected override void AddSingleValue(Document doc, object value)
}
}
+ ///
public override Query GetQuery(string query)
{
return !TryConvert(query, out float parsedVal) ? null : GetQuery(parsedVal, parsedVal);
}
+ ///
public override Query GetQuery(float? lower, float? upper, bool lowerInclusive = true, bool upperInclusive = true)
{
return NumericRangeQuery.NewDoubleRange(FieldName,
@@ -57,6 +65,7 @@ public override Query GetQuery(float? lower, float? upper, bool lowerInclusive =
upper ?? float.MaxValue, lowerInclusive, upperInclusive);
}
+ ///
public virtual IEnumerable> ExtractFacets(IFacetExtractionContext facetExtractionContext, IFacetField field)
=> field.ExtractFacets(facetExtractionContext);
}
diff --git a/src/Examine.Lucene/LoggingReplicationClient.cs b/src/Examine.Lucene/LoggingReplicationClient.cs
index ef70fbe12..e1beafb02 100644
--- a/src/Examine.Lucene/LoggingReplicationClient.cs
+++ b/src/Examine.Lucene/LoggingReplicationClient.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using Lucene.Net.Replicator;
using Microsoft.Extensions.Logging;
@@ -11,6 +11,7 @@ public class LoggingReplicationClient : ReplicationClient
{
private readonly ILogger _logger;
+ ///
public LoggingReplicationClient(
ILogger logger,
IReplicator replicator,
@@ -22,6 +23,7 @@ public LoggingReplicationClient(
InfoStream = new CustomLoggingInfoStream(logger);
}
+ ///
protected override void HandleUpdateException(Exception exception)
=> _logger.LogError(exception, "Index replication error occurred");
diff --git a/src/Examine.Lucene/LuceneDirectoryIndexOptions.cs b/src/Examine.Lucene/LuceneDirectoryIndexOptions.cs
index c4eee23ce..eebf08dea 100644
--- a/src/Examine.Lucene/LuceneDirectoryIndexOptions.cs
+++ b/src/Examine.Lucene/LuceneDirectoryIndexOptions.cs
@@ -4,6 +4,9 @@
namespace Examine.Lucene
{
+ ///
+ /// Represents options for the lucene index
+ ///
public class LuceneDirectoryIndexOptions : LuceneIndexOptions
{
///
diff --git a/src/Examine.Lucene/LuceneIndexOptions.cs b/src/Examine.Lucene/LuceneIndexOptions.cs
index 28b68c7d5..3dca41e83 100644
--- a/src/Examine.Lucene/LuceneIndexOptions.cs
+++ b/src/Examine.Lucene/LuceneIndexOptions.cs
@@ -8,12 +8,19 @@
namespace Examine.Lucene
{
-
+ ///
+ /// Represents options for a lucene index
+ ///
public class LuceneIndexOptions : IndexOptions
{
-
+ ///
+ /// THe index deletion policy
+ ///
public IndexDeletionPolicy IndexDeletionPolicy { get; set; }
+ ///
+ /// The analyzer used in the index
+ ///
public Analyzer Analyzer { get; set; }
///
diff --git a/src/Examine.Lucene/LuceneInfo.cs b/src/Examine.Lucene/LuceneInfo.cs
index 525317a48..448e22850 100644
--- a/src/Examine.Lucene/LuceneInfo.cs
+++ b/src/Examine.Lucene/LuceneInfo.cs
@@ -2,8 +2,14 @@
namespace Examine
{
+ ///
+ /// Information about lucene
+ ///
public static class LuceneInfo
{
+ ///
+ /// Gets the current lucene version
+ ///
public static LuceneVersion CurrentVersion { get; } = LuceneVersion.LUCENE_48;
}
}
diff --git a/src/Examine.Lucene/Providers/BaseLuceneSearcher.cs b/src/Examine.Lucene/Providers/BaseLuceneSearcher.cs
index 8f9b9ecd3..e540b97f7 100644
--- a/src/Examine.Lucene/Providers/BaseLuceneSearcher.cs
+++ b/src/Examine.Lucene/Providers/BaseLuceneSearcher.cs
@@ -19,6 +19,7 @@ public abstract class BaseLuceneSearcher : BaseSearchProvider
///
///
///
+ ///
protected BaseLuceneSearcher(string name, Analyzer analyzer, FacetsConfig facetsConfig)
: base(name)
{
@@ -33,6 +34,10 @@ protected BaseLuceneSearcher(string name, Analyzer analyzer, FacetsConfig facets
///
public Analyzer LuceneAnalyzer { get; }
+ ///
+ /// Gets the seach context
+ ///
+ ///
public abstract ISearchContext GetSearchContext();
///
diff --git a/src/Examine.Lucene/Providers/ErrorCheckingScoringBooleanQueryRewrite.cs b/src/Examine.Lucene/Providers/ErrorCheckingScoringBooleanQueryRewrite.cs
index bff54b6e6..8ae87efeb 100644
--- a/src/Examine.Lucene/Providers/ErrorCheckingScoringBooleanQueryRewrite.cs
+++ b/src/Examine.Lucene/Providers/ErrorCheckingScoringBooleanQueryRewrite.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Security;
using Lucene.Net.Index;
using Lucene.Net.Search;
@@ -24,7 +24,7 @@ namespace Examine.Lucene.Providers
[Serializable]
public class ErrorCheckingScoringBooleanQueryRewrite : MultiTermQuery.RewriteMethod
{
-
+ ///
public override Query Rewrite(IndexReader reader, MultiTermQuery query)
{
//we'll try to use the SCORING_BOOLEAN_QUERY_REWRITE but this can result in TooManyClauses
@@ -92,4 +92,4 @@ public override Query Rewrite(IndexReader reader, MultiTermQuery query)
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Examine.Lucene/Providers/IndexThreadingMode.cs b/src/Examine.Lucene/Providers/IndexThreadingMode.cs
index abb76288a..201c6083e 100644
--- a/src/Examine.Lucene/Providers/IndexThreadingMode.cs
+++ b/src/Examine.Lucene/Providers/IndexThreadingMode.cs
@@ -1,5 +1,8 @@
-namespace Examine.Lucene.Providers
+namespace Examine.Lucene.Providers
{
+ ///
+ /// Represents the threading mode of indexing documents
+ ///
public enum IndexThreadingMode
{
///
diff --git a/src/Examine.Lucene/Providers/LuceneIndex.cs b/src/Examine.Lucene/Providers/LuceneIndex.cs
index f96eb98af..afe0f847d 100644
--- a/src/Examine.Lucene/Providers/LuceneIndex.cs
+++ b/src/Examine.Lucene/Providers/LuceneIndex.cs
@@ -152,6 +152,9 @@ internal LuceneIndex(
///
public Analyzer DefaultAnalyzer { get; }
+ ///
+ /// Gets the field ananlyzer
+ ///
public PerFieldAnalyzerWrapper FieldAnalyzer => _fieldAnalyzer
?? (_fieldAnalyzer =
(DefaultAnalyzer is PerFieldAnalyzerWrapper pfa)
@@ -159,6 +162,9 @@ internal LuceneIndex(
: _fieldValueTypeCollection.Value.Analyzer);
+ ///
+ /// Not used, will be removed in future versions
+ ///
[Obsolete("Not used, will be removed in future versions")]
[EditorBrowsable(EditorBrowsableState.Never)]
public int CommitCount { get; protected internal set; }
@@ -183,6 +189,9 @@ internal LuceneIndex(
///
public event EventHandler DocumentWriting;
+ ///
+ /// Occurs when an index is commited
+ ///
public event EventHandler IndexCommitted;
#endregion
@@ -205,6 +214,10 @@ protected override void OnIndexingError(IndexingErrorEventArgs e)
}
+ ///
+ /// Called when a document in writing
+ ///
+ ///
protected virtual void OnDocumentWriting(DocumentWritingEventArgs docArgs)
=> DocumentWriting?.Invoke(this, docArgs);
@@ -212,6 +225,7 @@ protected virtual void OnDocumentWriting(DocumentWritingEventArgs docArgs)
#region Provider implementation
+ ///
protected override void PerformIndexItems(IEnumerable values, Action onComplete)
{
// need to lock, we don't want to issue any node writing if there's an index rebuild occuring
@@ -641,7 +655,6 @@ private bool IndexExistsImpl()
/// Removes the specified term from the index
///
///
- ///
///
/// Boolean if it successfully deleted the term, or there were on errors
private bool DeleteFromIndex(Term indexTerm, bool performCommit = true)
@@ -681,7 +694,6 @@ private bool DeleteFromIndex(Term indexTerm, bool performCommit = true)
///
///
/// The data to index.
- /// The writer that will be used to update the Lucene index.
protected virtual void AddDocument(Document doc, ValueSet valueSet)
{
if (_logger.IsEnabled(LogLevel.Debug))
@@ -1055,7 +1067,6 @@ private LuceneSearcher CreateSearcher()
/// Deletes the item from the index either by id or by category
///
///
- ///
///
private void ProcessDeleteQueueItem(IndexOperation op, bool performCommit = true)
{
@@ -1214,8 +1225,10 @@ public ForceThreadingModeIndexProcessor(LuceneIndex index, IndexThreadingMode mo
protected override void DisposeResources() => _index.RunAsync = _orig;
}
+ ///
public long GetDocumentCount() => IndexWriter.IndexWriter.NumDocs;
+ ///
public IEnumerable GetFieldNames()
{
var writer = IndexWriter;
@@ -1248,6 +1261,7 @@ private bool RetryUntilSuccessOrTimeout(Func task, TimeSpan timeout, TimeS
return false;
}
+ ///
protected virtual void Dispose(bool disposing)
{
if (!_disposedValue)
@@ -1313,6 +1327,7 @@ protected virtual void Dispose(bool disposing)
}
}
+ ///
public void Dispose() => Dispose(disposing: true);
void ReferenceManager.IRefreshListener.BeforeRefresh() { }
diff --git a/src/Examine.Lucene/Providers/LuceneSearcher.cs b/src/Examine.Lucene/Providers/LuceneSearcher.cs
index 8166f0d3c..7d29f79cc 100644
--- a/src/Examine.Lucene/Providers/LuceneSearcher.cs
+++ b/src/Examine.Lucene/Providers/LuceneSearcher.cs
@@ -20,9 +20,10 @@ public class LuceneSearcher : BaseLuceneSearcher, IDisposable
/// Constructor allowing for creating a NRT instance based on a given writer
///
///
- ///
+ ///
///
///
+ ///
public LuceneSearcher(string name, SearcherManager searcherManager, Analyzer analyzer, FieldValueTypeCollection fieldValueTypeCollection, FacetsConfig facetsConfig)
: base(name, analyzer, facetsConfig)
{
@@ -30,9 +31,11 @@ public LuceneSearcher(string name, SearcherManager searcherManager, Analyzer ana
_fieldValueTypeCollection = fieldValueTypeCollection;
}
+ ///
public override ISearchContext GetSearchContext()
=> new SearchContext(_searcherManager, _fieldValueTypeCollection);
+ ///
protected virtual void Dispose(bool disposing)
{
if (!_disposedValue)
@@ -46,6 +49,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/MultiIndexSearcher.cs b/src/Examine.Lucene/Providers/MultiIndexSearcher.cs
index 7a01d9a59..c490577ff 100644
--- a/src/Examine.Lucene/Providers/MultiIndexSearcher.cs
+++ b/src/Examine.Lucene/Providers/MultiIndexSearcher.cs
@@ -47,9 +47,12 @@ public MultiIndexSearcher(string name, Lazy> searchers, F
///
public IEnumerable Searchers => _searchers.Value.OfType();
- // for tests
+ ///
+ /// Are the searchers initialized
+ ///
public bool SearchersInitialized => _searchers.IsValueCreated;
+ ///
public override ISearchContext GetSearchContext()
=> new MultiSearchContext(Searchers.Select(s => s.GetSearchContext()).ToArray());
diff --git a/src/Examine.Lucene/Providers/ValueSetValidatorDelegate.cs b/src/Examine.Lucene/Providers/ValueSetValidatorDelegate.cs
index 7f2d21137..6492787ab 100644
--- a/src/Examine.Lucene/Providers/ValueSetValidatorDelegate.cs
+++ b/src/Examine.Lucene/Providers/ValueSetValidatorDelegate.cs
@@ -9,9 +9,11 @@ public class ValueSetValidatorDelegate : IValueSetValidator
{
private readonly Func _validator;
+ ///
public ValueSetValidatorDelegate(Func validator)
=> _validator = validator;
+ ///
public ValueSetValidationResult Validate(ValueSet valueSet)
=> _validator(valueSet);
}
diff --git a/src/Examine.Lucene/ReaderStatus.cs b/src/Examine.Lucene/ReaderStatus.cs
index ddec99400..296b133c6 100644
--- a/src/Examine.Lucene/ReaderStatus.cs
+++ b/src/Examine.Lucene/ReaderStatus.cs
@@ -1,9 +1,27 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Examine.Lucene
{
- public enum ReaderStatus { Current, Closed, NotCurrent }
+ ///
+ /// TODO: Is this enum used? (Found 0 references)
+ ///
+ public enum ReaderStatus {
+ ///
+ ///
+ ///
+ Current,
+
+ ///
+ ///
+ ///
+ Closed,
+
+ ///
+ ///
+ ///
+ NotCurrent
+ }
}
diff --git a/src/Examine.Lucene/Search/CustomMultiFieldQueryParser.cs b/src/Examine.Lucene/Search/CustomMultiFieldQueryParser.cs
index d655087f4..a1990a91a 100644
--- a/src/Examine.Lucene/Search/CustomMultiFieldQueryParser.cs
+++ b/src/Examine.Lucene/Search/CustomMultiFieldQueryParser.cs
@@ -14,15 +14,26 @@ namespace Examine.Lucene.Search
///
public class CustomMultiFieldQueryParser : MultiFieldQueryParser
{
-
+ ///
public CustomMultiFieldQueryParser(LuceneVersion matchVersion, string[] fields, Analyzer analyzer)
: base(matchVersion, fields, analyzer)
=> SearchableFields = fields;
internal static QueryParser KeywordAnalyzerQueryParser { get; } = new QueryParser(LuceneInfo.CurrentVersion, string.Empty, new KeywordAnalyzer());
+ ///
+ /// Fields that are searchable by the query parser
+ ///
public string[] SearchableFields { get; }
+ ///
+ /// Gets a fuzzy query
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public virtual Query GetFuzzyQueryInternal(string field, string termStr, float minSimilarity)
{
if (string.IsNullOrWhiteSpace(termStr))
@@ -38,6 +49,7 @@ public virtual Query GetFuzzyQueryInternal(string field, string termStr, float m
///
///
///
+ ///
///
///
/// By Default the lucene query parser only deals with strings and the result is a TermRangeQuery, however for numerics it needs to be a
@@ -52,6 +64,13 @@ protected override Query GetRangeQuery(string field, string part1, string part2,
return base.GetRangeQuery(field, part1, part2, startInclusive, endInclusive);
}
+ ///
+ /// Gets a wildcard query
+ ///
+ ///
+ ///
+ ///
+ ///
public virtual Query GetWildcardQueryInternal(string field, string termStr)
{
if (string.IsNullOrWhiteSpace(termStr))
@@ -75,6 +94,13 @@ public virtual Query GetProximityQueryInternal(string field, string queryText, i
return GetFieldQuery(field, queryText, slop);
}
+ ///
+ /// Gets a query field
+ ///
+ ///
+ ///
+ ///
+ ///
public Query GetFieldQueryInternal(string field, string queryText)
{
if (string.IsNullOrWhiteSpace(queryText))
diff --git a/src/Examine.Lucene/Search/ExamineMultiFieldQueryParser.cs b/src/Examine.Lucene/Search/ExamineMultiFieldQueryParser.cs
index 72f9cca75..8830bd1a3 100644
--- a/src/Examine.Lucene/Search/ExamineMultiFieldQueryParser.cs
+++ b/src/Examine.Lucene/Search/ExamineMultiFieldQueryParser.cs
@@ -12,6 +12,7 @@ public class ExamineMultiFieldQueryParser : CustomMultiFieldQueryParser
{
private readonly ISearchContext _searchContext;
+ ///
public ExamineMultiFieldQueryParser(ISearchContext searchContext, LuceneVersion matchVersion, Analyzer analyzer)
: base(matchVersion, searchContext.SearchableFields, analyzer)
{
@@ -24,7 +25,8 @@ public ExamineMultiFieldQueryParser(ISearchContext searchContext, LuceneVersion
///
///
///
- ///
+ ///
+ ///
///
///
/// By Default the lucene query parser only deals with strings and the result is a TermRangeQuery, however for numerics it needs to be a
diff --git a/src/Examine.Lucene/Search/FacetDoubleField.cs b/src/Examine.Lucene/Search/FacetDoubleField.cs
index e63a76b37..162cd2e07 100644
--- a/src/Examine.Lucene/Search/FacetDoubleField.cs
+++ b/src/Examine.Lucene/Search/FacetDoubleField.cs
@@ -5,15 +5,26 @@
namespace Examine.Lucene.Search
{
+ ///
+ /// Represents a double facet field
+ ///
public readonly struct FacetDoubleField : IFacetField
{
+ ///
+ /// The double ranges for the field
+ ///
public Examine.Search.DoubleRange[] DoubleRanges { get; }
+ ///
public string Field { get; }
+ ///
public string FacetField { get; }
+
+ ///
public bool IsTaxonomyIndexed { get; }
+ ///
public FacetDoubleField(string field, Examine.Search.DoubleRange[] doubleRanges, string facetField, bool isTaxonomyIndexed = false)
{
Field = field;
@@ -22,6 +33,7 @@ public FacetDoubleField(string field, Examine.Search.DoubleRange[] doubleRanges,
IsTaxonomyIndexed = isTaxonomyIndexed;
}
+ ///
public IEnumerable> ExtractFacets(IFacetExtractionContext facetExtractionContext)
{
var doubleFacetCounts = new DoubleRangeFacetCounts(Field, facetExtractionContext.FacetsCollector, DoubleRanges.AsLuceneRange().ToArray());
diff --git a/src/Examine.Lucene/Search/FacetFloatField.cs b/src/Examine.Lucene/Search/FacetFloatField.cs
index 5cdabfdd4..43f75cb9b 100644
--- a/src/Examine.Lucene/Search/FacetFloatField.cs
+++ b/src/Examine.Lucene/Search/FacetFloatField.cs
@@ -6,15 +6,26 @@
namespace Examine.Lucene.Search
{
+ ///
+ /// Represents a float facet field
+ ///
public readonly struct FacetFloatField : IFacetField
{
+ ///
+ /// The float ranges for the field
+ ///
public FloatRange[] FloatRanges { get; }
+ ///
public string Field { get; }
+ ///
public string FacetField { get; }
+
+ ///
public bool IsTaxonomyIndexed { get; }
+ ///
public FacetFloatField(string field, FloatRange[] floatRanges, string facetField, bool isTaxonomyIndexed = false)
{
Field = field;
@@ -23,6 +34,7 @@ public FacetFloatField(string field, FloatRange[] floatRanges, string facetField
IsTaxonomyIndexed = isTaxonomyIndexed;
}
+ ///
public IEnumerable> ExtractFacets(IFacetExtractionContext facetExtractionContext)
{
var floatFacetCounts = new DoubleRangeFacetCounts(Field, new SingleFieldSource(Field), facetExtractionContext.FacetsCollector, FloatRanges.AsLuceneRange().ToArray());
diff --git a/src/Examine.Lucene/Search/FacetFullTextField.cs b/src/Examine.Lucene/Search/FacetFullTextField.cs
index be0fe2617..9a92b2b31 100644
--- a/src/Examine.Lucene/Search/FacetFullTextField.cs
+++ b/src/Examine.Lucene/Search/FacetFullTextField.cs
@@ -5,20 +5,36 @@
namespace Examine.Lucene.Search
{
+ ///
+ /// Represents a full text facet field
+ ///
public class FacetFullTextField : IFacetField
{
+ ///
+ /// Maximum number of terms to return
+ ///
public int MaxCount { get; internal set; }
+ ///
+ /// Filter values
+ ///
public string[] Values { get; }
+ ///
public string Field { get; }
+ ///
public string FacetField { get; }
+ ///
+ /// Path hierachy
+ ///
public string[] Path { get; internal set; }
+ ///
public bool IsTaxonomyIndexed { get; }
+ ///
public FacetFullTextField(string field, string[] values, string facetField, int maxCount = 10, string[] path = null, bool isTaxonomyIndexed = false)
{
Field = field;
@@ -29,6 +45,7 @@ public FacetFullTextField(string field, string[] values, string facetField, int
IsTaxonomyIndexed = isTaxonomyIndexed;
}
+ ///
public IEnumerable> ExtractFacets(IFacetExtractionContext facetExtractionContext)
{
Facets facetCounts = facetExtractionContext.GetFacetCounts(FacetField, false);
diff --git a/src/Examine.Lucene/Search/FacetLongField.cs b/src/Examine.Lucene/Search/FacetLongField.cs
index cee6a2214..3b31f1fe8 100644
--- a/src/Examine.Lucene/Search/FacetLongField.cs
+++ b/src/Examine.Lucene/Search/FacetLongField.cs
@@ -7,15 +7,26 @@
namespace Examine.Lucene.Search
{
+ ///
+ /// Represents a long facet field
+ ///
public readonly struct FacetLongField : IFacetField
{
+ ///
public string Field { get; }
+ ///
+ /// The long ranges
+ ///
public Examine.Search.Int64Range[] LongRanges { get; }
+ ///
public string FacetField { get; }
+
+ ///
public bool IsTaxonomyIndexed { get; }
+ ///
public FacetLongField(string field, Examine.Search.Int64Range[] longRanges, string facetField, bool isTaxonomyIndexed = false)
{
Field = field;
@@ -24,6 +35,7 @@ public FacetLongField(string field, Examine.Search.Int64Range[] longRanges, stri
IsTaxonomyIndexed = isTaxonomyIndexed;
}
+ ///
public IEnumerable> ExtractFacets(IFacetExtractionContext facetExtractionContext)
{
var longFacetCounts = new Int64RangeFacetCounts(Field, facetExtractionContext.FacetsCollector, LongRanges.AsLuceneRange().ToArray());
diff --git a/src/Examine.Lucene/Search/FacetQueryField.cs b/src/Examine.Lucene/Search/FacetQueryField.cs
index d6a50513e..d967c9fd8 100644
--- a/src/Examine.Lucene/Search/FacetQueryField.cs
+++ b/src/Examine.Lucene/Search/FacetQueryField.cs
@@ -2,10 +2,14 @@
namespace Examine.Lucene.Search
{
+ ///
+ /// Represents a default facet query field (FullText)
+ ///
public class FacetQueryField : IFacetQueryField
{
private readonly FacetFullTextField _field;
+ ///
public FacetQueryField(FacetFullTextField field)
{
_field = field;
@@ -19,6 +23,7 @@ public IFacetQueryField MaxCount(int count)
return this;
}
+ ///
public IFacetQueryField SetPath(params string[] path)
{
_field.Path = path;
diff --git a/src/Examine.Lucene/Search/IFacetField.cs b/src/Examine.Lucene/Search/IFacetField.cs
index bd4f66326..5ef888a54 100644
--- a/src/Examine.Lucene/Search/IFacetField.cs
+++ b/src/Examine.Lucene/Search/IFacetField.cs
@@ -3,6 +3,9 @@
namespace Examine.Lucene.Search
{
+ ///
+ /// Represents a base facet field
+ ///
public interface IFacetField
{
///
@@ -23,8 +26,7 @@ public interface IFacetField
///
/// Extracts the facets from the field
///
- ///
- ///
+ ///
/// Returns the facets for this field
IEnumerable> ExtractFacets(IFacetExtractionContext facetExtractionContext);
}
diff --git a/src/Examine.Lucene/Search/ISearchContext.cs b/src/Examine.Lucene/Search/ISearchContext.cs
index 205a843dc..a3f4510bd 100644
--- a/src/Examine.Lucene/Search/ISearchContext.cs
+++ b/src/Examine.Lucene/Search/ISearchContext.cs
@@ -3,11 +3,27 @@
namespace Examine.Lucene.Search
{
+ ///
+ /// Represents a search context
+ ///
public interface ISearchContext
{
+ ///
+ /// Gets the searcher of the context
+ ///
+ ///
ISearcherReference GetSearcher();
+ ///
+ /// The searchable fields of a search context
+ ///
string[] SearchableFields { get; }
+
+ ///
+ /// Gets the field value type of a field name
+ ///
+ ///
+ ///
IIndexFieldValueType GetFieldValueType(string fieldName);
}
}
diff --git a/src/Examine.Lucene/Search/ISearcherReference.cs b/src/Examine.Lucene/Search/ISearcherReference.cs
index 2c5d5dba8..476f02d5a 100644
--- a/src/Examine.Lucene/Search/ISearcherReference.cs
+++ b/src/Examine.Lucene/Search/ISearcherReference.cs
@@ -1,11 +1,17 @@
-using System;
+using System;
using Lucene.Net.Search;
namespace Examine.Lucene.Search
{
- // Dispose will release it from the manager
+ ///
+ /// Represents a searcher reference
+ ///
+ /// Dispose will release it from the manager
public interface ISearcherReference : IDisposable
{
+ ///
+ /// The index searcher
+ ///
IndexSearcher IndexSearcher { get; }
}
}
diff --git a/src/Examine.Lucene/Search/LateBoundQuery.cs b/src/Examine.Lucene/Search/LateBoundQuery.cs
index baffff111..88f0b5721 100644
--- a/src/Examine.Lucene/Search/LateBoundQuery.cs
+++ b/src/Examine.Lucene/Search/LateBoundQuery.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using Lucene.Net.Index;
using Lucene.Net.Search;
@@ -6,23 +6,33 @@
namespace Examine.Lucene.Search
{
+ ///
+ /// Represents a late bound query
+ ///
public class LateBoundQuery : Query
{
private readonly Func _factory;
private Query _wrapped;
+
+ ///
+ /// The wrapped query
+ ///
public Query Wrapped => _wrapped ?? (_wrapped = _factory());
+ ///
public LateBoundQuery(Func factory)
{
_factory = factory;
}
+ ///
public override object Clone()
{
return Wrapped.Clone();
}
+ ///
public override Weight CreateWeight(IndexSearcher searcher)
{
return Wrapped.CreateWeight(searcher);
@@ -49,19 +59,16 @@ public override float Boost
set => Wrapped.Boost = value;
}
-
-
+ ///
public override Query Rewrite(IndexReader reader)
{
return Wrapped.Rewrite(reader);
}
-
-
-
+ ///
public override string ToString(string field)
{
return Wrapped.ToString(field);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Examine.Lucene/Search/LuceneBooleanOperation.cs b/src/Examine.Lucene/Search/LuceneBooleanOperation.cs
index 8d104b9d5..ea53a010b 100644
--- a/src/Examine.Lucene/Search/LuceneBooleanOperation.cs
+++ b/src/Examine.Lucene/Search/LuceneBooleanOperation.cs
@@ -14,7 +14,8 @@ namespace Examine.Lucene.Search
public class LuceneBooleanOperation : LuceneBooleanOperationBase, IQueryExecutor
{
private readonly LuceneSearchQuery _search;
-
+
+ ///
public LuceneBooleanOperation(LuceneSearchQuery search)
: base(search)
{
@@ -45,28 +46,36 @@ public LuceneBooleanOperation(LuceneSearchQuery search)
#endregion
+ ///
public override ISearchResults Execute(QueryOptions options = null) => _search.Execute(options);
#region IOrdering
+ ///
public override IOrdering OrderBy(params SortableField[] fields) => _search.OrderBy(fields);
+ ///
public override IOrdering OrderByDescending(params SortableField[] fields) => _search.OrderByDescending(fields);
#endregion
#region Select Fields
+ ///
public override IOrdering SelectFields(ISet fieldNames) => _search.SelectFieldsInternal(fieldNames);
+ ///
public override IOrdering SelectField(string fieldName) => _search.SelectFieldInternal(fieldName);
+ ///
public override IOrdering SelectAllFields() => _search.SelectAllFieldsInternal();
#endregion
+ ///
public override string ToString() => _search.ToString();
+ ///
public override IQueryExecutor WithFacets(Action facets)
{
var luceneFacetOperation = new LuceneFacetOperation(_search);
diff --git a/src/Examine.Lucene/Search/LuceneBooleanOperationBase.cs b/src/Examine.Lucene/Search/LuceneBooleanOperationBase.cs
index 781ce3256..b6b91ade8 100644
--- a/src/Examine.Lucene/Search/LuceneBooleanOperationBase.cs
+++ b/src/Examine.Lucene/Search/LuceneBooleanOperationBase.cs
@@ -5,30 +5,71 @@
namespace Examine.Lucene.Search
{
+ ///
+ /// Represents the base for a
+ ///
public abstract class LuceneBooleanOperationBase : IBooleanOperation, INestedBooleanOperation, IOrdering, IFaceting
{
private readonly LuceneSearchQueryBase _search;
+ ///
protected LuceneBooleanOperationBase(LuceneSearchQueryBase search)
{
_search = search;
}
+ ///
public abstract IQuery And();
+
+ ///
public abstract IQuery Or();
+
+ ///
public abstract IQuery Not();
+ ///
+ /// Allows for adding more operations to a query using the and operator
+ ///
+ ///
+ ///
+ ///
public IBooleanOperation And(Func inner, BooleanOperation defaultOp = BooleanOperation.And)
=> Op(inner, BooleanOperation.And, defaultOp);
+ ///
+ /// Allows for adding more operations to a query using the or operator
+ ///
+ ///
+ ///
+ ///
public IBooleanOperation Or(Func inner, BooleanOperation defaultOp = BooleanOperation.And)
=> Op(inner, BooleanOperation.Or, defaultOp);
+ ///
+ /// Allows for adding more operations to a query using the and not operator
+ ///
+ ///
+ ///
+ ///
public IBooleanOperation AndNot(Func inner, BooleanOperation defaultOp = BooleanOperation.And)
=> Op(inner, BooleanOperation.Not, defaultOp);
+ ///
+ /// Allows for adding more operations to a query using a nested and
+ ///
+ ///
protected abstract INestedQuery AndNested();
+
+ ///
+ /// Allows for adding more operations to a query using a nested or
+ ///
+ ///
protected abstract INestedQuery OrNested();
+
+ ///
+ /// Allows for adding more operations to a query iusing a nested not
+ ///
+ ///
protected abstract INestedQuery NotNested();
INestedQuery INestedBooleanOperation.And() => AndNested();
@@ -44,6 +85,13 @@ INestedBooleanOperation INestedBooleanOperation.Or(Func inner, BooleanOperation defaultOp)
=> Op(inner, BooleanOperation.Not, defaultOp);
+ ///
+ /// Used to add a operation
+ ///
+ ///
+ ///
+ ///
+ ///
protected internal LuceneBooleanOperationBase Op(
Func inner,
BooleanOperation outerOp,
@@ -70,14 +118,25 @@ protected internal LuceneBooleanOperationBase Op(
return _search.LuceneQuery(_search.Queries.Pop(), outerOp);
}
+ ///
public abstract ISearchResults Execute(QueryOptions options = null);
+
+ ///
public abstract IOrdering OrderBy(params SortableField[] fields);
+
+ ///
public abstract IOrdering OrderByDescending(params SortableField[] fields);
+ ///
public abstract IOrdering SelectFields(ISet fieldNames);
+
+ ///
public abstract IOrdering SelectField(string fieldName);
+
+ ///
public abstract IOrdering SelectAllFields();
+ ///
public abstract IQueryExecutor WithFacets(Action facets);
}
}
diff --git a/src/Examine.Lucene/Search/LuceneFacetExtractionContext.cs b/src/Examine.Lucene/Search/LuceneFacetExtractionContext.cs
index 9d0f50ef3..44517ffea 100644
--- a/src/Examine.Lucene/Search/LuceneFacetExtractionContext.cs
+++ b/src/Examine.Lucene/Search/LuceneFacetExtractionContext.cs
@@ -1,43 +1,47 @@
using Lucene.Net.Facet.SortedSet;
using Lucene.Net.Facet;
using System;
-using Examine.Lucene.Search;
-public class LuceneFacetExtractionContext : IFacetExtractionContext
+namespace Examine.Lucene.Search
{
+ ///
+ public class LuceneFacetExtractionContext : IFacetExtractionContext
+ {
- private SortedSetDocValuesReaderState _sortedSetReaderState = null;
+ private SortedSetDocValuesReaderState _sortedSetReaderState = null;
- public LuceneFacetExtractionContext(FacetsCollector facetsCollector, ISearcherReference searcherReference, FacetsConfig facetConfig)
- {
- FacetsCollector = facetsCollector;
- FacetConfig = facetConfig;
- SearcherReference = searcherReference;
- }
+ ///
+ public LuceneFacetExtractionContext(FacetsCollector facetsCollector, ISearcherReference searcherReference, FacetsConfig facetConfig)
+ {
+ FacetsCollector = facetsCollector;
+ FacetConfig = facetConfig;
+ SearcherReference = searcherReference;
+ }
- ///
- public FacetsCollector FacetsCollector { get; }
+ ///
+ public FacetsCollector FacetsCollector { get; }
- ///
- public FacetsConfig FacetConfig { get; }
+ ///
+ public FacetsConfig FacetConfig { get; }
- ///
- public ISearcherReference SearcherReference { get; }
+ ///
+ public ISearcherReference SearcherReference { get; }
- ///
- public virtual Facets GetFacetCounts(string facetIndexFieldName, bool isTaxonomyIndexed)
- {
- if (isTaxonomyIndexed)
+ ///
+ public virtual Facets GetFacetCounts(string facetIndexFieldName, bool isTaxonomyIndexed)
{
- throw new NotSupportedException("Taxonomy Index not supported");
- }
- else
- {
- if (_sortedSetReaderState == null || !_sortedSetReaderState.Field.Equals(facetIndexFieldName))
+ if (isTaxonomyIndexed)
+ {
+ throw new NotSupportedException("Taxonomy Index not supported");
+ }
+ else
{
- _sortedSetReaderState = new DefaultSortedSetDocValuesReaderState(SearcherReference.IndexSearcher.IndexReader, facetIndexFieldName);
+ if (_sortedSetReaderState == null || !_sortedSetReaderState.Field.Equals(facetIndexFieldName))
+ {
+ _sortedSetReaderState = new DefaultSortedSetDocValuesReaderState(SearcherReference.IndexSearcher.IndexReader, facetIndexFieldName);
+ }
+ return new SortedSetDocValuesFacetCounts(_sortedSetReaderState, FacetsCollector);
}
- return new SortedSetDocValuesFacetCounts(_sortedSetReaderState, FacetsCollector);
}
}
}
diff --git a/src/Examine.Lucene/Search/LuceneFacetOperation.cs b/src/Examine.Lucene/Search/LuceneFacetOperation.cs
index 1ff67b613..4b5d1d46d 100644
--- a/src/Examine.Lucene/Search/LuceneFacetOperation.cs
+++ b/src/Examine.Lucene/Search/LuceneFacetOperation.cs
@@ -16,23 +16,31 @@ public class LuceneFacetOperation : IFacetOperations
{
private readonly LuceneSearchQuery _search;
+ ///
public LuceneFacetOperation(LuceneSearchQuery search)
{
_search = search;
}
+ ///
public ISearchResults Execute(QueryOptions options = null) => _search.Execute(options);
+ ///
public IFacetOperations Facet(string field, Action facetConfiguration = null) => _search.FacetInternal(field, facetConfiguration, Array.Empty());
+ ///
public IFacetOperations Facet(string field, Action facetConfiguration = null, params string[] values) => _search.FacetInternal(field, facetConfiguration, values);
+ ///
public IFacetOperations Facet(string field, params DoubleRange[] doubleRanges) => _search.FacetInternal(field, doubleRanges);
+ ///
public IFacetOperations Facet(string field, params FloatRange[] floatRanges) => _search.FacetInternal(field, floatRanges);
+ ///
public IFacetOperations Facet(string field, params Int64Range[] longRanges) => _search.FacetInternal(field, longRanges);
+ ///
public override string ToString() => _search.ToString();
}
}
diff --git a/src/Examine.Lucene/Search/LuceneQuery.cs b/src/Examine.Lucene/Search/LuceneQuery.cs
index bb0c77ef0..588528da8 100644
--- a/src/Examine.Lucene/Search/LuceneQuery.cs
+++ b/src/Examine.Lucene/Search/LuceneQuery.cs
@@ -8,6 +8,9 @@
namespace Examine.Lucene.Search
{
+ ///
+ /// Represents a lucene query
+ ///
public class LuceneQuery : IQuery, INestedQuery
{
private readonly LuceneSearchQuery _search;
@@ -25,43 +28,59 @@ public LuceneQuery(LuceneSearchQuery search, Occur occurrence)
_occurrence = occurrence;
}
+ ///
public IBooleanOperation Field(string fieldName, T fieldValue) where T : struct
=> RangeQuery(new[] { fieldName }, fieldValue, fieldValue);
+ ///
public IBooleanOperation Field(string fieldName, string fieldValue)
=> _search.FieldInternal(fieldName, new ExamineValue(Examineness.Explicit, fieldValue), _occurrence);
+ ///
public IBooleanOperation Field(string fieldName, IExamineValue fieldValue)
=> _search.FieldInternal(fieldName, fieldValue, _occurrence);
+ ///
public IBooleanOperation GroupedAnd(IEnumerable fields, params string[] query)
=> _search.GroupedAndInternal(fields.ToArray(), query.Select(f => new ExamineValue(Examineness.Explicit, f)).Cast().ToArray(), _occurrence);
+ ///
public IBooleanOperation GroupedAnd(IEnumerable fields, params IExamineValue[] query)
=> _search.GroupedAndInternal(fields.ToArray(), query, _occurrence);
+ ///
public IBooleanOperation GroupedOr(IEnumerable fields, params string[] query)
=> _search.GroupedOrInternal(fields.ToArray(), query.Select(f => new ExamineValue(Examineness.Explicit, f)).Cast().ToArray(), _occurrence);
+ ///
public IBooleanOperation GroupedOr(IEnumerable fields, params IExamineValue[] query)
=> _search.GroupedOrInternal(fields.ToArray(), query, _occurrence);
+ ///
public IBooleanOperation GroupedNot(IEnumerable fields, params string[] query)
=> _search.GroupedNotInternal(fields.ToArray(), query.Select(f => new ExamineValue(Examineness.Explicit, f)).Cast().ToArray());
+ ///
public IBooleanOperation GroupedNot(IEnumerable fields, params IExamineValue[] query)
=> _search.GroupedNotInternal(fields.ToArray(), query);
+ ///
public IOrdering All() => _search.All();
+ ///
public IBooleanOperation ManagedQuery(string query, string[] fields = null)
=> _search.ManagedQueryInternal(query, fields, _occurrence);
+ ///
public IBooleanOperation RangeQuery(string[] fields, T? min, T? max, bool minInclusive = true, bool maxInclusive = true) where T : struct
=> _search.RangeQueryInternal(fields, min, max, minInclusive: minInclusive, maxInclusive: maxInclusive, _occurrence);
+ ///
+ /// The category of the query
+ ///
public string Category => _search.Category;
+ ///
public IBooleanOperation NativeQuery(string query) => _search.NativeQuery(query);
///
@@ -72,38 +91,50 @@ public IBooleanOperation Group(Func inner
return bo;
}
+ ///
public IBooleanOperation Id(string id) => _search.IdInternal(id, _occurrence);
+ ///
INestedBooleanOperation INestedQuery.Field(string fieldName, T fieldValue)
=> _search.RangeQueryInternal(new[] { fieldName }, fieldValue, fieldValue, true, true, _occurrence);
+ ///
INestedBooleanOperation INestedQuery.Field(string fieldName, string fieldValue)
=> _search.FieldInternal(fieldName, new ExamineValue(Examineness.Explicit, fieldValue), _occurrence);
+ ///
INestedBooleanOperation INestedQuery.Field(string fieldName, IExamineValue fieldValue)
=> _search.FieldInternal(fieldName, fieldValue, _occurrence);
+ ///
INestedBooleanOperation INestedQuery.GroupedAnd(IEnumerable fields, params string[] query)
=> _search.GroupedAndInternal(fields.ToArray(), query.Select(f => new ExamineValue(Examineness.Explicit, f)).Cast().ToArray(), _occurrence);
+ ///
INestedBooleanOperation INestedQuery.GroupedAnd(IEnumerable fields, params IExamineValue[] query)
=> _search.GroupedAndInternal(fields.ToArray(), query, _occurrence);
+ ///
INestedBooleanOperation INestedQuery.GroupedOr(IEnumerable fields, params string[] query)
=> _search.GroupedOrInternal(fields.ToArray(), query.Select(f => new ExamineValue(Examineness.Explicit, f)).Cast().ToArray(), _occurrence);
+ ///
INestedBooleanOperation INestedQuery.GroupedOr(IEnumerable fields, params IExamineValue[] query)
=> _search.GroupedOrInternal(fields.ToArray(), query, _occurrence);
+ ///
INestedBooleanOperation INestedQuery.GroupedNot(IEnumerable fields, params string[] query)
=> _search.GroupedNotInternal(fields.ToArray(), query.Select(f => new ExamineValue(Examineness.Explicit, f)).Cast().ToArray());
+ ///
INestedBooleanOperation INestedQuery.GroupedNot(IEnumerable fields, params IExamineValue[] query)
=> _search.GroupedNotInternal(fields.ToArray(), query);
+ ///
INestedBooleanOperation INestedQuery.ManagedQuery(string query, string[] fields)
=> _search.ManagedQueryInternal(query, fields, _occurrence);
+ ///
INestedBooleanOperation INestedQuery.RangeQuery(string[] fields, T? min, T? max, bool minInclusive, bool maxInclusive)
=> _search.RangeQueryInternal(fields, min, max, minInclusive: minInclusive, maxInclusive: maxInclusive, _occurrence);
}
diff --git a/src/Examine.Lucene/Search/LuceneSearchExecutor.cs b/src/Examine.Lucene/Search/LuceneSearchExecutor.cs
index 109d63baf..9c00d7184 100644
--- a/src/Examine.Lucene/Search/LuceneSearchExecutor.cs
+++ b/src/Examine.Lucene/Search/LuceneSearchExecutor.cs
@@ -52,6 +52,10 @@ private int MaxDoc
}
}
+ ///
+ /// Executes a query
+ ///
+ ///
public ISearchResults Execute()
{
var extractTermsSupported = CheckQueryForExtractTerms(_luceneQuery);
@@ -197,7 +201,7 @@ private ISearchResult GetSearchResult(int index, TopDocs topDocs, IndexSearcher
}
///
- /// Creates the search result from a
+ /// Creates the search result from a
///
/// The doc to convert.
/// The score.
diff --git a/src/Examine.Lucene/Search/LuceneSearchOptions.cs b/src/Examine.Lucene/Search/LuceneSearchOptions.cs
index 1f2539de6..6435afe17 100644
--- a/src/Examine.Lucene/Search/LuceneSearchOptions.cs
+++ b/src/Examine.Lucene/Search/LuceneSearchOptions.cs
@@ -10,71 +10,71 @@ namespace Examine.Lucene.Search
///
public class LuceneSearchOptions
{
- //
- // Summary:
- // Whether terms of multi-term queries (e.g., wildcard, prefix, fuzzy and range)
- // should be automatically lower-cased or not. Default is true.
+ ///
+ /// Whether terms of multi-term queries (e.g., wildcard, prefix, fuzzy and range)
+ /// should be automatically lower-cased or not. Default is true.
+ ///
public bool? LowercaseExpandedTerms { get; set; }
- //
- // Summary:
- // Set to true to allow leading wildcard characters.
- // When set, * or ? are allowed as the first character of a Lucene.Net.Search.PrefixQuery
- // and Lucene.Net.Search.WildcardQuery. Note that this can produce very slow queries
- // on big indexes.
- // Default: false.
+ ///
+ /// Set to true to allow leading wildcard characters.
+ /// When set, * or ? are allowed as the first character of a Lucene.Net.Search.PrefixQuery
+ /// and Lucene.Net.Search.WildcardQuery. Note that this can produce very slow queries
+ /// on big indexes.
+ /// Default: false.
+ ///
public bool? AllowLeadingWildcard { get; set; }
- //
- // Summary:
- // Set to true to enable position increments in result query.
- // When set, result phrase and multi-phrase queries will be aware of position increments.
- // Useful when e.g. a Lucene.Net.Analysis.Core.StopFilter increases the position
- // increment of the token that follows an omitted token.
- // Default: false.
+ ///
+ /// Set to true to enable position increments in result query.
+ /// When set, result phrase and multi-phrase queries will be aware of position increments.
+ /// Useful when e.g. a Lucene.Net.Analysis.Core.StopFilter increases the position
+ /// increment of the token that follows an omitted token.
+ /// Default: false.
+ ///
public bool? EnablePositionIncrements { get; set; }
- //
- // Summary:
- // By default, it uses Lucene.Net.Search.MultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULT
- // when creating a prefix, wildcard and range queries. This implementation is generally
- // preferable because it a) Runs faster b) Does not have the scarcity of terms unduly
- // influence score c) avoids any exception due to too many listeners. However, if
- // your application really needs to use the old-fashioned boolean queries expansion
- // rewriting and the above points are not relevant then use this change the rewrite
- // method.
+ ///
+ /// By default, it uses Lucene.Net.Search.MultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULT
+ /// when creating a prefix, wildcard and range queries. This implementation is generally
+ /// preferable because it a) Runs faster b) Does not have the scarcity of terms unduly
+ /// influence score c) avoids any exception due to too many listeners. However, if
+ /// your application really needs to use the old-fashioned boolean queries expansion
+ /// rewriting and the above points are not relevant then use this change the rewrite
+ /// method.
+ ///
public MultiTermQuery.RewriteMethod MultiTermRewriteMethod { get; set; }
- //
- // Summary:
- // Get or Set the prefix length for fuzzy queries. Default is 0.
+ ///
+ /// Get or Set the prefix length for fuzzy queries. Default is 0.
+ ///
public int? FuzzyPrefixLength { get; set; }
- //
- // Summary:
- // Get or Set locale used by date range parsing.
+ ///
+ /// Get or Set locale used by date range parsing.
+ ///
public CultureInfo Locale { get; set; }
- //
- // Summary:
- // Gets or Sets the time zone.
+ ///
+ /// Gets or Sets the time zone.
+ ///
public TimeZoneInfo TimeZone { get; set; }
- //
- // Summary:
- // Gets or Sets the default slop for phrases. If zero, then exact phrase matches
- // are required. Default value is zero.
+ ///
+ /// Gets or Sets the default slop for phrases. If zero, then exact phrase matches
+ /// are required. Default value is zero.
+ ///
public int? PhraseSlop { get; set; }
- //
- // Summary:
- // Get the minimal similarity for fuzzy queries.
+ ///
+ /// Get the minimal similarity for fuzzy queries.
+ ///
public float? FuzzyMinSim { get; set; }
- //
- // Summary:
- // Sets the default Lucene.Net.Documents.DateTools.Resolution used for certain field
- // when no Lucene.Net.Documents.DateTools.Resolution is defined for this field.
+ ///
+ /// Sets the default Lucene.Net.Documents.DateTools.Resolution used for certain field
+ /// when no Lucene.Net.Documents.DateTools.Resolution is defined for this field.
+ ///
public DateResolution? DateResolution { get; set; }
}
}
diff --git a/src/Examine.Lucene/Search/LuceneSearchQuery.cs b/src/Examine.Lucene/Search/LuceneSearchQuery.cs
index fad9e8965..9ee85b31c 100644
--- a/src/Examine.Lucene/Search/LuceneSearchQuery.cs
+++ b/src/Examine.Lucene/Search/LuceneSearchQuery.cs
@@ -21,6 +21,7 @@ public class LuceneSearchQuery : LuceneSearchQueryBase, IQueryExecutor
private ISet _fieldsToLoad = null;
private readonly IList _facetFields = new List();
+ ///
public LuceneSearchQuery(
ISearchContext searchContext,
string category, Analyzer analyzer, LuceneSearchOptions searchOptions, BooleanOperation occurance, FacetsConfig facetsConfig)
@@ -81,25 +82,41 @@ private static CustomMultiFieldQueryParser CreateQueryParser(ISearchContext sear
return parser;
}
+ ///
+ /// Sets the order by of the query
+ ///
+ ///
+ ///
public virtual IBooleanOperation OrderBy(params SortableField[] fields) => OrderByInternal(false, fields);
+ ///
+ /// Sets the order by of the query in a descending manner
+ ///
+ ///
+ ///
public virtual IBooleanOperation OrderByDescending(params SortableField[] fields) => OrderByInternal(true, fields);
+ ///
public override IBooleanOperation Field(string fieldName, T fieldValue)
=> RangeQueryInternal(new[] { fieldName }, fieldValue, fieldValue, true, true, Occurrence);
+ ///
public override IBooleanOperation ManagedQuery(string query, string[] fields = null)
=> ManagedQueryInternal(query, fields, Occurrence);
+ ///
public override IBooleanOperation RangeQuery(string[] fields, T? min, T? max, bool minInclusive = true, bool maxInclusive = true)
=> RangeQueryInternal(fields, min, max, minInclusive, maxInclusive, Occurrence);
+ ///
protected override INestedBooleanOperation FieldNested(string fieldName, T fieldValue)
=> RangeQueryInternal(new[] { fieldName }, fieldValue, fieldValue, true, true, Occurrence);
+ ///
protected override INestedBooleanOperation ManagedQueryNested(string query, string[] fields = null)
=> ManagedQueryInternal(query, fields, Occurrence);
+ ///
protected override INestedBooleanOperation RangeQueryNested(string[] fields, T? min, T? max, bool minInclusive = true, bool maxInclusive = true)
=> RangeQueryInternal(fields, min, max, minInclusive, maxInclusive, Occurrence);
@@ -305,12 +322,20 @@ internal IBooleanOperation SelectFieldInternal(string fieldName)
return CreateOp();
}
+ ///
+ /// Selects all fields
+ ///
+ ///
public IBooleanOperation SelectAllFieldsInternal()
{
_fieldsToLoad = null;
return CreateOp();
}
+ ///
+ /// Creates a new
+ ///
+ ///
protected override LuceneBooleanOperationBase CreateOp() => new LuceneBooleanOperation(this);
internal IFacetOperations FacetInternal(string field, Action facetConfiguration, params string[] values)
diff --git a/src/Examine.Lucene/Search/LuceneSearchQueryBase.cs b/src/Examine.Lucene/Search/LuceneSearchQueryBase.cs
index 6995701a9..dc023755d 100644
--- a/src/Examine.Lucene/Search/LuceneSearchQueryBase.cs
+++ b/src/Examine.Lucene/Search/LuceneSearchQueryBase.cs
@@ -9,19 +9,37 @@
namespace Examine.Lucene.Search
{
+ ///
+ /// Represents a base for
+ ///
public abstract class LuceneSearchQueryBase : IQuery, INestedQuery
{
private readonly CustomMultiFieldQueryParser _queryParser;
+
+ ///
+ /// The query parser of the query
+ ///
public QueryParser QueryParser => _queryParser;
internal Stack Queries { get; } = new Stack();
+
+ ///
+ /// The
+ ///
public BooleanQuery Query => Queries.Peek();
+ ///
+ /// The sort fields of the query
+ ///
public IList SortFields { get; } = new List();
+ ///
+ /// Specifies how clauses are to occur in matching documents
+ ///
protected Occur Occurrence { get; set; }
private BooleanOperation _boolOp;
+ ///
protected LuceneSearchQueryBase(CustomMultiFieldQueryParser queryParser,
string category, LuceneSearchOptions searchOptions, BooleanOperation occurance)
{
@@ -32,8 +50,15 @@ protected LuceneSearchQueryBase(CustomMultiFieldQueryParser queryParser,
_queryParser = queryParser;
}
+ ///
+ /// Creates a
+ ///
+ ///
protected abstract LuceneBooleanOperationBase CreateOp();
+ ///
+ /// The type of boolean operation
+ ///
public BooleanOperation BooleanOperation
{
get => _boolOp;
@@ -44,10 +69,19 @@ public BooleanOperation BooleanOperation
}
}
+ ///
+ /// The category of the query
+ ///
public string Category { get; }
+ ///
+ /// All the searchable fields of the query
+ ///
public string[] AllFields => _queryParser.SearchableFields;
+ ///
+ /// The query search options
+ ///
public LuceneSearchOptions SearchOptions { get; }
///
@@ -58,6 +92,7 @@ public IBooleanOperation Group(Func inner
return bo;
}
+ ///
public IOrdering All()
{
Query.Add(new MatchAllDocsQuery(), BooleanOperation.ToLuceneOccurrence());
@@ -83,21 +118,31 @@ public LuceneBooleanOperationBase LuceneQuery(Query query, BooleanOperation? op
return CreateOp();
}
+ ///
public IBooleanOperation Id(string id) => IdInternal(id, Occurrence);
+ ///
public abstract IBooleanOperation Field(string fieldName, T fieldValue) where T : struct;
+
+ ///
public abstract IBooleanOperation ManagedQuery(string query, string[] fields = null);
+
+ ///
public abstract IBooleanOperation RangeQuery(string[] fields, T? min, T? max, bool minInclusive = true, bool maxInclusive = true) where T : struct;
+ ///
public IBooleanOperation Field(string fieldName, string fieldValue)
=> FieldInternal(fieldName, new ExamineValue(Examineness.Explicit, fieldValue), Occurrence);
+ ///
public IBooleanOperation Field(string fieldName, IExamineValue fieldValue)
=> FieldInternal(fieldName, fieldValue, Occurrence);
+ ///
public IBooleanOperation GroupedAnd(IEnumerable fields, params string[] query)
=> GroupedAnd(fields, query?.Select(f => new ExamineValue(Examineness.Explicit, f)).Cast().ToArray());
+ ///
public IBooleanOperation GroupedAnd(IEnumerable fields, params IExamineValue[] fieldVals)
{
if (fields == null)
@@ -108,9 +153,11 @@ public IBooleanOperation GroupedAnd(IEnumerable fields, params IExamineV
return GroupedAndInternal(fields.ToArray(), fieldVals, Occurrence);
}
+ ///
public IBooleanOperation GroupedOr(IEnumerable fields, params string[] query)
=> GroupedOr(fields, query?.Select(f => new ExamineValue(Examineness.Explicit, f)).Cast().ToArray());
+ ///
public IBooleanOperation GroupedOr(IEnumerable fields, params IExamineValue[] query)
{
if (fields == null)
@@ -121,9 +168,11 @@ public IBooleanOperation GroupedOr(IEnumerable fields, params IExamineVa
return GroupedOrInternal(fields.ToArray(), query, Occurrence);
}
+ ///
public IBooleanOperation GroupedNot(IEnumerable fields, params string[] query)
=> GroupedNot(fields, query.Select(f => new ExamineValue(Examineness.Explicit, f)).Cast().ToArray());
+ ///
public IBooleanOperation GroupedNot(IEnumerable fields, params IExamineValue[] query)
{
if (fields == null)
@@ -138,8 +187,34 @@ public IBooleanOperation GroupedNot(IEnumerable fields, params IExamineV
private static readonly string[] s_emptyStringArray = new string[0];
+ ///
+ /// Query on a specific field
+ ///
+ ///
+ ///
+ ///
+ ///
protected abstract INestedBooleanOperation FieldNested(string fieldName, T fieldValue) where T : struct;
+
+ ///
+ /// The index will determine the most appropiate way to query the fields specified
+ ///
+ ///
+ ///
+ ///
protected abstract INestedBooleanOperation ManagedQueryNested(string query, string[] fields = null);
+
+ ///
+ /// Matches items as defined by the IIndexFieldValueType used for the fields specified.
+ /// If a type is not defined for a field name, or the type does not implement IIndexRangeValueType for the types of min and max, nothing will be added
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
protected abstract INestedBooleanOperation RangeQueryNested(string[] fields, T? min, T? max, bool minInclusive = true, bool maxInclusive = true) where T : struct;
INestedBooleanOperation INestedQuery.Field(string fieldName, string fieldValue)
@@ -177,6 +252,7 @@ INestedBooleanOperation INestedQuery.RangeQuery(string[] fields, T? min, T? m
#region Internal
+ ///
protected internal LuceneBooleanOperationBase FieldInternal(string fieldName, IExamineValue fieldValue, Occur occurrence)
{
if (fieldName == null)
@@ -186,6 +262,7 @@ protected internal LuceneBooleanOperationBase FieldInternal(string fieldName, IE
return FieldInternal(fieldName, fieldValue, occurrence, true);
}
+ ///
private LuceneBooleanOperationBase FieldInternal(string fieldName, IExamineValue fieldValue, Occur occurrence, bool useQueryParser)
{
Query queryToAdd = GetFieldInternalQuery(fieldName, fieldValue, useQueryParser);
@@ -196,6 +273,7 @@ private LuceneBooleanOperationBase FieldInternal(string fieldName, IExamineValue
return CreateOp();
}
+ ///
protected internal LuceneBooleanOperationBase GroupedAndInternal(string[] fields, IExamineValue[] fieldVals, Occur occurrence)
{
if (fields == null)
@@ -212,6 +290,7 @@ protected internal LuceneBooleanOperationBase GroupedAndInternal(string[] fields
return CreateOp();
}
+ ///
protected internal LuceneBooleanOperationBase GroupedNotInternal(string[] fields, IExamineValue[] fieldVals)
{
if (fields == null)
@@ -247,6 +326,7 @@ protected internal LuceneBooleanOperationBase GroupedNotInternal(string[] fields
return CreateOp();
}
+ ///
protected internal LuceneBooleanOperationBase GroupedOrInternal(string[] fields, IExamineValue[] fieldVals, Occur occurrence)
{
if (fields == null)
@@ -263,6 +343,7 @@ protected internal LuceneBooleanOperationBase GroupedOrInternal(string[] fields,
return CreateOp();
}
+ ///
protected internal LuceneBooleanOperationBase IdInternal(string id, Occur occurrence)
{
if (id == null)
diff --git a/src/Examine.Lucene/Search/LuceneSearchResults.cs b/src/Examine.Lucene/Search/LuceneSearchResults.cs
index 1db370592..7b1131115 100644
--- a/src/Examine.Lucene/Search/LuceneSearchResults.cs
+++ b/src/Examine.Lucene/Search/LuceneSearchResults.cs
@@ -5,12 +5,19 @@
namespace Examine.Lucene.Search
{
+ ///
+ /// Represents the search results of a query
+ ///
public class LuceneSearchResults : ISearchResults, IFacetResults
{
+ ///
+ /// Gets an empty search result
+ ///
public static LuceneSearchResults Empty { get; } = new LuceneSearchResults(Array.Empty(), 0, new Dictionary());
private readonly IReadOnlyCollection _results;
+ ///
public LuceneSearchResults(IReadOnlyCollection results, int totalItemCount, IReadOnlyDictionary facets)
{
_results = results;
@@ -18,11 +25,16 @@ public LuceneSearchResults(IReadOnlyCollection results, int total
Facets = facets;
}
+ ///
public long TotalItemCount { get; }
+ ///
public IReadOnlyDictionary Facets { get; }
+ ///
public IEnumerator GetEnumerator() => _results.GetEnumerator();
+
+ ///
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
}
diff --git a/src/Examine.Lucene/Search/MultiSearchContext.cs b/src/Examine.Lucene/Search/MultiSearchContext.cs
index 877661c35..9452f6e87 100644
--- a/src/Examine.Lucene/Search/MultiSearchContext.cs
+++ b/src/Examine.Lucene/Search/MultiSearchContext.cs
@@ -4,20 +4,26 @@
namespace Examine.Lucene.Search
{
-
+ ///
+ /// Represents a multi search context
+ ///
public class MultiSearchContext : ISearchContext
{
private readonly ISearchContext[] _inner;
private string[] _fields;
-
+
+ ///
public MultiSearchContext(ISearchContext[] inner) => _inner = inner;
+ ///
public ISearcherReference GetSearcher()
=> new MultiSearchSearcherReference(_inner.Select(x => x.GetSearcher()).ToArray());
+ ///
public string[] SearchableFields => _fields ?? (_fields = _inner.SelectMany(x => x.SearchableFields).Distinct().ToArray());
+ ///
public IIndexFieldValueType GetFieldValueType(string fieldName)
=> _inner.Select(cc => cc.GetFieldValueType(fieldName)).FirstOrDefault(type => type != null);
diff --git a/src/Examine.Lucene/Search/MultiSearchSearcherReference.cs b/src/Examine.Lucene/Search/MultiSearchSearcherReference.cs
index 89c25bba2..77fecf96d 100644
--- a/src/Examine.Lucene/Search/MultiSearchSearcherReference.cs
+++ b/src/Examine.Lucene/Search/MultiSearchSearcherReference.cs
@@ -1,16 +1,21 @@
-using Lucene.Net.Index;
+using Lucene.Net.Index;
using Lucene.Net.Search;
namespace Examine.Lucene.Search
{
+ ///
+ /// Represents a multi search searcher reference
+ ///
public class MultiSearchSearcherReference : ISearcherReference
{
+ ///
public MultiSearchSearcherReference(ISearcherReference[] inner) => _inner = inner;
private bool _disposedValue;
private IndexSearcher _searcher;
private readonly ISearcherReference[] _inner;
+ ///
public IndexSearcher IndexSearcher
{
get
@@ -29,6 +34,7 @@ public IndexSearcher IndexSearcher
}
}
+ ///
protected virtual void Dispose(bool disposing)
{
if (!_disposedValue)
@@ -45,6 +51,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/SearchContext.cs b/src/Examine.Lucene/Search/SearchContext.cs
index 7cdd6987a..494c8c5c2 100644
--- a/src/Examine.Lucene/Search/SearchContext.cs
+++ b/src/Examine.Lucene/Search/SearchContext.cs
@@ -8,20 +8,24 @@
namespace Examine.Lucene.Search
{
+ ///
public class SearchContext : ISearchContext
{
private readonly SearcherManager _searcherManager;
private readonly FieldValueTypeCollection _fieldValueTypeCollection;
private string[] _searchableFields;
+ ///
public SearchContext(SearcherManager searcherManager, FieldValueTypeCollection fieldValueTypeCollection)
{
_searcherManager = searcherManager;
_fieldValueTypeCollection = fieldValueTypeCollection ?? throw new ArgumentNullException(nameof(fieldValueTypeCollection));
}
+ ///
public ISearcherReference GetSearcher() => new SearcherReference(_searcherManager);
+ ///
public string[] SearchableFields
{
get
@@ -53,6 +57,7 @@ public string[] SearchableFields
}
}
+ ///
public IIndexFieldValueType GetFieldValueType(string fieldName)
{
//Get the value type for the field, or use the default if not defined
diff --git a/src/Examine.Lucene/Search/SearcherReference.cs b/src/Examine.Lucene/Search/SearcherReference.cs
index 9e2335b0b..e9a48d272 100644
--- a/src/Examine.Lucene/Search/SearcherReference.cs
+++ b/src/Examine.Lucene/Search/SearcherReference.cs
@@ -3,17 +3,20 @@
namespace Examine.Lucene.Search
{
+ ///
public class SearcherReference : ISearcherReference
{
private bool _disposedValue;
private readonly SearcherManager _searcherManager;
private IndexSearcher _searcher;
+ ///
public SearcherReference(SearcherManager searcherManager)
{
_searcherManager = searcherManager;
}
+ ///
public IndexSearcher IndexSearcher
{
get
@@ -26,6 +29,7 @@ public IndexSearcher IndexSearcher
}
}
+ ///
protected virtual void Dispose(bool disposing)
{
if (!_disposedValue)
@@ -42,6 +46,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/ValueTypeFactoryCollection.cs b/src/Examine.Lucene/ValueTypeFactoryCollection.cs
index 7917e051f..d4a2dd4a3 100644
--- a/src/Examine.Lucene/ValueTypeFactoryCollection.cs
+++ b/src/Examine.Lucene/ValueTypeFactoryCollection.cs
@@ -27,6 +27,12 @@ public ValueTypeFactoryCollection(IReadOnlyDictionary
+ /// Try get for the factory
+ ///
+ ///
+ ///
+ ///
public bool TryGetFactory(string valueTypeName, out IFieldValueTypeFactory fieldValueTypeFactory)
=> _valueTypeFactories.TryGetValue(valueTypeName, out fieldValueTypeFactory);
@@ -43,6 +49,9 @@ public IFieldValueTypeFactory GetRequiredFactory(string valueTypeName)
return fieldValueTypeFactory;
}
+ ///
+ /// The ammount of key/value pairs in the collection
+ ///
public int Count => _valueTypeFactories.Count;
///
@@ -87,9 +96,11 @@ private static IReadOnlyDictionary> G
};
+ ///
public IEnumerator> GetEnumerator()
=> _valueTypeFactories.GetEnumerator();
+ ///
IEnumerator IEnumerable.GetEnumerator()
=> GetEnumerator();
}