NAME

Apache::Solr::Result - Apache Solr (Lucene) result container

SYNOPSIS

my $result = $solr->select(...);
my $result = $solr->queryTerm(...);
$result or die $result->error;  # $result is object but false

METHODS

Constructors

Apache::Solr::Result->new(OPTIONS)
-Option  --Default
 endpoint  <required>
 params    <required>
 request   undef
 response  undef
endpoint => URI
params => ARRAY
request => HTTP::Request object
response => HTTP::Response object

Accessors

$obj->decoded([HASH])
$obj->elapse()

Number of seconds used to receive a decoded answer.

$obj->endpoint()

The URI where the request is sent to.

$obj->params()

List of (expanded) parameters used to call the solr server.

$obj->request([REQUEST])
$obj->response([RESPONSE])
$obj->solrError()
$obj->solrQTime()

Elapse (as reported by the server) to handle the request. In seconds!

$obj->solrStatus()
$obj->start()

The timestamp of the moment the call has started, including the creation of the message to be sent.

$obj->success()

Returns true if the command has successfully completed.

example:

my $result = $sorl->commit;
$result->success or die;
$result or die;          # same, via overloading
$solr->commit or die;    # same, also overloading

Response information

$obj->highlighted(DOCUMENT)

Return information which relates to the selected DOCUMENT.

$obj->nrSelected()

Returns the number of selected documents, as result of a Apache::Solr::select() call. Probably many of those documents are not loaded (yet).

$obj->selected(RANK [,CLIENT])

Returns information about the query by Apache::Solr::select() on position RANK. Returned is a HASH, which can have fields 'doc' and 'hl' (maybe more later)

The first request will take a certain number of "rows". If you pass the CLIENT, this routine will automatically collect more of the selected answers.

example:

my $r = $solr->select(rows => 10, ...);
$r or die;

if(my $last = $r->selected(9)) {...}

my $elf = $r->selected(11);         # error
my $elf = $r->selected(11, $solr);  # auto-collects more
$obj->terms(FIELD [, TERMS])

Returns the results of a 'terms' query (see Apache::Solr::queryTerms()), which is a HASH.

When TERMS are specified, a new table is set.

In Solr XML (at least upto v4.0) the results are presented as lst, not arr So: their sort order is lost.

Helpers

$obj->replaceParams(HASH, OLDPARAMS)
$obj->selectedPage(PAGENR)
$obj->selectedPageLoad(RANK, CLIENT)
$obj->selectedPageNr(RANK)
$obj->selectedPageSize()
$obj->selectedPages()
$obj->showTimings([FILEHANDLE])

Print timing informat to the FILEHANDLE, by default the selected file-handle (probably STDOUT).

OVERLOADING

overload: stringification()

SEE ALSO

This module is part of Apache-Solr distribution version 0.91, built on December 04, 2012. Website: http://perl.overmeer.net

LICENSE

Copyrights 2012 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://www.perl.com/perl/misc/Artistic.html