Xapian-haystack: Problema com prazo muito longo

Criado em 22 mai. 2011  ·  3Comentários  ·  Fonte: notanumber/xapian-haystack

When I run manage.py rebuild_index I get following error: Quando executo manage.py rebuild_index recebo o seguinte erro:

```Traceback (most recent call last): ```Traceback (última chamada mais recente):
File "./manage.py", line 11, in Arquivo "./manage.py", linha 11, em
execute_manager(settings) execute_manager(configurações)
File "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/django/core/management/ init .py", line 438, in execute_manager Arquivo " /home/lorien/web/dumpz/.env/lib/python2.6/site-packages/django/core/management/init .py", linha 438, em execute_manager
utility.execute() utilitário.execute()
File "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/django/core/management/ init .py", line 379, in execute Arquivo " /home/lorien/web/dumpz/.env/lib/python2.6/site-packages/django/core/management/init .py", linha 379, em execute
self.fetch_command(subcommand).run_from_argv(self.argv) self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/django/core/management/base.py", line 191, in run_from_argv Arquivo "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/django/core/management/base.py", linha 191, em run_from_argv
self.execute(_args, *_options. dict ) self.execute(_args, *_options. dict )
File "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/django/core/management/base.py", line 220, in execute Arquivo "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/django/core/management/base.py", linha 220, em execute
output = self.handle(_args, *_options) output = self.handle(_args, *_options)
File "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/haystack/management/commands/rebuild_index.py", line 14, in handle Arquivo "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/haystack/management/commands/rebuild_index.py", linha 14, em handle
call_command('update_index', *_options) call_command('update_index', *_options)
File "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/django/core/management/ init .py", line 166, in call_command Arquivo " /home/lorien/web/dumpz/.env/lib/python2.6/site-packages/django/core/management/init .py", linha 166, em call_command
return klass.execute(_args, *_defaults) return klass.execute(_args, *_defaults)
File "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/django/core/management/base.py", line 220, in execute Arquivo "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/django/core/management/base.py", linha 220, em execute
output = self.handle(_args, *_options) output = self.handle(_args, *_options)
File "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/haystack/management/commands/update_index.py", line 184, in handle Arquivo "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/haystack/management/commands/update_index.py", linha 184, em handle
return super(Command, self).handle(_apps, *_options) return super(Comando, self).handle(_apps, *_options)
File "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/django/core/management/base.py", line 286, in handle Arquivo "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/django/core/management/base.py", linha 286, em handle
app_output = self.handle_app(app, *_options) app_output = self.handle_app(app, *_options)
File "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/haystack/management/commands/update_index.py", line 218, in handle_app Arquivo "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/haystack/management/commands/update_index.py", linha 218, em handle_app
do_update(index, qs, start, end, total, self.verbosity) do_update(index, qs, start, end, total, self.verbosity)
File "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/haystack/management/commands/update_index.py", line 100, in do_update Arquivo "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/haystack/management/commands/update_index.py", linha 100, em do_update
index.backend.update(index, current_qs) index.backend.update(index, current_qs)
File "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/xapian_backend.py", line 257, in update Arquivo "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/xapian_backend.py", linha 257, em atualização
database.replace_document(document_id, document) database.replace_document(document_id, document)
xapian.InvalidArgumentError: Term too long (> 245): 4f6d6e6961206d6561206d6563756d20706f72746f202d20e2f1e520f1e2eee520edeef8f320f120f1eee1eefe0d0a566974612073696e65206c69626572746174652c206e6968696c202d20e6e8e7edfc20e1e5e720f1e2eee1eee4fb202d20ede8f7f2ee0d0a417273206c6f6e67612c207669746120627265766973 xapian.InvalidArgumentError: Term too long (> 245): 4f6d6e6961206d6561206d6563756d20706f72746f202d20e2f1e520f1e2eee520edeef8f320f120f1eee1eefe0d0a566974612073696e65206c69626572746174652c206e6968696c202d20e6e8e7edfc20e1e5e720f1e2eee1eee4fb202d20ede8f7f2ee0d0a417273206c6f6e67612c207669746120627265766973

Do you have any idea how to handle this problem?

Thanks.

P.S.
python 2.6
python-xapian (debian) 1.2.4-1
libxapian (debian) 1.2.5
recent versions of django, haystack-xapian, django-xapian
en

Comentários muito úteis

@notanumber @jorgecarleitao What do you think about this https://github.com/Alir3z4/xapian-haystack/commit/a249b46c48957f4d8a776ef41b0ce12490ad52dd ? @notanumber @jorgecarleitao O que você acha disso https://github.com/Alir3z4/xapian-haystack/commit/a249b46c48957f4d8a776ef41b0ce12490ad52dd ?

the text document is usually more than 245, I know it's raised from xapian itself but this shouldn't break the [re]building the index. o documento de texto é geralmente mais de 245, eu sei que é gerado a partir do próprio xapian, mas isso não deve quebrar a [re]construção do índice.

en

Todos 3 comentários

I've created quick fix, it just ignores such error and I think documents with invalid terms are not added to index completely. Eu criei uma correção rápida, ela simplesmente ignora esse erro e acho que documentos com termos inválidos não são adicionados ao índice completamente.

``` lorien@big :/tmp/xapian-haystack$ git diff ``` lorien@big :/tmp/xapian-haystack$ git diff
diff --git a/xapian_backend.py b/xapian_backend.py diff --git a/xapian_backend.py b/xapian_backend.py
index fbbe221..1884613 100755 índice fbbe221..1884613 100755
--- a/xapian_backend.py --- a/xapian_backend.py
+++ b/xapian_backend.py +++ b/xapian_backend.py
@@ -259,7 +259,10 @@ class SearchBackend(BaseSearchBackend): @@ -259,7 +259,10 @@ class SearchBackend(BaseSearchBackend):
DOCUMENT_CT_TERM_PREFIX + u'%s.%s' % DOCUMENT_CT_TERM_PREFIX + u'%s.%s' %
(obj._meta.app_label, obj._meta.module_name) (obj._meta.app_label, obj._meta.module_name)
) )

  • database.replace_document(document_id, document) database.replace_document(document_id, document)
  • try: experimentar:
  • database.replace_document(document_id, document) database.replace_document(document_id, document)
  • except xapian.InvalidArgumentError, ex: exceto xapian.InvalidArgumentError, ex:
  • ``` ```
    sys.stderr.write('xapian.InvalidArgumentErrorn') sys.stderr.write('xapian.InvalidArgumentErrorn')

except UnicodeDecodeError: exceto UnicodeDecodeError:
sys.stderr.write('Chunk failed.n') sys.stderr.write('Falha no bloco.n')
``` ```


en

This is actually raised by Xapian itself. Na verdade, isso é gerado pelo próprio Xapian. I've left the exception to bubble up so it's possible for a developer to see the issue. Deixei a exceção para aparecer para que um desenvolvedor veja o problema. The solution is to ensure your terms are no longer than 245 characters, unfortunately. A solução é garantir que seus termos não tenham mais de 245 caracteres, infelizmente.

en

@notanumber @jorgecarleitao What do you think about this https://github.com/Alir3z4/xapian-haystack/commit/a249b46c48957f4d8a776ef41b0ce12490ad52dd ? @notanumber @jorgecarleitao O que você acha disso https://github.com/Alir3z4/xapian-haystack/commit/a249b46c48957f4d8a776ef41b0ce12490ad52dd ?

the text document is usually more than 245, I know it's raised from xapian itself but this shouldn't break the [re]building the index. o documento de texto é geralmente mais de 245, eu sei que é gerado a partir do próprio xapian, mas isso não deve quebrar a [re]construção do índice.

en
Esta página foi útil?
0 / 5 - 0 avaliações