This commit is contained in:
@@ -27,23 +27,9 @@ Once that is done then can steam ahead on the biz objects but until I have the c
|
|||||||
|
|
||||||
IMMEDIATE ITEMS:
|
IMMEDIATE ITEMS:
|
||||||
================
|
================
|
||||||
Current huge seeding takes around 15 minutes
|
|
||||||
Current unbounded search for "et*" in huge dataset takes avg 21 seconds to process
|
|
||||||
{
|
|
||||||
"phrase": "et*",
|
|
||||||
"nameOnly": false,
|
|
||||||
"typeOnly": 0,
|
|
||||||
"maxResults": 0
|
|
||||||
}
|
|
||||||
|
|
||||||
- Search and search text indexing
|
- Search and search text indexing
|
||||||
- https://gist.github.com/ruckus/5718112
|
|
||||||
|
|
||||||
//new issue came up during testing under heavy load:
|
|
||||||
- 23505: duplicate key value violates unique constraint "asearchdictionary_word_idx"
|
|
||||||
- Between the read of finding matching words and the adding a not found word another run added it independently
|
|
||||||
|
|
||||||
|
|
||||||
- Change return object from a search to include a count of results plus the restricted list of results
|
- Change return object from a search to include a count of results plus the restricted list of results
|
||||||
- this way the Client can know there are tons more than just weren't shown so they can narrow their terms
|
- this way the Client can know there are tons more than just weren't shown so they can narrow their terms
|
||||||
- see if any other callers to name fetcher are in tight loops and could benefit from using the new Direct version
|
- see if any other callers to name fetcher are in tight loops and could benefit from using the new Direct version
|
||||||
|
|||||||
@@ -20,14 +20,6 @@ namespace AyaNova.Biz
|
|||||||
public static class Search
|
public static class Search
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
|
||||||
ISSUES:
|
|
||||||
Search of big data a little slow, attempt to tweak indices
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#region Search and return results
|
#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 class SearchResult
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
@@ -110,11 +102,20 @@ namespace AyaNova.Biz
|
|||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SearchReturnObject
|
||||||
|
|
||||||
public static async Task<List<SearchResult>> DoSearch(AyContext ct, long localeId, AuthorizationRoles currentUserRoles, SearchRequestParameters searchParameters)
|
|
||||||
{
|
{
|
||||||
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 to hold temporary search/tag hits
|
||||||
List<AyaTypeId> MatchingObjects = new List<AyaTypeId>();
|
List<AyaTypeId> MatchingObjects = new List<AyaTypeId>();
|
||||||
@@ -234,7 +235,7 @@ namespace AyaNova.Biz
|
|||||||
if (MatchTagCount == 0)
|
if (MatchTagCount == 0)
|
||||||
{
|
{
|
||||||
//return empty resultlist
|
//return empty resultlist
|
||||||
return ResultList;
|
return ReturnObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Save the matching count
|
//Save the matching count
|
||||||
@@ -323,10 +324,14 @@ namespace AyaNova.Biz
|
|||||||
MatchingObjects = CanReadMatchingObjects;
|
MatchingObjects = CanReadMatchingObjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//TOTAL RESULTS
|
||||||
|
//we have the total results here so set accordingly
|
||||||
|
ReturnObject.TotalResultsFound=MatchingObjects.Count;
|
||||||
|
|
||||||
//MAXIMUM RESULTS FILTER
|
//MAXIMUM RESULTS FILTER
|
||||||
//The theory is that it should be filtered BEFORE sorting so that you get the most random collection of results
|
//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...
|
//As the results are not ranked so...
|
||||||
|
|
||||||
if (searchParameters.MaxResults > 0)//0 = all results
|
if (searchParameters.MaxResults > 0)//0 = all results
|
||||||
MatchingObjects = MatchingObjects.Take(searchParameters.MaxResults).ToList();
|
MatchingObjects = MatchingObjects.Take(searchParameters.MaxResults).ToList();
|
||||||
|
|
||||||
@@ -353,14 +358,14 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
SR.Id = i.ObjectId;
|
SR.Id = i.ObjectId;
|
||||||
SR.Type = i.ObjectType;
|
SR.Type = i.ObjectType;
|
||||||
ResultList.Add(SR);
|
ReturnObject.SearchResults.Add(SR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// watch.Stop();//###################### PROFILING
|
// watch.Stop();//###################### PROFILING
|
||||||
// var TimeToBuildSearchResultReturnList = watch.ElapsedMilliseconds;//###################### PROFILING
|
// var TimeToBuildSearchResultReturnList = watch.ElapsedMilliseconds;//###################### PROFILING
|
||||||
|
|
||||||
return ResultList;
|
return ReturnObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -415,7 +420,7 @@ namespace AyaNova.Biz
|
|||||||
List<MatchingDictionaryEntry> MatchingKeywordIdList = new List<MatchingDictionaryEntry>();
|
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
|
//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);
|
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
|
//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
|
//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
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|
||||||
}//eons
|
}//eons
|
||||||
Reference in New Issue
Block a user