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 //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 //Build search query based on searchParameters
var q = ct.SearchKey.Distinct().Where(x => DictionaryMatches.Contains(x.WordId)); 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 //Find the records that have the search terms in searchkey
//BUGBUG: IT'S FINDING WIDGET 203 WHICH ONLY HAS ONE OF THE WORDS, IS THIS DOING WHAT I THINK IT'S DOING?
var SearchMatches = q.GroupBy(x => new { x.ObjectType, x.ObjectId }).Select(x => new { ObjectId = x.Key.ObjectId, ObjectType = x.Key.ObjectType, ObjectCount = x.LongCount() }); 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 //PUT THE RESULTS INTO MATCHING OBJECTS LIST
foreach (var SearchMatch in SearchMatches) foreach (var SearchMatch in SearchMatches)
{ {
//BUGBUG: Shouldn't this going to require checking the count?? //keep any object that matches *all* the search terms
MatchingObjects.Add(new AyaTypeId(SearchMatch.ObjectType, SearchMatch.ObjectId)); if (SearchMatch.ObjectCount == TotalSearchTermsToMatch)
MatchingObjects.Add(new AyaTypeId(SearchMatch.ObjectType, SearchMatch.ObjectId));
} }