POST /search sometimes selects the wrong composite key to use for the searching which causes a NullPointerException