Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing SyncedFileSystemDirectoryFactory when the main index is corrupted #387

Merged
merged 16 commits into from
Jul 31, 2024
Merged
15 changes: 11 additions & 4 deletions src/Examine.Core/FieldDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Examine
/// <summary>
/// Defines a field to be indexed
/// </summary>
public struct FieldDefinition : IEquatable<FieldDefinition>
public readonly struct FieldDefinition : IEquatable<FieldDefinition>
{
/// <summary>
/// Constructor
Expand All @@ -14,8 +14,14 @@ public struct FieldDefinition : IEquatable<FieldDefinition>
/// <param name="type"></param>
public FieldDefinition(string name, string type)
{
if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value cannot be null or whitespace.", nameof(name));
if (string.IsNullOrWhiteSpace(type)) throw new ArgumentException("Value cannot be null or whitespace.", nameof(type));
if (string.IsNullOrWhiteSpace(name))
{
throw new ArgumentException("Value cannot be null or whitespace.", nameof(name));
}
if (string.IsNullOrWhiteSpace(type))
{
throw new ArgumentException("Value cannot be null or whitespace.", nameof(type));
}
Name = name;
Type = type;
}
Expand All @@ -34,7 +40,8 @@ public FieldDefinition(string name, string type)

public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(null, obj))
return false;
return obj is FieldDefinition definition && Equals(definition);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Examine.Core/IndexOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace Examine
/// <summary>
/// Represents an indexing operation (either add/remove)
/// </summary>
public struct IndexOperation
public readonly struct IndexOperation
{
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Object"/> class.
Expand All @@ -27,4 +27,4 @@ public IndexOperation(ValueSet valueSet, IndexOperationType operation)
/// </value>
public IndexOperationType Operation { get; }
}
}
}
1 change: 1 addition & 0 deletions src/Examine.Core/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -1,0 +1 @@
static Examine.SearchExtensions.Escape(this string s, float boost) -> Examine.Search.IExamineValue

Check warning on line 1 in src/Examine.Core/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build

Symbol 'static Examine.SearchExtensions.Escape(this string s, float boost) -> Examine.Search.IExamineValue' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check warning on line 1 in src/Examine.Core/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build

Symbol 'static Examine.SearchExtensions.Escape(this string s, float boost) -> Examine.Search.IExamineValue' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check warning on line 1 in src/Examine.Core/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build

Symbol 'static Examine.SearchExtensions.Escape(this string s, float boost) -> Examine.Search.IExamineValue' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check warning on line 1 in src/Examine.Core/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / build

Symbol 'static Examine.SearchExtensions.Escape(this string s, float boost) -> Examine.Search.IExamineValue' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)
5 changes: 2 additions & 3 deletions src/Examine.Core/Search/ExamineValue.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Examine.Search;
using Examine.Search;

namespace Examine.Search
{
public struct ExamineValue : IExamineValue
public readonly struct ExamineValue : IExamineValue
{
public ExamineValue(Examineness vagueness, string value)
: this(vagueness, value, 1)
Expand All @@ -21,6 +21,5 @@ public ExamineValue(Examineness vagueness, string value, float level)
public string Value { get; }

public float Level { get; }

}
}
6 changes: 3 additions & 3 deletions src/Examine.Core/Search/SortableField.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
namespace Examine.Search
namespace Examine.Search
{
/// <summary>
/// Represents a field used to sort results
/// </summary>
public struct SortableField
public readonly struct SortableField
{
/// <summary>
/// The field name to sort by
Expand Down Expand Up @@ -36,4 +36,4 @@ public SortableField(string fieldName, SortType sortType)
SortType = sortType;
}
}
}
}
2 changes: 1 addition & 1 deletion src/Examine.Core/ValueSetValidationResult.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Examine
{
public struct ValueSetValidationResult
public readonly struct ValueSetValidationResult
{
public ValueSetValidationResult(ValueSetValidationStatus status, ValueSet valueSet)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ protected override Directory CreateDirectory(LuceneIndex luceneIndex, bool force
{
IndexWriter.Unlock(dir);
}

return dir;
}
}
Expand Down
Loading
Loading