fix query parsing logic. all Lucy tests now pass