Correctly handle OR queries in the listing module (see #6344)