[Xapian-discuss] Searching for document-groups
Christoph Hack
c.hack at gmx.at
Wed Nov 8 09:28:32 GMT 2006
On Tue, 2006-11-07 at 19:58 +0000, Olly Betts wrote:
> On Tue, Nov 07, 2006 at 07:59:58PM +0100, Christoph Hack wrote:
> > And now I am wondering how i can reduce the search results to
> > entire threads and display posts with the same root-post just once.
>
> If you add a value to each document (using Xapian::Document::add_value())
> containing some sort of unique id for the root-post of the thread that
> the current article is in, you can collapse matches with the same
> root-post leaving just the highest ranking one. You do this using
> Xapian::Enquire::set_collapse_key() with the value number that holds the
> root post unique id.
>
> So pick a non-negative value for the rootid. If you aren't using values
> yet, it might as well be 0:
>
> #define VALUE_ROOTID 0
>
> At index time:
>
> doc.add_value(VALUE_ROOTID, rootid);
>
> At search time:
>
> enquire.set_collapse_key(VALUE_ROOTID);
>
> Cheers,
> Olly
Hi Olly,
thanks for your detailed answer. I will keep you informed when the
project goes ahead.
Regards,
Christoph
More information about the Xapian-discuss
mailing list