Xapian-haystack: Problème de durée trop longue

Créé le 22 mai 2011  ·  3Commentaires  ·  Source: notanumber/xapian-haystack

When I run manage.py rebuild_index I get following error: Lorsque j'exécute manage.py rebuild_index , j'obtiens l'erreur suivante :

```Traceback (most recent call last): ```Traceback (appel le plus récent en dernier) :
File "./manage.py", line 11, in Fichier "./manage.py", ligne 11, dans
execute_manager(settings) execute_manager (paramètres)
File "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/django/core/management/ init .py", line 438, in execute_manager Fichier "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/django/core/management/ init .py", ligne 438, dans execute_manager
utility.execute() utilitaire.execute()
File "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/django/core/management/ init .py", line 379, in execute Fichier "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/django/core/management/ init .py", ligne 379, en exécution
self.fetch_command(subcommand).run_from_argv(self.argv) self.fetch_command(sous-commande).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 Fichier "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/django/core/management/base.py", ligne 191, dans 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 Fichier "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/django/core/management/base.py", ligne 220, en exécution
output = self.handle(_args, *_options) sortie = 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 Fichier "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/haystack/management/commands/rebuild_index.py", ligne 14, dans 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 Fichier "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/django/core/management/ init .py", ligne 166, dans 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 Fichier "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/django/core/management/base.py", ligne 220, en exécution
output = self.handle(_args, *_options) sortie = 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 Fichier "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/haystack/management/commands/update_index.py", ligne 184, dans handle
return super(Command, self).handle(_apps, *_options) renvoie super(Command, self).handle(_apps, *_options)
File "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/django/core/management/base.py", line 286, in handle Fichier "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/django/core/management/base.py", ligne 286, en 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 Fichier "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/haystack/management/commands/update_index.py", ligne 218, dans 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 Fichier "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/haystack/management/commands/update_index.py", ligne 100, dans 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 Fichier "/home/lorien/web/dumpz/.env/lib/python2.6/site-packages/xapian_backend.py", ligne 257, en mise à jour
database.replace_document(document_id, document) base de données.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

Commentaire le plus utile

@notanumber @jorgecarleitao What do you think about this https://github.com/Alir3z4/xapian-haystack/commit/a249b46c48957f4d8a776ef41b0ce12490ad52dd ? @notanumber @jorgecarleitao Qu'en pensez-vous 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. le document texte est généralement supérieur à 245, je sais qu'il est issu de xapian lui-même, mais cela ne devrait pas interrompre la [re] construction de l'index.

en

Tous les 3 commentaires

I've created quick fix, it just ignores such error and I think documents with invalid terms are not added to index completely. J'ai créé une solution rapide, elle ignore simplement une telle erreur et je pense que les documents contenant des termes non valides ne sont pas complètement ajoutés à l'index.

``` 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 index 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 @@ classe 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) base de données.replace_document(document_id, document)
  • try: essayer:
  • database.replace_document(document_id, document) base de données.replace_document(document_id, document)
  • except xapian.InvalidArgumentError, ex: sauf xapian.InvalidArgumentError, ex :
  • ``` ```
    sys.stderr.write('xapian.InvalidArgumentErrorn') sys.stderr.write('xapian.InvalidArgumentErrorn')

except UnicodeDecodeError: sauf UnicodeDecodeError :
sys.stderr.write('Chunk failed.n') sys.stderr.write('Chunk failed.n')
``` ```


en

This is actually raised by Xapian itself. Ceci est en fait soulevé par Xapian lui-même. I've left the exception to bubble up so it's possible for a developer to see the issue. J'ai laissé l'exception apparaître pour qu'un développeur puisse voir le problème. The solution is to ensure your terms are no longer than 245 characters, unfortunately. La solution consiste à vous assurer que vos termes ne dépassent malheureusement pas 245 caractères.

en

@notanumber @jorgecarleitao What do you think about this https://github.com/Alir3z4/xapian-haystack/commit/a249b46c48957f4d8a776ef41b0ce12490ad52dd ? @notanumber @jorgecarleitao Qu'en pensez-vous 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. le document texte est généralement supérieur à 245, je sais qu'il est issu de xapian lui-même, mais cela ne devrait pas interrompre la [re] construction de l'index.

en
Cette page vous a été utile?
0 / 5 - 0 notes

Questions connexes

DarwinSurvivor picture DarwinSurvivor  ·  3Commentaires

RaymiiOrg picture RaymiiOrg  ·  3Commentaires

nvie picture nvie  ·  3Commentaires

hansent picture hansent  ·  3Commentaires

gw0 picture gw0  ·  3Commentaires