[Xapian-discuss] faceted searches

Richard Boulton richard at lemurconsulting.com
Tue Aug 28 09:47:26 BST 2007


Alexander Lind wrote:
> Will the matchspy function be portable to the bindings, PHP in particular?

It should be - it certainly works in Python.  Because the matchspy 
classes are implemented in C++, they should work even in languages like 
PHP for which SWIG doesn't have director support (ie, support for 
subclasses defined in the scripting language).

> Would this traverse all values in each document it processes, or just 
> look at specific positions given to it?

You give it a set of value slots to look at, and it tots up the totals 
in each slot.  So, you'd store each facet (eg, colour) in a different 
slot, and then give the matchspy class the list of slots you're 
interested in.

> Will it also be possible to facet on indexed keywords (COLORblue eg.)?  

Currently, I've added a matchspy which does this.  However, Olly has 
expressed doubts about the wisdom of including it, I assume because it 
is likely to be very inefficient.  In fact he said "it feels like 
including a boot containing a loaded machine gun in the API".

On the other hand, I've found that it works fairly well in practice for 
a smallish (ie, 1 million document) database, and is very convenient, so 
he and I will have to look into whether it should be included in the 
release.

>  Or will it be better to assign each color a value and store it in its
> own position in the value list?

For efficiency in a big database, that is probably the right thing to 
do, anyway.

> Any idea of when we might see Xapian 1.0.3 in the wild? :)

Not really - Olly is away again this week I believe, and it may take a 
while to settle exactly what these new APIs should look like, so it 
could be a couple of months - hopefully sooner than that, though.

-- 
Richard



More information about the Xapian-discuss mailing list