Exemple #1
0
        /// <summary>
        /// Adds element to index
        /// </summary>
        /// <param name="idx">Index</param>
        /// <param name="el">Element</param>
        public static void Index <T>(this Dictionary <string, HashSet <T> > idx, T el) where T : INamedEntity
        {
            // Index element's ToString() (e.g. DisplayName).
            foreach (var word in el.ToString().Split())
            {
                idx.Index(word, el);
            }

            // Index localized display names.
            foreach (var displayName in el.LocalizedDisplayNames)
            {
                foreach (var word in displayName.Value.Split())
                {
                    idx.Index(word, el);
                }
            }

            // Index localized keywords.
            foreach (var keywordSet in el.LocalizedKeywordSets)
            {
                foreach (var keyword in keywordSet.Value)
                {
                    idx.Index(keyword, el);
                }
            }
        }