I’ve previously seen behavior like that (a count but no results) when there were invalid UTF8 characters in the content, which breaks the json generation. And also when there’s an issue with the query itself after the count which @halftrainedharry suggested.
In this case I’m 92% sure the problem is sorting by rank
- that’s a reserved keyword and needs special handling. Did you not get any messages about that in the MODX error log?
Try replacing
$c->sortby($sortField,$sortDir);
with
$c->sortby($this->modx->quote($sortField), $sortDir);
in the file @halftrainedharry linked to. Went ahead and created an issue for it.