+@compiles(LookupAll, 'sqlite') # type: ignore[no-untyped-call, misc]
+def _sqlite_lookup_all(element: LookupAll,
+ compiler: 'sa.Compiled', **kw: Any) -> str:
+ place, col, colname, tokens = list(element.clauses)
+ return "(%s IN (SELECT CAST(value as bigint) FROM"\
+ " (SELECT array_intersect_fuzzy(places) as p FROM"\
+ " (SELECT places FROM reverse_search_name"\
+ " WHERE word IN (SELECT value FROM json_each('[' || %s || ']'))"\
+ " AND column = %s"\
+ " ORDER BY length(places)) as x) as u,"\
+ " json_each('[' || u.p || ']'))"\
+ " AND array_contains(%s, %s))"\
+ % (compiler.process(place, **kw),
+ compiler.process(tokens, **kw),
+ compiler.process(colname, **kw),
+ compiler.process(col, **kw),
+ compiler.process(tokens, **kw)
+ )
+
+