mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-09 17:44:59 +09:00
GO-4118: Speed up install query
This commit is contained in:
parent
77b84f146f
commit
08aabe34ad
2 changed files with 27 additions and 0 deletions
|
@ -141,6 +141,21 @@ func (s *service) listInstalledObjects(space clientspace.Space, sourceObjectIds
|
|||
Condition: model.BlockContentDataviewFilter_In,
|
||||
Value: pbtypes.StringList(sourceObjectIds),
|
||||
},
|
||||
{
|
||||
Operator: model.BlockContentDataviewFilter_Or,
|
||||
NestedFilters: []*model.BlockContentDataviewFilter{
|
||||
{
|
||||
RelationKey: bundle.RelationKeyLayout.String(),
|
||||
Condition: model.BlockContentDataviewFilter_Equal,
|
||||
Value: pbtypes.Int64(int64(model.ObjectType_objectType)),
|
||||
},
|
||||
{
|
||||
RelationKey: bundle.RelationKeyLayout.String(),
|
||||
Condition: model.BlockContentDataviewFilter_Equal,
|
||||
Value: pbtypes.Int64(int64(model.ObjectType_relation)),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -270,6 +285,16 @@ func (s *service) queryDeletedObjects(space clientspace.Space, sourceObjectIDs [
|
|||
return nil, err
|
||||
}
|
||||
return s.objectStore.SpaceIndex(space.Id()).QueryRaw(&database.Filters{FilterObj: database.FiltersAnd{
|
||||
database.FiltersOr{
|
||||
database.FilterEq{
|
||||
Key: bundle.RelationKeyLayout.String(),
|
||||
Value: pbtypes.Int64(int64(model.ObjectType_objectType)),
|
||||
},
|
||||
database.FilterEq{
|
||||
Key: bundle.RelationKeyLayout.String(),
|
||||
Value: pbtypes.Int64(int64(model.ObjectType_relation)),
|
||||
},
|
||||
},
|
||||
database.FilterIn{
|
||||
Key: bundle.RelationKeySourceObject.String(),
|
||||
Value: sourceList,
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
|
||||
"github.com/anyproto/anytype-heart/pkg/lib/bundle"
|
||||
"github.com/anyproto/anytype-heart/pkg/lib/localstore/objectstore"
|
||||
"github.com/anyproto/anytype-heart/pkg/lib/pb/model"
|
||||
"github.com/anyproto/anytype-heart/space/clientspace/mock_clientspace"
|
||||
"github.com/anyproto/anytype-heart/util/pbtypes"
|
||||
)
|
||||
|
@ -48,6 +49,7 @@ func TestInstaller_queryDeletedObjects(t *testing.T) {
|
|||
bundle.RelationKeySourceObject: pbtypes.String(obj.key.BundledURL()),
|
||||
bundle.RelationKeyIsDeleted: pbtypes.Bool(obj.isDeleted),
|
||||
bundle.RelationKeyIsArchived: pbtypes.Bool(obj.isArchived),
|
||||
bundle.RelationKeyLayout: pbtypes.Int64(int64(model.ObjectType_relation)),
|
||||
}})
|
||||
sourceObjectIds = append(sourceObjectIds, obj.key.BundledURL())
|
||||
if obj.spaceId == spaceId && (obj.isDeleted || obj.isArchived) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue