On Mon, Mar 29, 2021 at 08:38:08PM +0800, dongyang liang
wrote:> In my project I used the xapian. But some of my key's length is
>
> 255 (sometimes maybe 1024). How to fix it by modifying the source code?
It's not really feasible to increase - you'd need to change all the
encodings which assumes the term length or the Btree key length fits in
a byte, and you'd find a lot of places make this assumption (and some
are probably implicit so it's likely to be hard to find them all.) It's
certainly not just a matter of changing a manifest constant somewhere
and recompiling.
I'd also be concerned about the performance of very long keys.
I'd strongly advise instead working out how to achieve what you want
within the existing key limit. For example, if it's a very long unique
identifier then you can run it through a crypto hash function.
Collisions are vanishingly unlikely with something like SHA-256 or
something of that ilk, and the resulting hash is well under the key
length limit.
Cheers,
Olly