[Xapian-discuss] Where is the get_docid method for perl?

Olly Betts olly at survex.com
Sun Oct 7 00:12:49 BST 2007


On Sun, Sep 30, 2007 at 02:26:12PM -0400, Jim wrote:
> I tried the following:
>    my $mset = $enq->get_mset(0, 10);
>    print "Size ". $mset->size()."\n";
>    my %hits;
>    for(my $mit=$mset->begin(); $mit != $mset->end();$mit++) {
>        my %hit;
>        my $doc = $mit->get_document();
>        my $id = $doc->get_docid();

That should be:

         my $id = $mit->get_docid();

Is this code taken from an example or documentation?  If so, let me know where
and I'll fix it.

>        my $data=$doc->get_data();
> ...
>    }

> I see in the example on perldoc for Search/Xapian that there is a method 
> of the Enquire class named "matches" and it returns a pointer to an 
> unnamed class that includes the  get_docid, but there isn't any 
> documentation for it in the API.  Am I missing some documentation somewhere?

It's not unnamed - "perldoc Search::Xapian::Enquire" says:

       matches <start> <size>
           Takes the start element, and maximum number of elements, and
           returns an array tied to Search::Xapian::MSet::Tied.

Search::Xapian::MSet::Tied doesn't appear to be documented, and I don't
know much about it (Alex wrote it I think) but looking at the code, its FETCH
method just returns a Search::Xapian::MSetIterator object for that offset in
the results.

> I searched the wiki for "perl" and got no hits.  I searched the xapian 
> web site and it told me it couldn't find the default database.

There was an out-of-date path in xapian.org's omega.conf in CVS which I fixed
by hand after the 1.0.2 release without realising that file was version
controlled, so my fix was overwritten by the 1.0.3 upload.  Now fixed properly
- thanks for reporting this.

Cheers,
    Olly



More information about the Xapian-discuss mailing list