public void UpdateKeywordsAndOntology(CatalogSettings catalogSettings = null)
        {
            var keywordsData = new KeywordsList().GetKeywordsListData(catalogSettings ?? SearchSettings.Instance.CatalogSettings);

            Keywords     = keywordsData.Keywords;
            OntologyTree = keywordsData.OntoloyTree;
            Synonyms     = keywordsData.Synonyms;

            RaiseKeywordsChanged();
        }
Beispiel #2
0
        public KeywordListData GetKeywordsListData()
        {
            // Synonyms and keywords
            var tmpsyndoc = HdSearchOntologyHelper.ReadOntologySynonymsXmlFile();

            keywordsList = new SortedSet <string>();
            var synonyms = new ArrayOfOntologyPath();
            var root     = tmpsyndoc.DocumentElement;

            foreach (XmlElement elem in root.ChildNodes)
            {
                var ontoPath = new OntologyPath();
                foreach (XmlElement child in elem.ChildNodes)
                {
                    if (child.Name == "conceptID")
                    {
                        int conceptID;
                        if (Int32.TryParse(child.InnerText, out conceptID))
                        {
                            ontoPath.ConceptID = conceptID;
                        }
                    }
                    else if (child.Name == "ConceptName")
                    {
                        ontoPath.ConceptName = child.InnerText;
                    }
                    else if (child.Name == "ConceptPath")
                    {
                        ontoPath.ConceptPath = child.InnerText;
                    }
                    else if (child.Name == "SearchableKeyword")
                    {
                        ontoPath.SearchableKeyword = child.InnerText;
                    }
                }
                synonyms.Add(ontoPath);
                keywordsList.Add(ontoPath.SearchableKeyword);
            }

            // Ontology tree
            var tree      = new OntologyTree();
            var tmpxmldoc = HdSearchOntologyHelper.ReadOntologyXmlFile();

            FillTree(tmpxmldoc.DocumentElement, tree.Nodes);

            //------
            var result = new KeywordListData
            {
                OntoloyTree = tree,
                Keywords    = keywordsList.ToList(),
                Synonyms    = synonyms,
            };

            return(result);
        }
        /// <summary>
        /// Create deep from source into current instance.
        /// </summary>
        /// <param name="source">Source.</param>
        /// <exception cref="ArgumentNullException"><paramref name="source"/>must be not null.</exception>
        public void Copy(KeywordsSettings source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            var selectedKeywords = new List <string>(source.SelectedKeywords.Count());

            selectedKeywords.AddRange(source.SelectedKeywords.Select(s => s));
            SelectedKeywords = selectedKeywords;

            Keywords     = source.Keywords;
            OntologyTree = source.OntologyTree;
            Synonyms     = source.Synonyms;

            RaiseKeywordsChanged();
        }