[Xapian-discuss] xapian query group result by domain?

Olly Betts olly at survex.com
Sat Jan 13 12:44:18 GMT 2007


On Sat, Jan 13, 2007 at 06:08:04PM +0800, Andrey Kong wrote:
> Is it possible to group the result by domain just like google's [ More 
> results from www.abc.com ],
> when there are more than 1 results from the same domain?

Put the domain name in a value and use
Xapian::Enquire::set_collapse_key() to collapse matches with the same
domain:

http://www.xapian.org/docs/apidoc/html/classXapian_1_1Enquire.html#b5ef9cc615f7dd8414175c7529ee4e0c

You can then use Xapian::MSetIterator::get_collapse_count() to decide
when to add the "More results from X" link:

http://www.xapian.org/docs/apidoc/html/classXapian_1_1MSetIterator.html#4d2d8fae854bc997dd417234061a3fe2

Cheers,
    Olly



More information about the Xapian-discuss mailing list