Skip to content

Double quoting crashes the Python hook #57

Closed
lores opened this Issue May 13, 2010 · 2 comments

2 participants

@lores
lores commented May 13, 2010

Including double quotes in a search query causes an 'Unterminated string error' in couchdb-external-hook.py, so it's not possible to search for phrases.

http://localhost:5984/mydb/_fti/_design/users/search?q=firstname:"John Paul"
Traceback (most recent call last):
  File "/repo/lib/couchdb/couchdb-lucene/tools/couchdb-external-hook.py", line 45, in main
    resp = respond(res, req, line, opts.key)
  File "/repo/lib/couchdb/couchdb-lucene/tools/couchdb-external-hook.py", line 80, in respond
    args = [(k.strip('"'), json.loads(v)) for (k, v) in args]
  File "/var/lib/python-support/python2.5/simplejson/__init__.py", line 313, in loads
    return _default_decoder.decode(s)
  File "/var/lib/python-support/python2.5/simplejson/decoder.py", line 321, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/var/lib/python-support/python2.5/simplejson/decoder.py", line 338, in raw_decode
    obj, end = self._scanner.iterscan(s, **kw).next()
  File "/var/lib/python-support/python2.5/simplejson/scanner.py", line 53, in iterscan
    rval, next_pos = action(m, context)
  File "/var/lib/python-support/python2.5/simplejson/decoder.py", line 158, in JSONString
    return scanstring(match.string, match.end(), encoding, strict)
ValueError: Unterminated string starting at: line 1 column 0 (char 0)
@rnewson
Owner
rnewson commented May 17, 2010

avoid JSON object encoding problem by changing multiple query feature syntax. closed by caccea4.

@rnewson
Owner
rnewson commented May 17, 2010

fixed on master and 0.5.x. I've removed the attempt use regexps for this and have changed the API for multiple queries to be JSON friendly.

@rnewson rnewson pushed a commit to couchone/couchdb-lucene that referenced this issue Mar 30, 2012
Robert Newson avoid JSON object encoding problem by changing multiple query feature…
… syntax. closes #57.
caccea4
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.