public SearchMetadata Create(string searchText, bool useRegex, int index, bool filter)
        {
            if (searchText == null)
            {
                throw new ArgumentNullException(nameof(searchText));
            }

            //maybe key on useRegex as well as text
            var association = _textAssociationCollection.Lookup(searchText);

            string icon;
            Hue    hue;

            if (association.HasValue)
            {
                icon = association.Value.Icon;
                hue  = _defaultColourSelector.Lookup(new HueKey(association.Value.Swatch, association.Value.Hue));
            }
            else
            {
                icon = _defaultIconSelector.GetIconFor(searchText, useRegex);
                hue  = _defaultColourSelector.Select(searchText);
            }


            return(new SearchMetadata(index, searchText,
                                      filter,
                                      true,
                                      useRegex,
                                      true,
                                      hue,
                                      icon));
        }
        public SearchMetadata Create(string searchText, bool useRegex, int index, bool filter, bool isGlobal = false)
        {
            if (searchText == null)
            {
                throw new ArgumentNullException(nameof(searchText));
            }

            var isExclusion = false;

            if (!useRegex)
            {
                var withNegation = searchText.WithNegation();
                isExclusion = withNegation.IsNegation;
                searchText  = withNegation.Text;
            }

            var    association = _textAssociationCollection.Lookup(searchText);
            string icon;
            Hue    hue;

            if (association.HasValue)
            {
                icon = association.Value.Icon;
                hue  = _defaultColourSelector.Lookup(new HueKey(association.Value.Swatch, association.Value.Hue));
            }
            else
            {
                icon = _defaultIconSelector.GetIconFor(searchText, useRegex);
                hue  = _defaultColourSelector.Select(searchText);
            }

            return(new SearchMetadata(index, searchText,
                                      isExclusion ? false: filter,
                                      HighlightingMode.Text,
                                      useRegex,
                                      true,
                                      hue,
                                      icon,
                                      isGlobal,
                                      isExclusion));
        }