This commit is contained in:
2018-09-21 18:30:18 +00:00
parent abda2578f6
commit f27e801317

View File

@@ -172,8 +172,9 @@ namespace AyaNova.Biz
}
//SEARCH SEARCHKEY FOR MATCHING WORDS AND OPTIONALLY TYPE AND INNAME
var TotalSearchTermsToMatch = WildCardSearchTerms.Count + RegularSearchTerms.Count;
var TestRawMatches = await ct.SearchKey.Where(x => DictionaryMatches.Contains(x.WordId)).ToListAsync();
// var TestRawMatches = await ct.SearchKey.Where(x => DictionaryMatches.Contains(x.WordId)).ToListAsync();
//Build search query based on searchParameters
var q = ct.SearchKey.Distinct().Where(x => DictionaryMatches.Contains(x.WordId));
@@ -188,15 +189,15 @@ namespace AyaNova.Biz
//Find the records that have all the words
//BUGBUG: IT'S FINDING WIDGET 203 WHICH ONLY HAS ONE OF THE WORDS, IS THIS DOING WHAT I THINK IT'S DOING?
//Find the records that have the search terms in searchkey
var SearchMatches = q.GroupBy(x => new { x.ObjectType, x.ObjectId }).Select(x => new { ObjectId = x.Key.ObjectId, ObjectType = x.Key.ObjectType, ObjectCount = x.LongCount() });
//PUT THE RESULTS INTO MATCHING OBJECTS LIST
foreach (var SearchMatch in SearchMatches)
{
//BUGBUG: Shouldn't this going to require checking the count??
MatchingObjects.Add(new AyaTypeId(SearchMatch.ObjectType, SearchMatch.ObjectId));
//keep any object that matches *all* the search terms
if (SearchMatch.ObjectCount == TotalSearchTermsToMatch)
MatchingObjects.Add(new AyaTypeId(SearchMatch.ObjectType, SearchMatch.ObjectId));
}