public async Task <SearchResult> PerformQuery(SearchQuery parsedQuery, PangulDbContext db, UserContext user, int offset, int limit)
        {
            var results = new SearchResultAggregator(offset, limit);

            if (results.Push(await MatchName(parsedQuery, db)))
            {
                return(results.AsResult());
            }

            if (results.Push(await MatchAll(parsedQuery, db)))
            {
                return(results.AsResult());
            }

            return(results.AsResult());
        }
Esempio n. 2
0
        public async Task <SearchResult> PerformQuery(SearchQuery parsedQuery, PangulDbContext db, UserContext user, int offset, int limit)
        {
            SetQueryTopic(parsedQuery);
            var results = new SearchResultAggregator(offset, limit);

            if (results.Push(await MatchTitle(parsedQuery, db, user)))
            {
                return(results.AsResult());
            }

            if (results.Push(await MatchTag(parsedQuery, db, user)))
            {
                return(results.AsResult());
            }

            if (results.Push(await MatchQuestionBody(parsedQuery, db, user)))
            {
                return(results.AsResult());
            }

            if (results.Push(await MatchAnswerBody(parsedQuery, db, user)))
            {
                return(results.AsResult());
            }

            if (results.Push(await MatchAll(parsedQuery, db, user)))
            {
                return(results.AsResult());
            }

            return(results.AsResult());
        }