[Xapian-discuss] Long query times

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


James,

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?

Ralf

you did ask :)

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

        $qp or  $qp = new Search::Xapian::QueryParser($db);
        $qp->set_default_op(OP_AND);
                                                                        
        $qp or  $qp = new Search::Xapian::QueryParser($db);
        $qp->set_default_op(OP_AND);

        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
        $enq->set_sorting(2,1);

        #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++;
                        $i == $ms_size and last;
                        ++$beginIt;
                }
        } else {
                $results =  "Nothing found for " .
$enq->get_query()->get_description() . "\
n";
        }
        return $results;




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





More information about the Xapian-discuss mailing list