[Xapian-discuss] I need a function set_sort_by_relevance_then_value()

Sungsoo Kim kiss at imageclick.com
Tue Feb 28 19:04:14 GMT 2006


I am a newbie with Xapian. I have been studying Xapian for about a week.
I am building a commercial database which consists of over 1M of images.

Each image has its own keywords shown as follows:

1. keywords: China oriental Asia young lady{2} woman{2} people shopping{2} bag{2} pack buy purchase walking street sunshine hold bags satisfied
    provider: A
2. keywords: Bottles{2} wine{2} French Emilion travel shop{2} shopping
    provider: A
3. keywords: canada tourism tourist travel souvenir shop gift japaneses japan ethnic asian oriental woman female shopping{2} sandals{2}
    provider: E
4. keywords: senior seniors couple observer shopping{2} two woman man smile smiling city outdoors outside bottle bottles grandmother grandfather shopping graying reflection arm blond fair
    provider: D
.
.
and so on.
.
.

In the above the numbers in the braces mean term count even if it appears only once.
Actually what I want is that If I search "shopping" the search result should be "1 4 3 2" ordered by relevance, then by provider. Because 1, 4, 3 have "shopping{2}", but provider A precedes provider D and E. And 2 should be the last because it has "shopping" without term count.

I understand Xapian supports sort_by_relevance() then docid (ascending or descending), or sort_by_value_then_relevance(). But I cannot find sort_by_relevance_then_value() function in the document. In order to get the search result shown above, the function seems to be necessary to me.  Provider A, B, C, D, E is not the name of provider, but the grade of providers, and it is changed from time to time.

Without set_sort_by_relevance_then_value() how can I get the same result?


Thanks in advance!


Sungsoo Kim


More information about the Xapian-discuss mailing list