[Xapian-discuss] indexing and sorting by value in python
Matteo Zandi
matteo.zandi at gmail.com
Sat Aug 16 09:35:00 BST 2008
On Sat, Aug 16, 2008 at 4:51 AM, mark <markkicks at gmail.com> wrote:
> doc.add_value(0, Xapian::sortable_serialise(price));
I have documents in different languages, what I do is:
doc.add_value(0, lang)
where lang is either 'it' or 'en'.
> when I am searching, how do i specify these sorting properties?
>
then I AND two queries
query1 = query = xapian.Query(query_string)
query2 = xapian.Query(xapian.Query.OP_VALUE_RANGE, 0, lang, lang)
query = xapian.Query(xapian.Query.OP_AND, query1, query2)
where query1 is the query entered by the user and query2 is a query which
returns only documents which belong to the 'lang' language.
The only inconvenience I find in this approach is that you have to remember
that 0 is the language, 1 is something else, etc..
Matteo
More information about the Xapian-discuss
mailing list