Example #1
0
        public async Task <IEnumerable <ArticleDto> > SearchAsync(string queryText)
        {
            if (string.IsNullOrWhiteSpace(queryText))
            {
                throw new JppcException(Codes.InvalidQueryText,
                                        $"The query text can not be empty.");
            }

            var results = await _articleElasticRepository.SearchAsync(queryText);

            return(results);
        }
Example #2
0
        public async Task <TResponse> Query <TEntity, TResponse, TCriteria>(TCriteria queryCriteria)
            where TEntity : class, IEntity
            where TCriteria : QueryCriteria
        {
            var query = _queries.FirstOrDefault(x => x.QueryType == queryCriteria.QueryType)
                        as ElasticQueryObject <TEntity, TResponse, TCriteria>;

            if (query == null)
            {
                throw new NotImplementedException();
            }

            return(await _elasticRepository.SearchAsync(query, queryCriteria));
        }