Filters optimization; Use cache proxy with filters in views
This commit is contained in:
parent
67cf51bbf3
commit
a1c02bda9b
@ -74,6 +74,7 @@ from gramps.gen.filters import SearchFilter, ExactSearchFilter
|
|||||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||||
from .basemodel import BaseModel
|
from .basemodel import BaseModel
|
||||||
from ...user import User
|
from ...user import User
|
||||||
|
from gramps.gen.proxy.cache import CacheProxyDb
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -608,18 +609,19 @@ class FlatBaseModel(GObject.GObject, Gtk.TreeModel, BaseModel):
|
|||||||
self.clear_cache()
|
self.clear_cache()
|
||||||
self._in_build = True
|
self._in_build = True
|
||||||
if (self.db is not None) and self.db.is_open():
|
if (self.db is not None) and self.db.is_open():
|
||||||
|
cdb = CacheProxyDb(self.db)
|
||||||
allkeys = self.node_map.full_srtkey_hndl_map()
|
allkeys = self.node_map.full_srtkey_hndl_map()
|
||||||
if not allkeys:
|
if not allkeys:
|
||||||
allkeys = self.sort_keys()
|
allkeys = self.sort_keys()
|
||||||
if self.search:
|
if self.search:
|
||||||
ident = False
|
ident = False
|
||||||
if ignore is None:
|
if ignore is None:
|
||||||
dlist = self.search.apply(self.db, allkeys, tupleind=1,
|
dlist = self.search.apply(cdb, allkeys, tupleind=1,
|
||||||
user=self.user)
|
user=self.user)
|
||||||
else:
|
else:
|
||||||
dlist = self.search.apply(self.db,
|
dlist = self.search.apply(
|
||||||
[ k for k in allkeys if k[1] != ignore],
|
cdb, [k for k in allkeys if k[1] != ignore],
|
||||||
tupleind=1)
|
tupleind=1)
|
||||||
elif ignore is None :
|
elif ignore is None :
|
||||||
ident = True
|
ident = True
|
||||||
dlist = allkeys
|
dlist = allkeys
|
||||||
|
@ -57,6 +57,7 @@ from ...user import User
|
|||||||
from bisect import bisect_right
|
from bisect import bisect_right
|
||||||
from gramps.gen.filters import SearchFilter, ExactSearchFilter
|
from gramps.gen.filters import SearchFilter, ExactSearchFilter
|
||||||
from .basemodel import BaseModel
|
from .basemodel import BaseModel
|
||||||
|
from gramps.gen.proxy.cache import CacheProxyDb
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -584,7 +585,8 @@ class TreeBaseModel(GObject.GObject, Gtk.TreeModel, BaseModel):
|
|||||||
self.__total += items
|
self.__total += items
|
||||||
assert not skip
|
assert not skip
|
||||||
if dfilter:
|
if dfilter:
|
||||||
for handle in dfilter.apply(self.db,
|
cdb = CacheProxyDb(self.db)
|
||||||
|
for handle in dfilter.apply(cdb,
|
||||||
user=User(parent=self.uistate.window)):
|
user=User(parent=self.uistate.window)):
|
||||||
status_ppl.heartbeat()
|
status_ppl.heartbeat()
|
||||||
data = data_map(handle)
|
data = data_map(handle)
|
||||||
|
Loading…
Reference in New Issue
Block a user