|
NAMEApache::Solr::Document - Apache Solr (Lucene) Document container 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'
DESCRIPTIONThis object wraps-up an document: a set of fields. Either, this is a document which has to be added to the Solr database using Apache::Solr::addDocument(), or the subset of a document as returned by Apache::Solr::select(). METHODSConstructors
Accessors
HelpersSEE ALSOThis module is part of Apache-Solr distribution version 1.11, built on May 08, 2025. Website: http://perl.overmeer.net/CPAN/ LICENSECopyrights 2012-2025 by [Mark Overmeer]. For other contributors see ChangeLog. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://dev.perl.org/licenses/
|