diff sat/memory/sqla.py @ 3754:af485e8afe03

core (memory/sqla): `searchPubsubItems` can now filter on item names
author Goffi <goffi@goffi.org>
date Fri, 13 May 2022 18:02:37 +0200
parents 10b71e3526bd
children cc653b2685f0
line wrap: on
line diff
--- a/sat/memory/sqla.py	Fri May 13 17:58:51 2022 +0200
+++ b/sat/memory/sqla.py	Fri May 13 18:02:37 2022 +0200
@@ -1425,6 +1425,8 @@
             :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 @@
         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: