Skip to content

Commit

Permalink
Merge branch 'main' into ma/use-immutable
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeAlhayek authored Jan 11, 2024
2 parents d8916dd + a063f68 commit 807208d
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Threading.Tasks;
using OrchardCore.ContentFields.Fields;
using OrchardCore.Contents.Indexing;
using OrchardCore.Indexing;

namespace OrchardCore.ContentFields.Indexing
Expand All @@ -24,7 +25,7 @@ public override Task BuildIndexAsync(ContentPickerField field, BuildFieldIndexCo
{
foreach (var key in context.Keys)
{
context.DocumentIndex.Set(key, "NULL", options);
context.DocumentIndex.Set(key, IndexingConstants.NullValue, options);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Threading.Tasks;
using OrchardCore.ContentFields.Fields;
using OrchardCore.Contents.Indexing;
using OrchardCore.Indexing;
using OrchardCore.Modules;

Expand All @@ -26,7 +27,7 @@ public override Task BuildIndexAsync(LocalizationSetContentPickerField field, Bu
{
foreach (var key in context.Keys)
{
context.DocumentIndex.Set(key, "NULL", options);
context.DocumentIndex.Set(key, IndexingConstants.NullValue, options);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Threading.Tasks;
using OrchardCore.ContentFields.Fields;
using OrchardCore.Contents.Indexing;
using OrchardCore.Indexing;

namespace OrchardCore.ContentFields.Indexing
Expand Down Expand Up @@ -33,7 +34,7 @@ public override Task BuildIndexAsync(UserPickerField field, BuildFieldIndexConte
{
foreach (var key in context.Keys)
{
context.DocumentIndex.Set(key, "NULL", options);
context.DocumentIndex.Set(key, IndexingConstants.NullValue, options);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.IO;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using OrchardCore.Contents.Indexing;
using OrchardCore.Environment.Shell.Builders;
using OrchardCore.Indexing;
using OrchardCore.Media.Fields;
Expand Down Expand Up @@ -38,8 +39,8 @@ public async override Task BuildIndexAsync(MediaField field, BuildFieldIndexCont
{
foreach (var key in context.Keys)
{
context.DocumentIndex.Set(key + MediaTextKeySuffix, "NULL", options);
context.DocumentIndex.Set(key + FileTextKeySuffix, "NULL", options);
context.DocumentIndex.Set(key + MediaTextKeySuffix, IndexingConstants.NullValue, options);
context.DocumentIndex.Set(key + FileTextKeySuffix, IndexingConstants.NullValue, options);
}

return;
Expand All @@ -58,7 +59,7 @@ public async override Task BuildIndexAsync(MediaField field, BuildFieldIndexCont
}
else
{
context.DocumentIndex.Set(key + MediaTextKeySuffix, "NULL", options);
context.DocumentIndex.Set(key + MediaTextKeySuffix, IndexingConstants.NullValue, options);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ private Document CreateLuceneDocument(DocumentIndex documentIndex, LuceneIndexSe
}
else
{
doc.Add(new StringField(entry.Name, "NULL", store));
doc.Add(new StringField(entry.Name, IndexingConstants.NullValue, store));
}
break;

Expand All @@ -264,7 +264,7 @@ private Document CreateLuceneDocument(DocumentIndex documentIndex, LuceneIndexSe
}
else
{
doc.Add(new StringField(entry.Name, "NULL", store));
doc.Add(new StringField(entry.Name, IndexingConstants.NullValue, store));
}

break;
Expand All @@ -281,7 +281,7 @@ private Document CreateLuceneDocument(DocumentIndex documentIndex, LuceneIndexSe
}
else
{
doc.Add(new StringField(entry.Name, "NULL", store));
doc.Add(new StringField(entry.Name, IndexingConstants.NullValue, store));
}
break;

Expand Down Expand Up @@ -316,11 +316,11 @@ private Document CreateLuceneDocument(DocumentIndex documentIndex, LuceneIndexSe
{
if (entry.Options.HasFlag(DocumentIndexOptions.Keyword))
{
doc.Add(new StringField(entry.Name, "NULL", store));
doc.Add(new StringField(entry.Name, IndexingConstants.NullValue, store));
}
else
{
doc.Add(new TextField(entry.Name, "NULL", store));
doc.Add(new TextField(entry.Name, IndexingConstants.NullValue, store));
}
}
break;
Expand All @@ -345,7 +345,7 @@ private Document CreateLuceneDocument(DocumentIndex documentIndex, LuceneIndexSe
}
else
{
doc.Add(new StoredField(strategy.FieldName, "NULL"));
doc.Add(new StoredField(strategy.FieldName, IndexingConstants.NullValue));
}
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ public static class IndexingConstants
public const string IdsKey = ".Ids";
public const string OrderKey = ".Order";
public const string SourceKey = "_source.";
public const string NullValue = "NULL";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ private SearchDocument CreateSearchDocument(DocumentIndex documentIndex, Diction
{
var stringValue = Convert.ToString(entry.Value);

if (!string.IsNullOrEmpty(stringValue) && stringValue != "NULL")
if (!string.IsNullOrEmpty(stringValue) && stringValue != IndexingConstants.NullValue)
{
// Full-text and display-text support multi-value.
// keyword fields contains single string. All others, support a collection of strings.
Expand Down

0 comments on commit 807208d

Please sign in to comment.