superfastmatch icon indicating copy to clipboard operation
superfastmatch copied to clipboard

Document iteration API is missing

Open dvogel opened this issue 12 years ago • 0 comments

The document iteration API is missing. Here's a testing snippet using the python-superfastmatch library:

import superfastmatch
c = superfastmatch.Client()
docs = superfastmatch.iterators.DocumentIterator(c, 'docid')
print len(list(docs))

Alternatively you can use the python-superfastmatch backup tool (this assumes there's documents in doctype 1 on SFM server at 127.0.0.1:8080):

rm test.zip && python -m superfastmatch.tools.backup 1 test.zip

Which currently throws:

Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/dvogel/sfm-us/python-superfastmatch/superfastmatch/tools/backup.py", line 39, in <module>
    main()
  File "/home/dvogel/sfm-us/python-superfastmatch/superfastmatch/tools/backup.py", line 36, in main
    backup(sfm, args.outpath, args.doctypes, chunksize=args.chunksize)
  File "superfastmatch/tools/routines.py", line 67, in backup
    for (file_number, docs_chunk) in enumerate(chunked_docs):
  File "superfastmatch/util.py", line 197, in next
    obj = self.subiter.next()
  File "superfastmatch/util.py", line 163, in next
    return self.subiter.next()
  File "superfastmatch/iterators.py", line 77, in next
    self.fetch_chunk()
  File "superfastmatch/iterators.py", line 106, in fetch_chunk
    self.accept_response(response)
  File "superfastmatch/iterators.py", line 126, in accept_response
    raise SuperFastMatchError('Response from server is missing "success" and/or "rows" keys.', 200, 200, response)
superfastmatch.client.SuperFastMatchError: Response from server is missing "success" and/or "rows" keys.

dvogel avatar Feb 12 '13 18:02 dvogel