- return sa.func.weigh_search(table.c[self.column],
- [f"{{{','.join((str(s) for s in r.tokens))}}}"
- for r in self.rankings],
- [r.penalty for r in self.rankings],
- self.default)
+ rout = JsonWriter().start_array()
+ for rank in self.rankings:
+ rout.start_array().value(rank.penalty).next()
+ rout.start_array()
+ for token in rank.tokens:
+ rout.value(token).next()
+ rout.end_array()
+ rout.end_array().next()
+ rout.end_array()
+
+ return sa.func.weigh_search(table.c[self.column], rout(), self.default)