core (memory/sqla): searchPubsubItems can now filter on item names

This commit is contained in:
Goffi 2022-05-13 18:02:37 +02:00
commit c678f1f993

View file

@ -1425,6 +1425,8 @@ class Storage:
:subtypes (list[str|None]):
filter on nodes with those subtypes. None can be used to filter on nodes with
no subtype set
:names (list[str]):
filter on items with those names
:parsed (list[dict]):
Filter on a parsed data field. The dict must contain 3 keys: ``path``
which is a list of str or int giving the path to the field of interest
@ -1511,6 +1513,11 @@ class Storage:
else:
stmt = stmt.options(selectinload(PubsubItem.node))
# names
names = query.get("names")
if names:
stmt = stmt.where(PubsubItem.name.in_(names))
# parsed data filters
parsed = query.get("parsed", [])
for filter_ in parsed: