This commit is contained in:
@@ -20,14 +20,6 @@ namespace AyaNova.Biz
|
||||
public static class Search
|
||||
{
|
||||
|
||||
/*
|
||||
ISSUES:
|
||||
Search of big data a little slow, attempt to tweak indices
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#region Search and return results
|
||||
|
||||
/*
|
||||
@@ -102,7 +94,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
|
||||
//Class to hold search result returned to client
|
||||
//Classes to hold search results returned to client
|
||||
public class SearchResult
|
||||
{
|
||||
public string Name { get; set; }
|
||||
@@ -110,11 +102,20 @@ namespace AyaNova.Biz
|
||||
public long Id { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static async Task<List<SearchResult>> DoSearch(AyContext ct, long localeId, AuthorizationRoles currentUserRoles, SearchRequestParameters searchParameters)
|
||||
public class SearchReturnObject
|
||||
{
|
||||
List<SearchResult> ResultList = new List<SearchResult>();
|
||||
public long TotalResultsFound { get; set; }
|
||||
public List<SearchResult> SearchResults { get; set; }
|
||||
public SearchReturnObject(){
|
||||
TotalResultsFound=0;
|
||||
SearchResults = new List<SearchResult>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static async Task<SearchReturnObject> DoSearch(AyContext ct, long localeId, AuthorizationRoles currentUserRoles, SearchRequestParameters searchParameters)
|
||||
{
|
||||
var ReturnObject = new SearchReturnObject();
|
||||
|
||||
//list to hold temporary search/tag hits
|
||||
List<AyaTypeId> MatchingObjects = new List<AyaTypeId>();
|
||||
@@ -234,7 +235,7 @@ namespace AyaNova.Biz
|
||||
if (MatchTagCount == 0)
|
||||
{
|
||||
//return empty resultlist
|
||||
return ResultList;
|
||||
return ReturnObject;
|
||||
}
|
||||
|
||||
//Save the matching count
|
||||
@@ -323,10 +324,14 @@ namespace AyaNova.Biz
|
||||
MatchingObjects = CanReadMatchingObjects;
|
||||
}
|
||||
|
||||
|
||||
//TOTAL RESULTS
|
||||
//we have the total results here so set accordingly
|
||||
ReturnObject.TotalResultsFound=MatchingObjects.Count;
|
||||
|
||||
//MAXIMUM RESULTS FILTER
|
||||
//The theory is that it should be filtered BEFORE sorting so that you get the most random collection of results
|
||||
//As the results are not ranked so...
|
||||
|
||||
if (searchParameters.MaxResults > 0)//0 = all results
|
||||
MatchingObjects = MatchingObjects.Take(searchParameters.MaxResults).ToList();
|
||||
|
||||
@@ -353,14 +358,14 @@ namespace AyaNova.Biz
|
||||
|
||||
SR.Id = i.ObjectId;
|
||||
SR.Type = i.ObjectType;
|
||||
ResultList.Add(SR);
|
||||
ReturnObject.SearchResults.Add(SR);
|
||||
}
|
||||
}
|
||||
|
||||
// watch.Stop();//###################### PROFILING
|
||||
// var TimeToBuildSearchResultReturnList = watch.ElapsedMilliseconds;//###################### PROFILING
|
||||
|
||||
return ResultList;
|
||||
return ReturnObject;
|
||||
}
|
||||
|
||||
|
||||
@@ -415,7 +420,7 @@ namespace AyaNova.Biz
|
||||
List<MatchingDictionaryEntry> MatchingKeywordIdList = new List<MatchingDictionaryEntry>();
|
||||
|
||||
|
||||
|
||||
|
||||
//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
|
||||
@@ -460,7 +465,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----
|
||||
//Now add the id's of the newly created words to the matching keyword id list for this object
|
||||
|
||||
@@ -882,7 +887,6 @@ namespace AyaNova.Biz
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}//eoc
|
||||
|
||||
}//eons
|
||||
Reference in New Issue
Block a user