fix(searchDoc): Correct onlyCount return when error occurs (refs #4915)