1

I've been experimenting with an autocomplete function that starts searching on the first letter a user types. Currently for autocompletion we append a wildcard (*) character to the end of the search term so that we can match terms beginning with that query. However, when using a query with only one letter plus the wildcard (e.g. s*) I get an error with the following traceback:

Traceback:
File "/Users/myuser/.virtualenvs/ws/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  115.                         response = callback(request, *callback_args, **callback_kwargs)
File "/Users/myuser/Development/site_project/myapp/myapp/ajax.py" in autocomplete_artist
  165.  for objArtistResult in objArtistResultSet:
File "/Users/myuser/.virtualenvs/ws/lib/python2.7/site-packages/djapian/resultset.py" in __iter__
  252.         self._fetch_results()
File "/Users/myuser/.virtualenvs/ws/lib/python2.7/site-packages/djapian/resultset.py" in _fetch_results
  221.             self._parse_results()
File "/Users/myuser/.virtualenvs/ws/lib/python2.7/site-packages/djapian/resultset.py" in _parse_results
  249.             self._do_prefetch()
File "/Users/myuser/.virtualenvs/ws/lib/python2.7/site-packages/djapian/resultset.py" in _do_prefetch
  201.                 hit.instance = instances[hit.pk]

Exception Type: KeyError at /ajax/autocomplete/artist/
Exception Value: 68651

When I try to find a record with the ID of the exception value it can't be found, so I don't know where this value is coming from. Has anyone else experienced this?

benwad
  • 6,414
  • 10
  • 59
  • 93

0 Answers0