Apache-Solr
view release on metacpan or search on metacpan
lib/Apache/Solr/Document.pod view on Meta::CPAN
=encoding utf8
=head1 NAME
Apache::Solr::Document - Apache Solr (Lucene) Document container
=head1 SYNOPSIS
# create and upload a new document
my $doc = Apache::Solr::Document->new(...);
$doc->addField(id => 'tic');
$doc->addFields( {name => 'tac', foot => 'toe'}, boost => 2);
$solr->addDocument($doc, commit => 1, overwrite => 1)
# take results
my $results = $solr->select
( q => 'text:gold' # search text-fields for 'gold'
, hl => { field => 'content' } # highlight 'gold' in content'
);
my $doc = $results->selected(3); # fourth answer
print $doc->rank; # 3
print $doc->uniqueId; # usually the 'id' field
@names = $doc->fieldNames;
print $doc->field('subject')->{content};
print $doc->content('subject'); # same
print $doc->_subject; # same, via autoload (mind the '_'!)
my $hl = $results->highlighted($doc); # another ::Doc object
print $hl->_content; # highlighted field named 'content'
=head1 DESCRIPTION
This object wraps-up an document: a set of fields. Either, this
is a document which has to be added to the Solr database using
L<Apache::Solr::addDocument()|Apache::Solr/"Updates">, or the subset of a document as returned
by L<Apache::Solr::select()|Apache::Solr/"Search">.
=head1 METHODS
=head2 Constructors
=over 4
=item Apache::Solr::Document-E<gt>B<fromResult>(HASH, $rank)
Create a document object from data received as result of a select
search.
=item Apache::Solr::Document-E<gt>B<new>(%options)
-Option--Default
boost 1.0
fields {}
=over 2
=item boost => FLOAT
( run in 0.586 second using v1.01-cache-2.11-cpan-39bf76dae61 )