Djapian:单字母查询加上通配符会导致错误

时间:2014-07-09 13:25:37

标签: python django search xapian

我一直在试验自动完成功能,该功能开始搜索用户键入的第一个字母。目前,为了自动完成,我们在搜索词的末尾附加一个通配符(*)字符,以便我们可以匹配以该查询开头的字词。但是,当使用只有一个字母加上通配符的查询(例如s*)时,我会收到以下回溯错误:

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

当我尝试查找具有异常值ID的记录时,无法找到它,因此我不知道该值的来源。还有其他人经历过这个吗?

0 个答案:

没有答案