[KinoSearch] Aggregates/Grouping possible?

Peter Karman peter at peknet.com
Fri Feb 19 07:34:07 PST 2010


Tina Müller wrote on 02/19/2010 08:16 AM:

> So I get back really many rows, so I was wondering if KinoSearch allows
> something like:
> select sum(number_field) ... where ... group by bar
> 
> I searched for "aggregates" but didn't find anything.
> 
> Does the KinoSearch index structure allow such grouping and summing up?
> 
> I also searched for this feature in Xapian and only found an entry that
> grouping (or "collapsing") is possible, but only a count for the rows,
> not a summing up of a field.
> 
> Do you have any hints if this is possible in KinoSearch or maybe in
> Xapian?
> 

Sounds like you're trying to provide what is typically called "faceted
search" where search results are accompanied by statistical (count)
information about certain fields (facets).

Xapian does have this feature, via what is called the MatchSpy. KS does
not (yet) have a feature like this, AFAIK. I have implemented it using
KS though, in the same way I do for Swish-e, by iterating over all the
results for a query (or where result sets are huge and accuracy not as
important, up to a pre-defined max to extract a suitable sample size)
and then caching the facet counts. So the first time a query is run, the
performance hit is paid, but after that, my code checks the cache for
the query and uses those numbers instead. Set the cache ttl based on
your business needs.

Search::OpenSearch (on CPAN) will be including this facet+cache feature
as soon as I have time to write it.

-- 
Peter Karman  .  http://peknet.com/  .  peter at peknet.com



More information about the kinosearch mailing list