diff --git a/src/Our.Umbraco.Look/LookConstants.cs b/src/Our.Umbraco.Look/LookConstants.cs index a5febe3..003a8b8 100644 --- a/src/Our.Umbraco.Look/LookConstants.cs +++ b/src/Our.Umbraco.Look/LookConstants.cs @@ -82,6 +82,11 @@ internal static class LookConstants /// internal static string AllTagsField => "Look_AllTags"; + /// + /// Prefix to fields for the tag group flag + /// + internal static string TagGroupField => "Look_TagGroup_"; + /// /// Gets the field name to use for the tags - this field will contain space delimited non-tokenizable strings /// diff --git a/src/Our.Umbraco.Look/Services/LookService_IndexTags.cs b/src/Our.Umbraco.Look/Services/LookService_IndexTags.cs index f4290dd..ea26759 100644 --- a/src/Our.Umbraco.Look/Services/LookService_IndexTags.cs +++ b/src/Our.Umbraco.Look/Services/LookService_IndexTags.cs @@ -1,5 +1,6 @@ using Lucene.Net.Documents; using System; +using System.Linq; using Umbraco.Core.Logging; namespace Our.Umbraco.Look.Services @@ -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); + } } } }