---
name: "Lucy::Search::Collector::BitCollector"
section: "3pm"
platform: "linux"
package: "liblucy-perl"
version: "0.3.3-7+b1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/Lucy::Search::Collector::BitCollector"
---

# Lucy::Search::Collector::BitCollector(3pm)

Collector which records doc nums in a BitVector.

## NAME

Lucy::Search::Collector::BitCollector - Collector which records doc nums in a BitVector.

## SYNOPSIS

```
    my $bit_vec = Lucy::Object::BitVector->new(
        capacity => $searcher->doc_max + 1,
    );
    my $bit_collector = Lucy::Search::Collector::BitCollector->new(
        bit_vector => $bit_vec,
    );
    $searcher->collect(
        collector => $bit_collector,
        query     => $query,
    );
```

## DESCRIPTION

BitCollector is a Collector which saves matching document ids in a BitVector.  It is useful for recording the entire set of documents which matches a query.

## CONSTRUCTORS

### new( *\[labeled params\]* )

```
    my $bit_collector = Lucy::Search::Collector::BitCollector->new(
        bit_vector => $bit_vec,    # required
    );
```

- •

  **bit\_vector** - A Lucy::Object::BitVector.

## METHODS

### collect(doc\_id)

Set bit in the object's BitVector for the supplied doc id.

## INHERITANCE

Lucy::Search::Collector::BitCollector isa Lucy::Search::Collector isa Lucy::Object::Obj.
