basho/yokozuna — pull request #371 by rzezeski (2014-05-08 20:25:37+00:00)
Title: Fix various issues re deleting documents

This is a fix for #370.

Jimmy Mullen, with the help of a user, discovered issues deleting keys
which contain curly braces. A patch was made recently to wrap the key
in double quotes (Lucene phrase query) but it turns out there were
other issues with the code.

* Don't url encode the key. The keys are not stored url encoded and
the query is being sent as a body of JSON, not
`application/x-www-form-urlencoded`.

* Don't perform a `binary_to_list`. This breaks keys with non-latin
characters.

* Don't build up a list when a binary can be used. This should be
more efficient than `++`.

* Use the term query parser for future safety. Just quoting works now
but future changes like the complex phrase query syntax could cause
issues. The use of the term query parser protects the characters
from parsing (with 2 exceptions noted next).

* Escape any double quote or backslash characters. The double quote
must be escaped because double quotes are used to wrap the query.
Backslash is escaped to prevent Solr from treating it as an escape
sequence.

Other changes made:

* Modified the sibling test to use a key with various special
characters and added a case for regular deletion.

* Removed dead code from `yz_solr`.

* Moved `delete_op` type to `yz_solr` and added docs for the various
types.

* Use cons instead of `++` when building list of fields.