Beispiel #1
0
 public Task <IResultList <IContentEntity> > QueryAsync(IAppEntity app, List <ISchemaEntity> schemas, Q q, SearchScope scope)
 {
     if (scope == SearchScope.All)
     {
         return(collectionAll.QueryAsync(app, schemas, q));
     }
     else
     {
         return(collectionPublished.QueryAsync(app, schemas, q));
     }
 }
Beispiel #2
0
        public async Task <IResultList <IContentEntity> > QueryAsync(IAppEntity app, ISchemaEntity schema, Status[] status, bool inDraft, Query query, bool includeDraft = true)
        {
            Guard.NotNull(app, nameof(app));
            Guard.NotNull(schema, nameof(schema));
            Guard.NotNull(query, nameof(query));

            using (Profiler.TraceMethod <MongoContentRepository>("QueryAsyncByQuery"))
            {
                var fullTextIds = await indexer.SearchAsync(query.FullText, app, schema.Id, inDraft?Scope.Draft : Scope.Published);

                if (fullTextIds?.Count == 0)
                {
                    return(ResultList.CreateFrom <IContentEntity>(0));
                }

                return(await contents.QueryAsync(schema, query, fullTextIds, status, inDraft, includeDraft));
            }
        }