This commit is contained in:
@@ -388,26 +388,43 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
|
|
||||||
//ITERATE THROUGH THE KEYWORDS THAT DO *NOT* HAVE MATCHES IN THE SEARCHDICTIONARY AND ADD THEM TO THE SEARCH DICTIONARY, COLLECTING THEIR ID'S
|
//ITERATE THROUGH THE KEYWORDS THAT DO *NOT* HAVE MATCHES IN THE SEARCHDICTIONARY AND ADD THEM TO THE SEARCH DICTIONARY, COLLECTING THEIR ID'S
|
||||||
|
bool NewWordsAdded = false;
|
||||||
foreach (string KeyWord in KeyWordList)
|
foreach (string KeyWord in KeyWordList)
|
||||||
{
|
{
|
||||||
if (!ExistingKeywordMatches.ContainsValue(KeyWord))
|
if (!ExistingKeywordMatches.ContainsValue(KeyWord))
|
||||||
{
|
{
|
||||||
ct.SearchDictionary.Add(new SearchDictionary() { Word = KeyWord });
|
ct.SearchDictionary.Add(new SearchDictionary() { Word = KeyWord });
|
||||||
|
NewWordsAdded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Save the context in order to get the id's of the new words added
|
//Save the context in order to get the id's of the new words added
|
||||||
ct.SaveChanges();
|
if (NewWordsAdded)
|
||||||
|
ct.SaveChanges();
|
||||||
|
|
||||||
|
|
||||||
|
//-----
|
||||||
//Now add the id's of the newly created words to the matching keyword id list for this object
|
//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)
|
foreach (SearchDictionary SD in ct.SearchDictionary.Local)
|
||||||
{
|
{
|
||||||
bool IsName = false;
|
bool IsName = false;
|
||||||
if (NameKeyWordList.Contains(SD.Word))
|
if (NameKeyWordList.Contains(SD.Word))
|
||||||
IsName = true;
|
IsName = true;
|
||||||
MatchingKeywordIdList.Add(new MatchingDictionaryEntry() { DictionaryId = SD.Id, InName = IsName });
|
//See if it's already in the matching keywordlist or needs to be added
|
||||||
}
|
var ExistingMatch = MatchingKeywordIdList.Where(x => x.DictionaryId == SD.Id).FirstOrDefault();
|
||||||
|
|
||||||
|
if (ExistingMatch == null)//If null then needs to be added
|
||||||
|
MatchingKeywordIdList.Add(new MatchingDictionaryEntry() { DictionaryId = SD.Id, InName = IsName });
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Not null, but may need to be updated to reflect that it's in the name
|
||||||
|
if (!ExistingMatch.InName && IsName)
|
||||||
|
{
|
||||||
|
ExistingMatch.InName = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//CREATE THE SEARCHKEY RECORDS FOR ALL THE KEYWORDS
|
//CREATE THE SEARCHKEY RECORDS FOR ALL THE KEYWORDS
|
||||||
foreach (MatchingDictionaryEntry E in MatchingKeywordIdList)
|
foreach (MatchingDictionaryEntry E in MatchingKeywordIdList)
|
||||||
@@ -415,6 +432,8 @@ namespace AyaNova.Biz
|
|||||||
ct.SearchKey.Add(new SearchKey() { WordId = E.DictionaryId, InName = E.InName, ObjectId = objectID, ObjectType = objectType });
|
ct.SearchKey.Add(new SearchKey() { WordId = E.DictionaryId, InName = E.InName, ObjectId = objectID, ObjectType = objectType });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------
|
||||||
|
|
||||||
ct.SaveChanges();
|
ct.SaveChanges();
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace raven_integration
|
|||||||
|
|
||||||
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||||
Util.ValidateDataReturnResponseOk(a);
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
long FirstWidgetId = a.ObjectResponse["result"]["id"].Value<long>();
|
long MatchFirstWidgetId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||||
|
|
||||||
//CREATE A SECOND WIDGET
|
//CREATE A SECOND WIDGET
|
||||||
D = new JObject();
|
D = new JObject();
|
||||||
@@ -43,7 +43,7 @@ namespace raven_integration
|
|||||||
|
|
||||||
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||||
Util.ValidateDataReturnResponseOk(a);
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
long SecondWidgetId = a.ObjectResponse["result"]["id"].Value<long>();
|
long MatchSecondWidgetId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||||
|
|
||||||
//CREATE A THIRD WIDGET
|
//CREATE A THIRD WIDGET
|
||||||
D = new JObject();
|
D = new JObject();
|
||||||
@@ -55,7 +55,7 @@ namespace raven_integration
|
|||||||
|
|
||||||
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||||
Util.ValidateDataReturnResponseOk(a);
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
long ThirdWidgetId = a.ObjectResponse["result"]["id"].Value<long>();
|
long NoMatchThirdWidgetId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||||
|
|
||||||
//Now see if can find that widget with a phrase search
|
//Now see if can find that widget with a phrase search
|
||||||
dynamic SearchParameters = new JObject();
|
dynamic SearchParameters = new JObject();
|
||||||
|
|||||||
Reference in New Issue
Block a user