TS query implement