|
|
@ -82,7 +82,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.FullText |
|
|
public async Task<List<DomainId>?> SearchAsync(IAppEntity app, GeoQuery query, SearchScope scope) |
|
|
public async Task<List<DomainId>?> SearchAsync(IAppEntity app, GeoQuery query, SearchScope scope) |
|
|
{ |
|
|
{ |
|
|
var byGeo = |
|
|
var byGeo = |
|
|
await Collection.Find( |
|
|
await GetCollection(scope).Find( |
|
|
Filter.And( |
|
|
Filter.And( |
|
|
Filter.Eq(x => x.AppId, app.Id), |
|
|
Filter.Eq(x => x.AppId, app.Id), |
|
|
Filter.Eq(x => x.SchemaId, query.SchemaId), |
|
|
Filter.Eq(x => x.SchemaId, query.SchemaId), |
|
|
@ -126,7 +126,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.FullText |
|
|
private async Task<List<DomainId>> SearchBySchemaAsync(string queryText, IAppEntity app, TextFilter filter, SearchScope scope, int limit) |
|
|
private async Task<List<DomainId>> SearchBySchemaAsync(string queryText, IAppEntity app, TextFilter filter, SearchScope scope, int limit) |
|
|
{ |
|
|
{ |
|
|
var bySchema = |
|
|
var bySchema = |
|
|
await Collection.Find( |
|
|
await GetCollection(scope).Find( |
|
|
Filter.And( |
|
|
Filter.And( |
|
|
Filter.Eq(x => x.AppId, app.Id), |
|
|
Filter.Eq(x => x.AppId, app.Id), |
|
|
Filter.In(x => x.SchemaId, filter.SchemaIds), |
|
|
Filter.In(x => x.SchemaId, filter.SchemaIds), |
|
|
@ -143,7 +143,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.FullText |
|
|
private async Task<List<DomainId>> SearchByAppAsync(string queryText, IAppEntity app, SearchScope scope, int limit) |
|
|
private async Task<List<DomainId>> SearchByAppAsync(string queryText, IAppEntity app, SearchScope scope, int limit) |
|
|
{ |
|
|
{ |
|
|
var bySchema = |
|
|
var bySchema = |
|
|
await Collection.Find( |
|
|
await GetCollection(scope).Find( |
|
|
Filter.And( |
|
|
Filter.And( |
|
|
Filter.Eq(x => x.AppId, app.Id), |
|
|
Filter.Eq(x => x.AppId, app.Id), |
|
|
Filter.Exists(x => x.SchemaId), |
|
|
Filter.Exists(x => x.SchemaId), |
|
|
@ -168,5 +168,17 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.FullText |
|
|
return Filter.Eq(x => x.ServePublished, true); |
|
|
return Filter.Eq(x => x.ServePublished, true); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private IMongoCollection<MongoTextIndexEntity> GetCollection(SearchScope scope) |
|
|
|
|
|
{ |
|
|
|
|
|
if (scope == SearchScope.All) |
|
|
|
|
|
{ |
|
|
|
|
|
return Collection; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
return Collection.WithReadPreference(ReadPreference.Secondary); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|