Indentation of "if".  Please put a space around operators (```!=``` and ```=``` here).

This only rejects a small subset of invalid strings (those that are the wrong length).

If you parsed the string here, you could reject any invalid combination by throwing Xapian::InvalidArgumentError, which would be more helpful to the API user.