feat(SearchDoc): Throw exception when onlyCount() query is invalid (closes #5162)