[Xapian-discuss] creating index for document values

mark markkicks at gmail.com
Sat Aug 16 17:36:25 BST 2008


i found this in the docs page of sorting, and it says "arrange for
documents to be indexed in date order"? now how do i do this?
thanks again!

"http://xapian.org/docs/sorting.html
If you want to offer a "sort by date" feature, and can arrange for
documents to be indexed in date order (or a close-enough
approximation), "


On Sat, Aug 16, 2008 at 9:08 AM, mark <markkicks at gmail.com> wrote:
> i want to query a database and sort the results by a value ( which i
> created like this doc.add_value(1, some_value)).
> the default search is really fast, but now if i try to sort the
> results by this value, it takes over 5 seconds on database with around
> 2 million documents.
> is there anyway i can speed up this? do i need to create an index on
> the database on this value to make it fast?
> thanks a lot!
>
>
>
>
>
> python code that i used to search and sort by value 1
> import xapian
> query_string = 'searching for this'
> database = xapian.Database('test')
> enquire = xapian.Enquire(database)
> qp = xapian.QueryParser()
> stemmer = xapian.Stem("english")
> qp.set_stemmer(stemmer)
> qp.set_database(database)
> qp.set_stemming_strategy(xapian.QueryParser.STEM_SOME)
> query = qp.parse_query(query_string)
> enquire.set_sort_by_value(1)
> matches=enquire.get_mset(0,20)
>



More information about the Xapian-discuss mailing list