Esempio n. 1
0
        /*******************************************************
        * Helpers
        * *****************************************************/

        private async Task <Tuple <IList <SearchResultDto>, int> > UseFetchingMethod(string query, PagingInfo pagingInfo, string method, string startDate, string endDate)
        {
            IList <SearchResultDto> result = new List <SearchResultDto>();
            var numberOfRows = 0;

            switch (method)
            {
            case "\"\"":
                var option1 = await _SearchRepository.BestMatchWeighted(query, pagingInfo, startDate, endDate);

                result       = option1.Item1;
                numberOfRows = option1.Item2;
                break;

            case "\"bestmatchranked\"":
                var option2 = await _SearchRepository.BestMatchRanked(query, pagingInfo, startDate, endDate);

                result       = option2.Item1;
                numberOfRows = option2.Item2;
                break;

            case "\"matchall\"":
                var option3 = await _SearchRepository.MatchAll(query, pagingInfo, startDate, endDate);

                result       = option3.Item1;
                numberOfRows = option3.Item2;
                break;

            case "\"bestmatchweighted\"":
                var option4 = await _SearchRepository.BestMatchWeighted(query, pagingInfo, startDate, endDate);

                result       = option4.Item1;
                numberOfRows = option4.Item2;
                break;

            default:
                var defaultOption = await _SearchRepository.BestMatchWeighted(query, pagingInfo, startDate, endDate);

                result       = defaultOption.Item1;
                numberOfRows = defaultOption.Item2;
                break;
            }

            return(new Tuple <IList <SearchResultDto>, int>(result, numberOfRows));
        }