---
name: "WebService::Solr::Document"
section: "3pm"
platform: "linux"
package: "libwebservice-solr-perl"
version: "0.44-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/WebService::Solr::Document"
---

# WebService::Solr::Document(3pm)

A document object

## NAME

WebService::Solr::Document - A document object

## SYNOPSIS

```
    my $doc = WebService::Solr::Document->new;
    $doc->add_fields( @fields );
    $doc->boost( 2.0 );
    my $id = $doc->value_for( 'id' );
    my @subjects = $doc->values_for( 'subject' );
```

## DESCRIPTION

This class represents a basic document object, which is basically a collection of fields.

## ACCESSORS

- •

  fields - an array of fields

- •

  boost - a floating-point "boost" value

## METHODS

### new( @fields\|\\@fields )

Constructs a new document object given `@fields`. A field can be a WebService::Solr::Field object, or a structure accepted by `"WebService::Solr::Field->new"`.

### BUILDARGS( @args )

A Moose override to allow our custom constructor.

### add\_fields( @fields\|\\@fields )

Adds `@fields` to the document.

### field\_names

Returns a list of field names that are in this document.

### value\_for( $name )

Returns the first value for `$name`.

### values\_for( $name )

Returns all values for `$name`.

### to\_element( )

Serializes the object to an XML::Easy::Element object.

### to\_xml( )

Serializes the object to xml.

## AUTHORS

Andy Lester `"andy@petdance.com"`

Brian Cassidy \<bricas@cpan.org\>

Kirk Beers

## COPYRIGHT AND LICENSE

Copyright 2008-2014 National Adult Literacy Database Copyright 2015-2020 Andy Lester

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
