From 9e8bac46aba59194c89dae48a68c1a275e7e13f4 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 28 Jan 2020 22:12:47 +0000 Subject: [PATCH] --- server/AyaNova/Startup.cs | 6 +++--- server/AyaNova/biz/Search.cs | 31 ++++++++++++++++++++++--------- server/AyaNova/util/License.cs | 14 +++++++------- 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/server/AyaNova/Startup.cs b/server/AyaNova/Startup.cs index c0607f2d..0e95bbe8 100644 --- a/server/AyaNova/Startup.cs +++ b/server/AyaNova/Startup.cs @@ -414,7 +414,7 @@ namespace AyaNova // ******************** TESTING WIPE DB ***************************** // //Set this to true to wipe the db and reinstall a trial license and re-seed the data - var TESTING_REFRESH_DB = false;//####################################################################################### + var TESTING_REFRESH_DB = true;//####################################################################################### #if (DEBUG) @@ -455,7 +455,7 @@ namespace AyaNova { AyaNova.Core.License.FetchKeyAsync(apiServerState, dbContext, _newLog).Wait(); //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.SeedDatabaseAsync(Util.Seeder.SeedLevel.SmallOneManShopTrialDataSet, -7).Wait();//############################################################################################# + Util.Seeder.SeedDatabaseAsync(Util.Seeder.SeedLevel.MediumLocalServiceCompanyTrialDataSet, -7).Wait();//############################################################################################# } //TESTING #endif @@ -484,7 +484,7 @@ namespace AyaNova _newLog.LogInformation($"BOOT: Active techs - {UserBiz.ActiveCountAsync().Result}"); //Log the license info so it's on the record - _newLog.LogInformation($"BOOT: License {AyaNova.Core.License.LicenseInfoLogFormat}"); + _newLog.LogInformation($"BOOT: License - [{AyaNova.Core.License.LicenseInfoLogFormat}]"); diff --git a/server/AyaNova/biz/Search.cs b/server/AyaNova/biz/Search.cs index 2c4d7228..a6d94ce4 100644 --- a/server/AyaNova/biz/Search.cs +++ b/server/AyaNova/biz/Search.cs @@ -704,8 +704,21 @@ cache or provide directly the locale to save time repeatedly fetching it when do } } - //Get the current stopwords for the user's locale - //called in here in this class and also by any bulk ops like seeding etc +private static Dictionary localeWordBreakingDataCache = new Dictionary(); + +// //called at startup to populate cache +// internal static async Task CacheAllLocaleWordBreakingData(){ +// //iterate all locales, cache the word break data +// l = await ct.Locale +// .AsNoTracking() +// .OrderBy(m => m.Name) +// .Select(m => new NameIdItem() +// { +// Id = m.Id, +// Name = m.Name +// }).ToListAsync(); +// localeWordBreakingDataCache.Add(localeId, await GetLocaleSearchDataAsync(localeId)); +// } internal static async Task GetLocaleSearchDataAsync(long localeId, AyContext ct = null) { LocaleWordBreakingData LSD = new LocaleWordBreakingData(); @@ -782,13 +795,13 @@ cache or provide directly the locale to save time repeatedly fetching it when do /// used for eliminating noise words from search dictionary /// - private static Dictionary localeWordBreakingDataCache = new Dictionary(); - //called by Locale in the rare circumstance that a local has changed that is cached - //and might affect word breaking (stopwords cjkindex etc) - internal static void ClearLocaleWordBreakingDataCache(long localeId) - { - localeWordBreakingDataCache.Remove(localeId); - } + + // //called by Locale in the rare circumstance that a locale has changed that is cached + // //and might affect word breaking (stopwords cjkindex etc) + // internal static void ClearLocaleWordBreakingDataCache(long localeId) + // { + // localeWordBreakingDataCache.Remove(localeId); + // } internal static async Task> BreakCoreAsync(long localeId, bool KeepWildCards, List textStrings) { diff --git a/server/AyaNova/util/License.cs b/server/AyaNova/util/License.cs index 4019f811..6053fab2 100644 --- a/server/AyaNova/util/License.cs +++ b/server/AyaNova/util/License.cs @@ -47,7 +47,7 @@ namespace AyaNova.Core private static Guid TEST_TRIAL_KEY_DBID = new Guid("{A6D18A8A-5613-4979-99DA-80D07641A2FE}"); - + //Current license key, can be empty private static AyaNovaLicenseKey _ActiveLicense = new AyaNovaLicenseKey(); @@ -71,7 +71,7 @@ namespace AyaNova.Core internal class AyaNovaLicenseKey { public AyaNovaLicenseKey() - { + { Features = new List(); RegisteredTo = "UNLICENSED"; Id = RegisteredTo; @@ -280,7 +280,7 @@ namespace AyaNova.Core } -/// + /// /// Fetch a summary of the license key for displaying in the log /// /// string containing current license information @@ -292,11 +292,11 @@ namespace AyaNova.Core if (ActiveKey.IsEmpty) { - return $"UNLICENSED, DB ID: {DbId}"; + return $"UNLICENSED, DB ID: {DbId}"; } else { - + if (ActiveKey.TrialLicense) sb.Append("TRIAL, "); @@ -321,7 +321,7 @@ namespace AyaNova.Core } } - return sb.ToString(); + return sb.ToString().Trim().TrimEnd(','); } } @@ -437,7 +437,7 @@ namespace AyaNova.Core try { - + //string RawTextKeyFromRockfish = await _Client.GetStringAsync(sUrl); string RawTextKeyFromRockfish = await ServiceProviderProvider.HttpClientFactory.CreateClient().GetStringAsync(sUrl); //FUTURE: if there is any kind of error response or REASON or LicenseFetchStatus then here is