Incorporate updated suggestions query into Java

Note that the suggestions query has still not been fully tested.