[Xapian-discuss] Long query times

tech at dbx.co.uk tech at dbx.co.uk
Thu Sep 29 16:43:56 BST 2005


it could be the nub of the problem, as I'm not sure I understand how xapian
works, but all I've got in the data is a number (the id of the CV in a
MySQl database). The indexing process I go through is basically -get text
from MySQL -> add each word as a term to a document-> add the id to the
document as data -> add the modification time as a value -> bin the text
(as the rest of the application (historically) uses the db). This means
that all Xapian gives me back is a number.

Just remembered, when I search I order the results by the modification time
that I store as a value -maybe it's the sort?


you did ask :)

        $db or $db = Search::Xapian::Database->new($database);

        $qp or  $qp = new Search::Xapian::QueryParser($db);
        $qp or  $qp = new Search::Xapian::QueryParser($db);

        print "Query String $term\n";
        my $enq = $db->enquire($qp->parse_query($term));
        printf "Parsing query '%s'\n", $enq->get_query()->get_description();

        #Sort by mod time

        #This gets the data & the metadata
        my $mset = $enq->get_mset(0, $limit);
        if($ms_size > 0) {
                my $i = 0;
                while ($beginIt) {
                        my $doc = $beginIt->get_document();
                        $results .= sprintf("%s\n" , $doc->get_data());
                        $i == $ms_size and last;
        } else {
                $results =  "Nothing found for " .
$enq->get_query()->get_description() . "\
        return $results;

mail2web - Check your email from the web at
http://mail2web.com/ .

More information about the Xapian-discuss mailing list