Op 25 jan 2024, om 14:16 heeft Marco van Tol <mvantol@ripe.net> het volgende geschreven:
Op 24 jan 2024, om 13:46 heeft Marco van Tol <mvantol@ripe.net> het volgende geschreven:
Op 24 jan 2024, om 12:24 heeft Marco van Tol <mvantol@ripe.net> het volgende geschreven:
Op 23 jan 2024, om 19:09 heeft Mark Sapiro <mark@msapiro.net <mailto:mark@msapiro.net>> het volgende geschreven:
On 1/23/24 05:49, Marco van Tol wrote:
Small unfortunate twist, this leads to:
[ERROR/MainProcess] Failed indexing 204001 - 205000 (retry 5/5): Term too long (> 245): ...
I have seen comments on that from back in 2020, but what’s the latest advise on how to deal with this?
This issue is discussed at <https://github.com/notanumber/xapian-haystack/pull/181>. There are two patches for this issue. They are somewhat different approaches, but either one is OK. One patch is the one in the above PR <https://github.com/notanumber/xapian-haystack/pull/181/files>. The other is at <https://github.com/alexsilva/xapian-haystack/commit/a53523d2d0d13929a0729d487e7af79b57ee17a6>.
I use the one from the PR, but it requires a substitution
s/force_text/str/
.Hi, thanks! Just to double check, do you mean
str
orforce_str
in the substitution?I found a comment on this topic regarding django-4 where they advice to use force_str. https://stackoverflow.com/questions/70382084/import-error-force-text-from-dj...
Hm, never mind, sorry. I now see the current file already has str() rather than force_text() in it.
Okay, so, I got a bit further, but something still gets stuck.
Here’s what I did. Keep in mind I’m using containers that are built from some CI/CD pipeline, so I updated the pipeline to apply the patch attached to this email to
/usr/lib/python3.11/site-packages/xapian_backend.py
.Before I had 2 list servers with the “Term too long” issue, 1 got resolved by this, and the other did not. I opened a shell in the newly deployed container to confirm the patch was applied in it.
The other attachment to this email is a copy/paste from the full error from
./manage.py rebuild_index
.Is there something else special in the email that makes it choke that evades the xapian patch?
Thank you very much in advance!
I tried to change to ‘hash’, but the code in that bit of the function has not been tested enough.
For example hole = sha224(hole.encode('utf8')).hexdigest()
comes back with that the bytes object hole does not have an encode() method.
When I change it to hole = sha224(hole).hexdigest()
, the following error is:
text = text[:match.start()] + hole + text[match.end():] TypeError: can't concat str to bytes
The ‘hash’ part of that function needs some debugging.
Marco