[Xapian-discuss] Sticky results

QE :: Felix Ostmann ostmann at qe.de
Wed Feb 20 10:22:49 GMT 2013


You simple need another value with sticky true-false i think:

Xapian::MultiValueKeyMaker
sorter;sorter.add_value(3);sorter.add_value(1,
true);enquire.set_sort_by_key(&sorter, true);Xapian::MSet mset =
enquire.get_mset(0, 10);



Mit freundlichem Gruß
Felix Ostmann

-----------------------------------------------------------
QE GmbH & Co. KG, Martinistraße 3, D-49080 Osnabrück
-----------------------------------------------------------
Tel.: +49 (0) 541 / 40666 0, Fax: +49 (0) 541 / 40666 22
Email: info at qe.de, Web: www.qe.de
-----------------------------------------------------------
AG Osnabrück - HRA 200252, Ust-IdNr.: DE814737310
-----------------------------------------------------------
Komplementärin: QE24 GmbH, AG Osnabrück - HRB 200359,
Geschäftsführer: Ansas Meyer, Firmensitz: Osnabrück
-----------------------------------------------------------

Die in dieser Email enthaltenen Informationen sind vertrau-
lich zu behandeln und ausschließlich für den Adressaten be-
stimmt. Jegliche Veröffentlichung, Verteilung oder sonstige
in diesem Zusammenhang stehende Handlung wird ausdrücklich
untersagt.


2013/2/20 Andrew Betts <andrew at trib.tv>

> Hi there,
>
> I have a xapian index whose results are being sorted by a value, with (PHP
> bindings):
>
> $enquire->set_sort_by_value($sort_data_value);
>
> This is because I want the results returned in chronological order of
> publication date.  However, I now have a need to have certain results be
> 'sticky' at the top of the resultset, regardless of their publication date.
>  Obviously there are hacks such as setting a publication date in the
> distant future, but I'm wondering if there is a best practice way to do
> this within the Xapian world.
>
> I considered that perhaps the answer was to remove the sort by value and
> replace it with a custom posting source that combined that value with the
> post's stickiness to give the post a weight.  Would that be the right
> approach?  If I do that how do I turn off all the default relevance weight
> logic?
>
> Cheers,
>
> Andrew
> _______________________________________________
> Xapian-discuss mailing list
> Xapian-discuss at lists.xapian.org
> http://lists.xapian.org/mailman/listinfo/xapian-discuss
>


More information about the Xapian-discuss mailing list