NAME

Dezi::Response - Dezi search server response

SYNOPSIS

 use Dezi::Client;
 my $client = Dezi::Client->new('http://localhost:5000');
 
 my $response = $client->search( q => 'foo' );
 # $response isa Dezi::Response
 
 # iterate over results
 for my $result (@{ $response->results }) {
     printf("--\n uri: %s\n title: %s\n score: %s\n",
        $result->uri, $result->title, $result->score);
 }
 
 # print stats
 printf("       hits: %d\n", $response->total);
 printf("search time: %s\n", $response->search_time);
 printf(" build time: %s\n", $response->build_time);
 printf("      query: %s\n", $response->query);

DESCRIPTION

Dezi::Response represents a Dezi server response.

This class is used internally by Dezi::Client.

METHODS

new( http_response )

Returns a new response. http_response should be a HTTP::Response object from a Dezi JSON response.

BUILDARGS

Allows for single argument http_response instead of named pair.

BUILD

Initializes objects.

results

Returns array ref of Dezi::Doc objects.

total

Returns integer of hit count.

search_time

Returns string of floating point time Dezi server took to search.

build_time

Returns string of floating point time Dezi server took to build response.

query

Returns the query string.

fields

Returns array ref of field names.

facets

Returns array ref of facet objects.

Facet objects are currently hashrefs. This may change in future.

suggestions

Returns array ref of query suggestions.

http_response

Returns raw HTTP:Response object.

AUTHOR

Peter Karman, <karman at cpan.org>

BUGS

Please report any bugs or feature requests to bug-dezi-client at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Dezi-Client. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Dezi::Client

You can also look for information at:

COPYRIGHT & LICENSE

Copyright 2011 Peter Karman.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.