Skip to content

Commit 76e33bf

Browse files
authored
Clean up constants and don't use hardcoded Examine system field names (#95)
1 parent d03bc74 commit 76e33bf

3 files changed

Lines changed: 2 additions & 6 deletions

File tree

src/Umbraco.Cms.Search.Provider.Examine/Configuration/ConfigureIndexOptions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ private FieldOptions.Field[] ExamineSystemFieldsOptions()
133133
[
134134
new() { PropertyName = Constants.SystemFields.Protection, FieldValues = FieldValues.Keywords },
135135
new() { PropertyName = Constants.SystemFields.Culture, FieldValues = FieldValues.Keywords },
136-
new() { PropertyName = Constants.SystemFields.Segment, FieldValues = FieldValues.Keywords },
137136
new() { PropertyName = Constants.SystemFields.AggregatedTexts, FieldValues = FieldValues.Texts },
138137
new() { PropertyName = Constants.SystemFields.AggregatedTextsR1, FieldValues = FieldValues.Texts },
139138
new() { PropertyName = Constants.SystemFields.AggregatedTextsR2, FieldValues = FieldValues.Texts },

src/Umbraco.Cms.Search.Provider.Examine/Constants.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,10 @@ public static class SystemFields
3030

3131
public const string Protection = $"{Prefix}Protection";
3232
public const string Culture = $"{Prefix}Culture";
33-
public const string Segment = $"{Prefix}Segment";
3433

3534
public const string AggregatedTexts = $"{Prefix}aggregated_texts";
3635
public const string AggregatedTextsR1 = $"{Prefix}aggregated_textsr1";
3736
public const string AggregatedTextsR2 = $"{Prefix}aggregated_textsr2";
3837
public const string AggregatedTextsR3 = $"{Prefix}aggregated_textsr3";
39-
40-
public const string IndexType = "__IndexType";
4138
}
4239
}

src/Umbraco.Cms.Search.Provider.Examine/Services/Searcher.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ private SearchResult Search(
159159
AddSorters(searchQuery, sortersAsArray, culture, segment);
160160

161161
// We only need the IndexType and NodeId
162-
var selectedFields = new HashSet<string> {Constants.SystemFields.IndexType, "__NodeId" };
162+
var selectedFields = new HashSet<string> { ExamineFieldNames.CategoryFieldName, ExamineFieldNames.ItemIdFieldName };
163163
searchQuery.SelectFields(selectedFields);
164164

165165
ISearchResults results;
@@ -518,7 +518,7 @@ private Facet MergeRangeFacets(IEnumerable<Facet> facets)
518518

519519
private static Document? MapToDocument(ISearchResult item)
520520
{
521-
var objectTypeString = item.Values.GetValueOrDefault(Constants.SystemFields.IndexType);
521+
var objectTypeString = item.Values.GetValueOrDefault(ExamineFieldNames.CategoryFieldName);
522522

523523
Enum.TryParse(objectTypeString, out UmbracoObjectTypes umbracoObjectType);
524524

0 commit comments

Comments
 (0)