diff --git a/server/AyaNova/biz/Search.cs b/server/AyaNova/biz/Search.cs index cd032348..7c8b2255 100644 --- a/server/AyaNova/biz/Search.cs +++ b/server/AyaNova/biz/Search.cs @@ -92,24 +92,25 @@ namespace AyaNova.Biz //Save the context in order to get the id's of the new words added ct.SaveChanges(); -====HERE - //Now add the id's of the newly created words to the matching keyword id list for this object - //OLD BORING WAY: - // foreach (SearchDictionary SD in ct.SearchDictionary.Local) - // { - // MatchingKeywordIdList.Add(SD.Id); - // } - //Linq all the things! (I'm so clever) - MatchingKeywordIdList.AddRange(ct.SearchDictionary.Local.Select(m => m.Id).ToList()); + //Now add the id's of the newly created words to the matching keyword id list for this object + foreach (SearchDictionary SD in ct.SearchDictionary.Local) + { + bool IsName = false; + if (NameKeyWordList.Contains(SD.Word)) + IsName = true; + MatchingKeywordIdList.Add(new MatchingDictionaryEntry() { DictionaryId = SD.Id, InName = IsName }); + } + //CREATE THE SEARCHKEY RECORDS FOR ALL THE KEYWORDS - foreach (long KeyWordId in MatchingKeywordIdList) + foreach (MatchingDictionaryEntry E in MatchingKeywordIdList) { - if () - ct.SearchDictionary.Add(new SearchKey() { Word = KeyWord }); + ct.SearchKey.Add(new SearchKey() { WordId = E.DictionaryId, InName = E.InName }); } + ct.SaveChanges(); + }//eoc //Class to hold temporary list of matching id