Kevin Duraj
2007-Mar-05 05:29 UTC
[Xapian-discuss] Key too long: length was 258 bytes, maximum length of a key is BTREE_MAX_KEY_LEN bytes
Xapians! I am getting the following error when indexing data with scriptindex ... E: Key too long: length was 258 bytes, maximum length of a key is BTREE_MAX_KEY_LEN bytes Exception: Key too long: length was 258 bytes, maximum length of a key is BTREE_MAX_KEY_LEN bytes What is the maximum of the characters we can have in: |____ Field : boolean=Q unique=Q weight=5 lower index field Thank you, - Kevin Duraj
Olly Betts
2007-Mar-05 15:46 UTC
[Xapian-discuss] Key too long: length was 258 bytes, maximum length of a key is BTREE_MAX_KEY_LEN bytes
On Sun, Mar 04, 2007 at 09:28:58PM -0800, Kevin Duraj wrote:> E: Key too long: length was 258 bytes, maximum length of a key is > BTREE_MAX_KEY_LEN bytes > Exception: Key too long: length was 258 bytes, maximum length of a key is > BTREE_MAX_KEY_LEN bytesA safe limit is 240 bytes for quartz and flint, unless your terms can contain zero bytes. There's a fuller dsecription here: http://article.gmane.org/gmane.comp.search.xapian.general/3656> What is the maximum of the characters we can have in: > |____ Field : boolean=Q unique=Q weight=5 lower index fieldThis will attempt to generate a term of indefinite length if the input data contains a long value. You can either hash the tail of the term (like omindex does with URLs) by using the "hash" action (and split the rule into two because you don't want the field hash-ed, and you don't want the boolean lower-ed): Field : hash=239 boolean=Q unique=Q Field : weight=5 lower index field Alternatively, you can use "truncate=239" instead of "hash=239" to just discard the end of the term. If the field contains whitespace, "truncate" will try not to truncate a "word" but for a url field that shouldn't be an issue. There should probably be a simpler version of "truncate" which doesn't try to be smart with words. Cheers, Olly