Dezi::Doc - a Dezi client document
# add doc to the index use Dezi::Doc; my $html = "<html>hello world</html>"; my $doc = Dezi::Doc->new( mime_type => 'text/html', uri => 'foo/bar.html', mtime => time(), size => length $html, content => $html, ); $client->index( $doc ); # construct a document with field/value pairs my $doc2 = Dezi::Doc->new( uri => 'auto/xml/magic', ); $doc2->set_field('title' => 'ima dezi doc'); $doc2->set_field('body' => 'hello world!'); $client->index( $doc2 ); # search results are also Dezi::Doc objects for my $doc (@{ $response->results }) { printf("hit: %s %s\n", $doc->score, $doc->uri); }
Dezi::Doc represents one document in a collection.
Create new object. Takes pairs of key/values where the keys are one of:
Sometimes known as the content type. A MIME type indicates the kind of document this is.
The unique URI for the document.
Last modified time. Should be expressed in Epoch seconds.
Length in bytes.
The document's content.
When returned from a Dezi::Response->results array, the score attribute is the search ranking score.
When returned from a Dezi::Response->results array, the title is the document's parsed title.
NOTE you cannot set the title of a doc object when sending to the index. See set_field() instead.
When returned from a Dezi::Response->results array, the summary is the snipped and highlighted extract from the document showing query terms in context.
NOTE you cannot set the summary of a doc object when sending to the index. The summary is a result field only. It typically represents all or snipped part of the swishdescription field in the index.
swishdescription
Returns a scalar ref pointing at the Dezi::Doc serialized, either the value of content() or a XML fragment representing values set with set_field().
Returns the value of field_name.
Set the value for field field.
This method also sets the mime_type() of the document object to 'application/xml' since that is how as_string_ref() will render the object.
Peter Karman, <karman at cpan.org>
<karman at cpan.org>
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.
bug-dezi-client at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Dezi::Client
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Dezi-Client
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Dezi-Client
CPAN Ratings
http://cpanratings.perl.org/d/Dezi-Client
Search CPAN
http://search.cpan.org/dist/Dezi-Client/
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.
To install Dezi::Client, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dezi::Client
CPAN shell
perl -MCPAN -e shell install Dezi::Client
For more information on module installation, please visit the detailed CPAN module installation guide.