GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Apache::Solr::Result(3) User Contributed Perl Documentation Apache::Solr::Result(3)

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

  # All operations return a ::Result object
  my $result = $solr->select(...);
  $result->success or die $result->solrError; # error reported by Solr
  $result->success or die $result->errors;    # any error caught by this object
  if($result)  # same as if($result->success)
  # Lots of trace information included
  $result->showTimings;
  # ::Document containing the requested fields from a select() search
  my $doc1   = $result->selected(0);
  # ::Document containing the highlight info from a selected document
  my $hl1    = $result->highlighted($doc1);
  # Some operations have helper methods
  my $result = $solr->queryTerm(...);
  print Dumper $result->terms;

 -Option    --Default
  core        undef
  endpoint    <required>
  params      []
  request     undef
  response    undef
  sequential  false
    
The parameters used for the query. [1.11] not required anymore.
[1.06] By setting this, you indicate that you will process the documents in (numeric) sequential order; that you have no intention to go back to a lower number. This implies that those cached results can be cleaned-up in the client early, reducing memory consumption.

However: you are allowed to go back to lower numbers, with the penalty of a repeat of a message exchange between this client and the database.

$obj->core()
[0.95] May return the Apache::Solr object which created this result.
$obj->decoded( [HASH] )
Set/get the decoded content of the Solr server response. In some cases, even error responses contain a valid Solr server data.
$obj->elapse()
Number of seconds used to receive a decoded answer.
$obj->endpoint()
The URI where the request is sent to.
$obj->errors()
All errors collected by this object into one string.
$obj->httpError()
$obj->params()
List of (expanded) parameters used to call the solr server.
$obj->request( [$request] )
Set/get the HTTP::Request object used in this query.
$obj->response( [$response] )
Set/get the HTTP::Response object received from this query action.
$obj->sequential()
[1.06] Shows whether the results are only read in numeric order.
$obj->serverError()
$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
    

in response to a select()

$obj->highlighted($document)
Return information which relates to the selected $document.
$obj->nextSelected(%options)
[0.95] Produces the next document, or "undef" when there are none left. [1.06] Use selected() or search parameter "start" to give a starting point. [1.06] The %options are passed to selected().

example:

  my $result = $solr->select(q => ...);
  while(my $doc = $result->nextSelected)
  {   my $hl = $result->highlighted($doc);
  }
    
$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).

example:

  print $result->nrSelected, " results\n";
  for(my $docnr = 0; $docnr < $result->nrSelected; $docnr++)
  {   my $doc = $result->selected($docnr);
      ...
  }
  # easier:
  while(my $doc = $result->nextSelected) ...
    
$obj->selected($rank, %options)
Returns information about the query by Apache::Solr::select() on position $rank (count starts at 0!) Returned is an Apache::Solr::Document object.

The first request will take a certain number of "rows". This routine will automatically collect more of the selected answers, when you address results outside the first "page" of "rows". The results of these other requests are cached as well.

This method has no %options at the moment.

example:

   my $r = $solr->select(rows => 10, ...);
   $r or die $r->errors;
   if(my $last = $r->selected(9)) {...}
   my $doc = $r->selected(11);     # auto-request more
    

in response to a queryTerms()

$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.

$obj->fullPageSize()
[1.07] Returns the page size of all of the full returned pages. The last page is probably smaller.
$obj->replaceParams(HASH, $oldparams)
$obj->selectedPage($pagenr)
The selected() documents are retreived in pages, each of size fullPageSize() (although the last page may be shorter). Each page is separately downloaded when used. Each page is also a full "Apache::Solr::Result" object with request, response, and timing information.
$obj->selectedPageLoad($rank, $client)
Query the database for the next page of results.
$obj->selectedPageNr($rank)
$obj->selectedPageSize()
[1.07] DEPRECATED. Use fullPageSize().
$obj->selectedPages()
$obj->showTimings( [$fh] )
Print timing informat to the $fh, by default the selected file-handle (probably STDOUT).

This module is part of Apache-Solr distribution version 1.11, built on May 08, 2025. Website: http://perl.overmeer.net/CPAN/

Copyrights 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/

2025-05-08 perl v5.40.2

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.