At least it isn't working the way it used to.
Code:
$db = Search::Xapian::Database->new( $dx );
my $qp = Search::Xapian::QueryParser->new();
my $dbSize=$db->get_doccount();
# $qp->set_stemmer(new Search::Xapian::Stem("english"));
# $qp->set_stemming_strategy(STEM_SOME);
# $qp->set_default_op($defaultop);
my $par = $qp->parse_query($query);
my $enq = $db->enquire( $par );
my @matches = $enq->matches($nstart,$nrecords);
my $mset = $enq->get_mset($nstart,$nrecords);
my $est = $mset->get_matches_estimated();
my $totTime=0;
foreach my $match ( @matches ) {
my $doc = $match->get_document();
my $id = $match->get_docid();
my $eterm = $enq->get_matching_terms_end($id);
my $bterm = $enq->get_matching_terms_begin($id);
my @terms;
for(my $xit=$bterm;$xit != $eterm;++$xit) {
my $foo ="$xit";
$foo =~s/^Z//;
$foo =~s/^A//;
push(@terms,$foo);
}
}
What's happening is a seg fault at the "push" because $foo is an
empty
hash. On the correctly working system, it's a string. The @matches
array has 5 empty hashes where as on the working system the hash shows a
number instead of the string "empty hash" as in the debugging output
from perl -d
main::(gs.cgi:39): foreach my $match ( @matches ) {
DB<2> x @matches
0 Search::Xapian::MSetIterator=HASH(0xe0ae90)
empty hash
1 Search::Xapian::MSetIterator=HASH(0xe0af08)
empty hash
2 Search::Xapian::MSetIterator=HASH(0xe0af80)
empty hash
3 Search::Xapian::MSetIterator=HASH(0xe0aff8)
empty hash
4 Search::Xapian::MSetIterator=HASH(0xe0b070)
empty hash
I noticed that there is a new MatchSpy class that seems to replace what
I was doing, but I have no idea how to implement it in perl. If that's
the fix a simple sample code would be nice.
Thanks,
Jim.