Consolidate and simplify searching and comparison logic

Almost ever comparison can go through compareJsonbScalarValue()
directly, simplifying things.