---
name: "Search::Xapian::ValueCountMatchSpy"
section: "3pm"
platform: "linux"
package: "libsearch-xapian-perl"
version: "1.2.25.5-3+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Search::Xapian::ValueCountMatchSpy"
---

# Search::Xapian::ValueCountMatchSpy(3pm)

Class for counting the frequencies of values in the matching documents.

## NAME

Search::Xapian::ValueCountMatchSpy - Class for counting the frequencies of values in the matching documents.

## SYNOPSIS

```
  use Search::Xapian qw(:all);
  my $db = Search::Xapian::Database->new( '[DATABASE DIR]' );
  my $enq = $db->enquire( '[QUERY TERM]' );
  my $spy = Search::Xapian::ValueCountMatchSpy->new(0);
  $enq->add_matchspy($spy);
  my $mset = $enq->get_mset(0, 10, 10000);
  print "Match spy registered " . $spy->get_total() . " documents\n";
  my $end = $spy->values_end();
  for (my $it = $spy->values_begin(); $it != $end; $it++) {
    print $it->get_termname() . " - " . $it->get_termfreq();
  }
```

## DESCRIPTION

Class for counting the frequencies of values in the matching documents. Wraps Xapian::ValueCountMatchSpy

## METHODS

- new

  Constructor. Either takes no parameters, or a single valueno parameter identifying the slot.

- get\_total

  Return the total number of documents tallied.

- values\_begin

  Get an iterator over the values seen in the slot.

- values\_end

  End iterator corresponding to **values\_begin()**.

- top\_values\_begin \<maxvalues\>

  Get an iterator over the most frequent values seen in the slot.

- top\_values\_end \<maxvalues\>

  End iterator corresponding to **top\_values\_begin()**.

## SEE ALSO

Search::Xapian, Search::Xapian::MatchSpy
