Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Silbe <sascha-pgp@silbe.org>2011-08-22 18:26:13 (GMT)
committer Sascha Silbe <sascha-pgp@silbe.org>2011-08-22 18:26:13 (GMT)
commit3da458ab108ae31c846fb2aeb3efe67e0d9ae925 (patch)
treea9d4c3cd82837ac35163633d52b7295f6ef757b8
parentf01eb1e28d04facfe02e895bb68dd71b1e53bf2b (diff)
Don't index terms longer than the hardcoded Xapian limit
Xapian has a hardcoded limit of 245 characters for terms.
-rw-r--r--gdatastore/index.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/gdatastore/index.py b/gdatastore/index.py
index 616eb81..5730f54 100644
--- a/gdatastore/index.py
+++ b/gdatastore/index.py
@@ -108,10 +108,12 @@ class TermGenerator(xapian.TermGenerator):
elif not isinstance(value, str):
value = str(value)
- # We need to add the full value (i.e. not split into words), too, so
- # we can enumerate unique values. It also simplifies setting up
- # dictionary-based queries.
- self._document.add_term(_PREFIX_FULL_VALUE + prefix + value)
+ # Hardcoded Xapian term length limit
+ if len(prefix + value) < 240:
+ # We need to add the full value (i.e. not split into words), too,
+ # so we can enumerate unique values. It also simplifies setting up
+ # dictionary-based queries.
+ self._document.add_term(_PREFIX_FULL_VALUE + prefix + value)
self.index_text(value, 1, prefix)
self.increase_termpos()