Didn't quite understand this make_term_query, but does it work the same way as lib_json:set_attr? Then maybe use that instead?