internal dynamic RunWordSearch() { Navigation_ADO adoNav = new Navigation_ADO(Ado); //Search based on the supplied keywords dynamic data = adoNav.Search(DTO); //Express the result of the keyword search as a list of objects List <RawSearchResult> rlistWordSearch = GetRawWordSearchResults(data); //Get a list of matrixes that fit the search exactly var exactMatches = GetExactMatches(rlistWordSearch, searchTermCount); //Get a list of matrixes that fit the search via synonyms var lemmaMatches = GetLemmaMatches(rlistWordSearch, searchTermCount); //Express all of the matrixes in a data table DataTable dt = GetResultDataTableWordSearch(exactMatches, lemmaMatches); //pass the datatable to the stored procedure to get the metadata associated with the matrix dynamic dataPlusMetadata = adoNav.ReadSearchResults(dt, DTO.LngIsoCode); //Format the result as a json response return(FormatOutput(dataPlusMetadata, DTO.LngIsoCode)); }
/// <summary> /// Execute /// </summary> /// <returns></returns> protected override bool Execute() { Navigation_ADO adoNav = new Navigation_ADO(Ado); dynamic data = adoNav.Search(DTO); Response.data = FormatOutput(data, DTO.LngIsoCode); return(true); }
/// <summary> /// Execute /// </summary> /// <returns></returns> protected override bool Execute() { Navigation_ADO adoNav = new Navigation_ADO(Ado); //If we're cacheing, we only want the cache to live until the next scheduled release goes live //Also, if there is a next release before the scheduled cache expiry time, then we won't trust the cache var nextRelease = adoNav.ReadNextLiveDate(DateTime.Now); DateTime nextReleaseDate = default; if (nextRelease.hasData) { if (!nextRelease.data[0].NextRelease.Equals(DBNull.Value)) { nextReleaseDate = Convert.ToDateTime(nextRelease.data[0].NextRelease); } } //Read the cached value for this if it's available but only if there isn't a next release before the cache expiry time MemCachedD_Value cache = MemCacheD.Get_BSO <dynamic>("PxStat.System.Navigation", "Navigation_API", "Read", DTO); if (cache.hasData && nextReleaseDate >= cache.expiresAt) { Response.data = cache.data; return(true); } //No cache available, so read from the database and cache that result ADO_readerOutput result = adoNav.Read(DTO); if (result.hasData) { List <dynamic> formattedOutput = formatOutput(result.data); if (nextRelease != null) { if (nextRelease.hasData) { if (!nextRelease.data[0].NextRelease.Equals(DBNull.Value)) { nextReleaseDate = Convert.ToDateTime(nextRelease.data[0].NextRelease); } } } Response.data = formattedOutput; MemCacheD.Store_BSO <dynamic>("PxStat.System.Navigation", "Navigation_API", "Read", DTO, Response.data, nextReleaseDate, Resources.Constants.C_CAS_NAVIGATION_READ); return(true); } return(false); }
/// <summary> /// Execute /// </summary> /// <returns></returns> protected override bool Execute() { Navigation_ADO adoNav = new Navigation_ADO(Ado); Navigation_BSO nBso = new Navigation_BSO(Ado, DTO); bool wordSearch = false; if (!String.IsNullOrEmpty(DTO.Search)) { DTO.SearchTerms = nBso.PrepareSearchData(); wordSearch = true; } //DTO.search has too much variation to use as a cache key - the search terms are formatted in the table so we don't need it any more DTO.Search = ""; MemCachedD_Value cache = MemCacheD.Get_BSO("PxStat.System.Navigation", "Navigation_API", "Search", DTO); // if (cache.hasData) { Response.data = cache.data; return(true); } if (wordSearch) { Response.data = nBso.RunWordSearch(); } else { Response.data = nBso.RunEntitySearch(); } DateTime minDateItem = default; Release_ADO rAdo = new Release_ADO(Ado); dynamic dateQuery = rAdo.ReadNextReleaseDate(); if (dateQuery != null) { minDateItem = dateQuery.RlsDatetimeNext.Equals(DBNull.Value) ? default(DateTime) : dateQuery.RlsDatetimeNext; } else { minDateItem = default; } MemCacheD.Store_BSO("PxStat.System.Navigation", "Navigation_API", "Search", DTO, Response.data, minDateItem, Resources.Constants.C_CAS_NAVIGATION_SEARCH); return(true); }
internal dynamic RunEntitySearch() { Navigation_ADO adoNav = new Navigation_ADO(Ado); //Search based on entities named in the DTO dynamic entityData = adoNav.EntitySearch(DTO); List <RawSearchResult> rEntities = GetRawWordSearchResults(entityData); DataTable dt = GetResultDataTableEntitySearch(rEntities); //pass the datatable to the stored procedure to get the metadata associated with the matrix dynamic dataV2 = adoNav.ReadSearchResults(dt, DTO.LngIsoCode); //Format the result as a json response return(FormatOutput(dataV2, DTO.LngIsoCode)); }