Add ability to query threads that are not associated with any group_id

Should this also check for a null `group_id`?