For zero matches return empty hits array

Rather than returning null return {"hits": []}
for zero matches.
Sort the results before creating JSON document