Skip to content

Commit

Permalink
now indexes additional field for flag to indicate if the match has an…
Browse files Browse the repository at this point in the history
…y tag in a given group
  • Loading branch information
Hendy committed Apr 7, 2019
1 parent fe02eee commit b7ac540
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Our.Umbraco.Look/LookConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ internal static class LookConstants
/// </summary>
internal static string AllTagsField => "Look_AllTags";

/// <summary>
/// Prefix to fields for the tag group flag
/// </summary>
internal static string TagGroupField => "Look_TagGroup_";

/// <summary>
/// Gets the field name to use for the tags - this field will contain space delimited non-tokenizable strings
/// </summary>
Expand Down
12 changes: 12 additions & 0 deletions src/Our.Umbraco.Look/Services/LookService_IndexTags.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Lucene.Net.Documents;
using System;
using System.Linq;
using Umbraco.Core.Logging;

namespace Our.Umbraco.Look.Services
Expand Down Expand Up @@ -51,6 +52,17 @@ private static void IndexTags(IndexingContext indexingContext, Document document
document.Add(allTagsField);
document.Add(tagField);
}

var tagGroups = tags.Select(x => x.Group).Distinct();

foreach (var tagGroup in tagGroups)
{
var tagGroupField = new Field(
LookConstants.TagGroupField + tagGroup,
"1",
Field.Store.NO,
Field.Index.NOT_ANALYZED);
}
}
}
}
Expand Down

0 comments on commit b7ac540

Please sign in to comment.