From 8ee3370f60b6fb1618249d0a63c22d907f2b7b9c Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 19 Sep 2018 15:37:54 +0000 Subject: [PATCH] --- server/AyaNova/biz/Search.cs | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/server/AyaNova/biz/Search.cs b/server/AyaNova/biz/Search.cs index c7724be5..cd032348 100644 --- a/server/AyaNova/biz/Search.cs +++ b/server/AyaNova/biz/Search.cs @@ -67,15 +67,18 @@ namespace AyaNova.Biz return; } - //BUILD A LIST OF SEARCHDICTIONARY ID'S FOR THE MATCHING WORDS - List MatchingKeywordIdList = new List(); + //BUILD A LIST OF MatchingDictionaryEntry items FOR THE MATCHING WORDS + List MatchingKeywordIdList = new List(); //ITERATE ALL THE KEYWORDS, SEARCH IN THE SEARCHDICTIONARY TABLE AND COLLECT ID'S OF ANY PRE-EXISTING IN DB KEYWORDS var ExistingKeywordMatches = ct.SearchDictionary.Where(m => KeyWordList.Contains(m.Word)).ToDictionary(m => m.Id, m => m.Word); //Put the matching keyword ID's into the list foreach (KeyValuePair K in ExistingKeywordMatches) { - MatchingKeywordIdList.Add(K.Key); + bool IsName = false; + if (NameKeyWordList.Contains(K.Value)) + IsName = true; + MatchingKeywordIdList.Add(new MatchingDictionaryEntry() { DictionaryId = K.Key, InName = IsName }); } //ITERATE THROUGH THE KEYWORDS THAT DO *NOT* HAVE MATCHES IN THE SEARCHDICTIONARY AND ADD THEM TO THE SEARCH DICTIONARY, COLLECTING THEIR ID'S @@ -89,7 +92,7 @@ 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) @@ -107,7 +110,21 @@ namespace AyaNova.Biz ct.SearchDictionary.Add(new SearchKey() { Word = KeyWord }); } + }//eoc + + //Class to hold temporary list of matching id + public class MatchingDictionaryEntry + { + public bool InName { get; set; } + public long DictionaryId { get; set; } + public MatchingDictionaryEntry() + { + InName = false; + DictionaryId = -1; + } } + + #endregion