diff --git a/devdocs/todo.txt b/devdocs/todo.txt index 94a69eb4..f9918185 100644 --- a/devdocs/todo.txt +++ b/devdocs/todo.txt @@ -15,6 +15,25 @@ After round one of improvements (less text in seed data notes, not calling savec 2020-01-23 16:57:57.0422|INFO|Seeder|75 Users seeded in 2398 ms 2020-01-23 16:58:11.9983|INFO|Seeder|500 Widgets seeded in 14958 ms +TODO: Find out if this is linear time for more widgets or exponential to see if it exposes part of the issue +X widgets, ms per widget: +100=32 +500=29 (27 in non debug mode) +5000=29 + + +Stripped out all text to index except single letter a in notes and c2 +500=20 + +Now going to try the opposite, a *lot* of text 10 paragraphs in both c2 and notes +500=59ms + +So the quantity of text directly affects the performance, so it's not just some overhead from the query being run, it's the amount of work it needs to do in the queries + + + + + TODO: Search indexing is painfully slow, it accounts for 16 of 22 seconds when creating 500 widgets with full paragraphs of text - Try to see if it's just one part of the operation by timing it - Re-code it not using EF but directly interacting with the DB diff --git a/server/AyaNova/Startup.cs b/server/AyaNova/Startup.cs index 15f6de4b..ad074898 100644 --- a/server/AyaNova/Startup.cs +++ b/server/AyaNova/Startup.cs @@ -449,7 +449,7 @@ namespace AyaNova { AyaNova.Core.License.Fetch(apiServerState, dbContext, _newLog); //NOTE: For unit testing make sure the time zone in util is set to the same figure as here to ensure list filter by date tests will work because server is on same page as user in terms of time - Util.Seeder.SeedDatabase(Util.Seeder.SeedLevel.MediumLocalServiceCompanyTrialDataSet, -7);//.Wait();//############################################################################################# + Util.Seeder.SeedDatabase(Util.Seeder.SeedLevel.MediumLocalServiceCompanyTrialDataSet, -7);//############################################################################################# } //TESTING #endif diff --git a/server/AyaNova/biz/Search.cs b/server/AyaNova/biz/Search.cs index 5ed90357..64ef4e10 100644 --- a/server/AyaNova/biz/Search.cs +++ b/server/AyaNova/biz/Search.cs @@ -463,7 +463,6 @@ namespace AyaNova.Biz private static void ProcessKeywords(SearchIndexProcessObjectParameters p, bool newRecord)//long localeId, long objectID, AyaType objectType, string name, params string[] text) { - //AyContext ct = ServiceProviderProvider.DBContext; #if (DEBUG) if (p.ObjectType == AyaType.JobOperations || p.ObjectType == AyaType.Locale) { @@ -483,13 +482,7 @@ namespace AyaNova.Biz //BREAK NAME STRING List NameKeyWordList = Break(p.LocaleId, p.Name); - - //BUILD ALL KEYWORDS LIST - // List tempList = new List(); - // tempList.AddRange(KeyWordList); - // tempList.AddRange(p.Tags); - // var DistinctAllKeywordsCombinedList = tempList.Distinct(); - // AllKeyWordsCombinedList=((IEnumerable)AllKeyWordsCombinedList).Distinct(); + //EARLY EXIT IF NO KEYWORDS OR NAME RECORD OR TAGS TO PROCESS if (KeyWordList.Count == 0 && string.IsNullOrWhiteSpace(p.Name)) @@ -503,7 +496,7 @@ namespace AyaNova.Biz //ITERATE ALL THE KEYWORDS, SEARCH IN THE SEARCHDICTIONARY TABLE AND COLLECT ID'S OF ANY PRE-EXISTING IN DB KEYWORDS var ExistingKeywordMatches = ServiceProviderProvider.DBContext.SearchDictionary.AsNoTracking().Where(m => KeyWordList.Contains(m.Word)).ToDictionary(m => m.Id, m => m.Word); - //var ExistingKeywordMatches = ServiceProviderProvider.DBContext.SearchDictionary.AsNoTracking().Where(m => DistinctAllKeywordsCombinedList.Contains(m.Word)).ToDictionary(m => m.Id, m => m.Word); + //Put the matching keyword ID's into the list foreach (KeyValuePair K in ExistingKeywordMatches) { @@ -562,8 +555,7 @@ namespace AyaNova.Biz throw ex; } - //FETCH THE WORD ID, PLACE IN MATCHINGKEYWORDLIST AND MOVE ON TO THE NEXT WORD - //LOOKAT: 2018-10-10 15:34:34.0587|ERROR|Server Exception|Error=>System.InvalidOperationException: Sequence contains no elements + //FETCH THE WORD ID, PLACE IN MATCHINGKEYWORDLIST AND MOVE ON TO THE NEXT WORD var SearchDictionaryMatchFoundInDB = ServiceProviderProvider.DBContext.SearchDictionary.AsNoTracking().Where(x => x.Word == KeyWord).FirstOrDefault(); if (SearchDictionaryMatchFoundInDB != null) { diff --git a/server/AyaNova/util/Seeder.cs b/server/AyaNova/util/Seeder.cs index 42f3d1c4..77899c46 100644 --- a/server/AyaNova/util/Seeder.cs +++ b/server/AyaNova/util/Seeder.cs @@ -615,7 +615,7 @@ namespace AyaNova.Util var c3 = f.Random.Int(1, 99999999); var c4 = f.Random.Bool().ToString().ToLowerInvariant(); var c5 = f.Random.Decimal(); - //2019-05-01T21:38:07Z + o.CustomFields = $@"{{c1:""{c1}"",c2:""{c2}"",c3:{c3},c4:{c4},c5:{c5}}}";