[Xapian-discuss] [Scriptindex] Exception: Key too long

Timan Rebel trebel at ledz.net
Wed Jul 7 12:26:39 BST 2004


> > url   : field=url boolean=Q unique=Q
> > title : field=title weight=3 index index=XT
> > start : field=start weight=2 index index=XS truncate=200
> > body  : field=text index
> > users : boolean=XU
> > forum : boolean=XF
> 
> Perhaps you'd put that field=start after the truncate=200, otherwise you
> won't get a truncated value (afaik) in that field.
> Btw, have a look at the unhtml-command aswell, you may otherwise be
> inserting html, which is normally not really interesting tekst.

I will look into this.
The HTML code which can be present in the text is already replaced by the
special chars, so unhtml will not be usefull... 

> > 'Users' are userids which have placed a posting in a topic.
> > It is a space-separated string with unique userids.
> > The problem is that I get this error:  Exception: Key too long: length
> was
> > 5301 bytes, maximum length of a key is 252 bytes
> 
> Are you sure there are spaces in between?
> Anyway, the exception is about a single (unsplittable) term that is much
> longer than 252 characters.

I am sure it are all spaces BUT I formatted it like this:

users=1 2 3 4 5 6 7 8 9 ... n

The exception disappears when turning it into:

users=1
users=2
..
users=n

Is this the correct way of setting Boolean values?

> The easiest way to find out which term is too long, is probably to
> adjust the sourcecode of Xapian and have it spit out this too long key
> (or perhaps it does that if you set it in debug mode?? See the HACKING
> in xapian/doc)
> 
> > I already found out that this is because the btree index is getting too
> > large, but how can I work around this...
> 
> No, it's not about that. It's about a single term that is too long, and
> since a term of 5301 characters isn't very common, the key-length of 252
> bytes wasn't raised above that limit (afaik it has something to do with
> the 255 "magic number") ;)
 
> > I would like to search for userids, but a normal field=users index=XU
> does
> > not seem to work for me. After mapping user to XU in my Omega template,
> > searching for user:1 does not return results.
> 
> Did you put your setmap entirely at the front of the template?
> We do it like so:
> 
> [here is the documentstart]
> $set{stemmer,dutch}$setmap{prefix,title,XC,start,XA,topicstart,XA}
> hits="$msize"
> [and here is more omega-script code]
> 
> The setmap-prefix should be before any call to a few (it is documented
> in the omegascript.txt in the /doc-dir of omega) other commands.

I did.. title: works, just like start:
Anyway, it is not important when I get the Boolean method working.

I seem to be running into you everytime I have a problem with Xapian/Omega
ACM.
Thanx for that :)
I feel like a real noob at the moment :/

Best Regards

Timan Rebel (Trebel)




More information about the Xapian-discuss mailing list