[Xapian-discuss] What is the best way to represent a category hierarchy using term prefixes in Xapian?

Olly Betts olly at survex.com
Mon Nov 7 00:07:12 GMT 2011


On Sun, Nov 06, 2011 at 07:48:27PM +0000, Jim Razmus II wrote:
> XFIRSTLEVELus
> XSECONDLEVELus_michigan
> XTHIRDLEVELus_michigan_grandrapids
[...]
> However, two aspects of this approach bother me. First, the creation and 
> maintenance of term prefixes for each level of the hierarchy feels wrong. 

There's not actually any need to use different prefixes here, since the
different levels can't collide as the number of '_' will be different.
So you could just use the same prefix for any level, e.g.:

XLOCus
XLOCus_michigan
XLOCus_michigan_grandrapids

> Second, the concatenation of values seems like a surrogate for using weights.

I don't really understand what you mean here...

> So, what is the best way to represent a hierarchy with term prefixes?

Probably with a single prefix, as above, but it perhaps depends what
you're wanting to do with the categories.  For example, if you want to
calculate facets based on locations, you really want the location in a
value slot.

Cheers,
    Olly



More information about the Xapian-discuss mailing list