.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.20) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Search::Estraier 3pm" .TH Search::Estraier 3pm "2012-03-31" "perl v5.14.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Search::Estraier \- pure perl module to use Hyper Estraier search engine .SH "SYNOPSIS" .IX Header "SYNOPSIS" .SS "Simple indexer" .IX Subsection "Simple indexer" .Vb 1 \& use Search::Estraier; \& \& # create and configure node \& my $node = new Search::Estraier::Node( \& url => \*(Aqhttp://localhost:1978/node/test\*(Aq, \& user => \*(Aqadmin\*(Aq, \& passwd => \*(Aqadmin\*(Aq, \& create => 1, \& label => \*(AqLabel for node\*(Aq, \& croak_on_error => 1, \& ); \& \& # create document \& my $doc = new Search::Estraier::Document; \& \& # add attributes \& $doc\->add_attr(\*(Aq@uri\*(Aq, "http://estraier.gov/example.txt"); \& $doc\->add_attr(\*(Aq@title\*(Aq, "Over the Rainbow"); \& \& # add body text to document \& $doc\->add_text("Somewhere over the rainbow. Way up high."); \& $doc\->add_text("There\*(Aqs a land that I heard of once in a lullaby."); \& \& die "error: ", $node\->status,"\en" unless (eval { $node\->put_doc($doc) }); .Ve .SS "Simple searcher" .IX Subsection "Simple searcher" .Vb 1 \& use Search::Estraier; \& \& # create and configure node \& my $node = new Search::Estraier::Node( \& url => \*(Aqhttp://localhost:1978/node/test\*(Aq, \& user => \*(Aqadmin\*(Aq, \& passwd => \*(Aqadmin\*(Aq, \& croak_on_error => 1, \& ); \& \& # create condition \& my $cond = new Search::Estraier::Condition; \& \& # set search phrase \& $cond\->set_phrase("rainbow AND lullaby"); \& \& my $nres = $node\->search($cond, 0); \& \& if (defined($nres)) { \& print "Got ", $nres\->hits, " results\en"; \& \& # for each document in results \& for my $i ( 0 ... $nres\->doc_num \- 1 ) { \& # get result document \& my $rdoc = $nres\->get_doc($i); \& # display attribte \& print "URI: ", $rdoc\->attr(\*(Aq@uri\*(Aq),"\en"; \& print "Title: ", $rdoc\->attr(\*(Aq@title\*(Aq),"\en"; \& print $rdoc\->snippet,"\en"; \& } \& } else { \& die "error: ", $node\->status,"\en"; \& } .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module is implementation of node \s-1API\s0 of Hyper Estraier. Since it's perl-only module with dependencies only on standard perl modules, it will run on all platforms on which perl runs. It doesn't require compilation or Hyper Estraier development files on target machine. .PP It is implemented as multiple packages which closly resamble Ruby implementation. It also includes methods to manage nodes. .PP There are few examples in \f(CW\*(C`scripts\*(C'\fR directory of this distribution. .SH "Inheritable common methods" .IX Header "Inheritable common methods" This methods should really move somewhere else. .SS "_s" .IX Subsection "_s" Remove multiple whitespaces from string, as well as whitespaces at beginning or end .PP .Vb 2 \& my $text = $self\->_s(" this is a text "); \& $text = \*(Aqthis is a text\*(Aq; .Ve .SH "Search::Estraier::Document" .IX Header "Search::Estraier::Document" This class implements Document which is single item in Hyper Estraier. .PP It's is collection of: .IP "attributes" 4 .IX Item "attributes" \&\f(CW\*(Aqkey\*(Aq => \*(Aqvalue\*(Aq\fR pairs which can later be used for filtering of results .Sp You can add common filters to \f(CW\*(C`attrindex\*(C'\fR in estmaster's \f(CW\*(C`_conf\*(C'\fR file for better performance. See \f(CW\*(C`attrindex\*(C'\fR in Hyper Estraier P2P Guide . .IP "vectors" 4 .IX Item "vectors" also \f(CW\*(Aqkey\*(Aq => \*(Aqvalue\*(Aq\fR pairs .IP "display text" 4 .IX Item "display text" Text which will be used to create searchable corpus of your index and included in snippet output. .IP "hidden text" 4 .IX Item "hidden text" Text which will be searchable, but will not be included in snippet. .SS "new" .IX Subsection "new" Create new document, empty or from draft. .PP .Vb 2 \& my $doc = new Search::HyperEstraier::Document; \& my $doc2 = new Search::HyperEstraier::Document( $draft ); .Ve .SS "add_attr" .IX Subsection "add_attr" Add an attribute. .PP .Vb 1 \& $doc\->add_attr( name => \*(Aqvalue\*(Aq ); .Ve .PP Delete attribute using .PP .Vb 1 \& $doc\->add_attr( name => undef ); .Ve .SS "add_text" .IX Subsection "add_text" Add a sentence of text. .PP .Vb 1 \& $doc\->add_text(\*(Aqthis is example text to display\*(Aq); .Ve .SS "add_hidden_text" .IX Subsection "add_hidden_text" Add a hidden sentence. .PP .Vb 1 \& $doc\->add_hidden_text(\*(Aqthis is example text just for search\*(Aq); .Ve .SS "add_vectors" .IX Subsection "add_vectors" Add a vectors .PP .Vb 4 \& $doc\->add_vector( \& \*(Aqvector_name\*(Aq => 42, \& \*(Aqanother\*(Aq => 12345, \& ); .Ve .SS "set_score" .IX Subsection "set_score" Set the substitute score .PP .Vb 1 \& $doc\->set_score(12345); .Ve .SS "score" .IX Subsection "score" Get the substitute score .SS "id" .IX Subsection "id" Get the \s-1ID\s0 number of document. If the object has never been registred, \f(CW\*(C`\-1\*(C'\fR is returned. .PP .Vb 1 \& print $doc\->id; .Ve .SS "attr_names" .IX Subsection "attr_names" Returns array with attribute names from document object. .PP .Vb 1 \& my @attrs = $doc\->attr_names; .Ve .SS "attr" .IX Subsection "attr" Returns value of an attribute. .PP .Vb 1 \& my $value = $doc\->attr( \*(Aqattribute\*(Aq ); .Ve .SS "texts" .IX Subsection "texts" Returns array with text sentences. .PP .Vb 1 \& my @texts = $doc\->texts; .Ve .SS "cat_texts" .IX Subsection "cat_texts" Return whole text as single scalar. .PP .Vb 1 \& my $text = $doc\->cat_texts; .Ve .SS "dump_draft" .IX Subsection "dump_draft" Dump draft data from document object. .PP .Vb 1 \& print $doc\->dump_draft; .Ve .SS "delete" .IX Subsection "delete" Empty document object .PP .Vb 1 \& $doc\->delete; .Ve .PP This function is addition to original Ruby \s-1API\s0, and since it was included in C wrappers it's here as a convinience. Document objects which go out of scope will be destroyed automatically. .SH "Search::Estraier::Condition" .IX Header "Search::Estraier::Condition" .SS "new" .IX Subsection "new" .Vb 1 \& my $cond = new Search::HyperEstraier::Condition; .Ve .SS "set_phrase" .IX Subsection "set_phrase" .Vb 1 \& $cond\->set_phrase(\*(Aqsearch phrase\*(Aq); .Ve .SS "add_attr" .IX Subsection "add_attr" .Vb 1 \& $cond\->add_attr(\*(Aq@URI STRINC /~dpavlin/\*(Aq); .Ve .SS "set_order" .IX Subsection "set_order" .Vb 1 \& $cond\->set_order(\*(Aq@mdate NUMD\*(Aq); .Ve .SS "set_max" .IX Subsection "set_max" .Vb 1 \& $cond\->set_max(42); .Ve .SS "set_options" .IX Subsection "set_options" .Vb 1 \& $cond\->set_options( \*(AqSURE\*(Aq ); \& \& $cond\->set_options( qw/AGITO NOIDF SIMPLE/ ); .Ve .PP Possible options are: .IP "\s-1SURE\s0" 8 .IX Item "SURE" check every N\-gram .IP "\s-1USUAL\s0" 8 .IX Item "USUAL" check every second N\-gram .IP "\s-1FAST\s0" 8 .IX Item "FAST" check every third N\-gram .IP "\s-1AGITO\s0" 8 .IX Item "AGITO" check every fourth N\-gram .IP "\s-1NOIDF\s0" 8 .IX Item "NOIDF" don't perform TF-IDF tuning .IP "\s-1SIMPLE\s0" 8 .IX Item "SIMPLE" use simplified query phrase .PP Skipping N\-grams will speed up search, but reduce accuracy. Every call to \f(CW\*(C`set_options\*(C'\fR will reset previous options; .PP This option changed in version \f(CW0.04\fR of this module. It's backwards compatibile. .SS "phrase" .IX Subsection "phrase" Return search phrase. .PP .Vb 1 \& print $cond\->phrase; .Ve .SS "order" .IX Subsection "order" Return search result order. .PP .Vb 1 \& print $cond\->order; .Ve .SS "attrs" .IX Subsection "attrs" Return search result attrs. .PP .Vb 1 \& my @cond_attrs = $cond\->attrs; .Ve .SS "max" .IX Subsection "max" Return maximum number of results. .PP .Vb 1 \& print $cond\->max; .Ve .PP \&\f(CW\*(C`\-1\*(C'\fR is returned for unitialized value, \f(CW0\fR is unlimited. .SS "options" .IX Subsection "options" Return options for this condition. .PP .Vb 1 \& print $cond\->options; .Ve .PP Options are returned in numerical form. .SS "set_skip" .IX Subsection "set_skip" Set number of skipped documents from beginning of results .PP .Vb 1 \& $cond\->set_skip(42); .Ve .PP Similar to \f(CW\*(C`offset\*(C'\fR in \s-1RDBMS\s0. .SS "skip" .IX Subsection "skip" Return skip for this condition. .PP .Vb 1 \& print $cond\->skip; .Ve .SS "set_distinct" .IX Subsection "set_distinct" .Vb 1 \& $cond\->set_distinct(\*(Aq@author\*(Aq); .Ve .SS "distinct" .IX Subsection "distinct" Return distinct attribute .PP .Vb 1 \& print $cond\->distinct; .Ve .SS "set_mask" .IX Subsection "set_mask" Filter out some links when searching. .PP Argument array of link numbers, starting with 0 (current node). .PP .Vb 1 \& $cond\->set_mask(qw/0 1 4/); .Ve .SH "Search::Estraier::ResultDocument" .IX Header "Search::Estraier::ResultDocument" .SS "new" .IX Subsection "new" .Vb 9 \& my $rdoc = new Search::HyperEstraier::ResultDocument( \& uri => \*(Aqhttp://localhost/document/uri/42\*(Aq, \& attrs => { \& foo => 1, \& bar => 2, \& }, \& snippet => \*(Aqthis is a text of snippet\*(Aq \& keywords => \*(Aqthis\etare\etkeywords\*(Aq \& ); .Ve .SS "uri" .IX Subsection "uri" Return \s-1URI\s0 of result document .PP .Vb 1 \& print $rdoc\->uri; .Ve .SS "attr_names" .IX Subsection "attr_names" Returns array with attribute names from result document object. .PP .Vb 1 \& my @attrs = $rdoc\->attr_names; .Ve .SS "attr" .IX Subsection "attr" Returns value of an attribute. .PP .Vb 1 \& my $value = $rdoc\->attr( \*(Aqattribute\*(Aq ); .Ve .SS "snippet" .IX Subsection "snippet" Return snippet from result document .PP .Vb 1 \& print $rdoc\->snippet; .Ve .SS "keywords" .IX Subsection "keywords" Return keywords from result document .PP .Vb 1 \& print $rdoc\->keywords; .Ve .SH "Search::Estraier::NodeResult" .IX Header "Search::Estraier::NodeResult" .SS "new" .IX Subsection "new" .Vb 4 \& my $res = new Search::HyperEstraier::NodeResult( \& docs => @array_of_rdocs, \& hits => %hash_with_hints, \& ); .Ve .SS "doc_num" .IX Subsection "doc_num" Return number of documents .PP .Vb 1 \& print $res\->doc_num; .Ve .PP This will return real number of documents (limited by \f(CW\*(C`max\*(C'\fR). If you want to get total number of hits, see \f(CW\*(C`hits\*(C'\fR. .SS "get_doc" .IX Subsection "get_doc" Return single document .PP .Vb 1 \& my $doc = $res\->get_doc( 42 ); .Ve .PP Returns undef if document doesn't exist. .SS "hint" .IX Subsection "hint" Return specific hint from results. .PP .Vb 1 \& print $res\->hint( \*(AqVERSION\*(Aq ); .Ve .PP Possible hints are: \f(CW\*(C`VERSION\*(C'\fR, \f(CW\*(C`NODE\*(C'\fR, \f(CW\*(C`HIT\*(C'\fR, \f(CW\*(C`HINT#n\*(C'\fR, \f(CW\*(C`DOCNUM\*(C'\fR, \f(CW\*(C`WORDNUM\*(C'\fR, \&\f(CW\*(C`TIME\*(C'\fR, \f(CW\*(C`LINK#n\*(C'\fR, \f(CW\*(C`VIEW\*(C'\fR. .SS "hints" .IX Subsection "hints" More perlish version of \f(CW\*(C`hint\*(C'\fR. This one returns hash. .PP .Vb 1 \& my %hints = $res\->hints; .Ve .SS "hits" .IX Subsection "hits" Syntaxtic sugar for total number of hits for this query .PP .Vb 1 \& print $res\->hits; .Ve .PP It's same as .PP .Vb 1 \& print $res\->hint(\*(AqHIT\*(Aq); .Ve .PP but shorter. .SH "Search::Estraier::Node" .IX Header "Search::Estraier::Node" .SS "new" .IX Subsection "new" .Vb 1 \& my $node = new Search::HyperEstraier::Node; .Ve .PP or optionally with \f(CW\*(C`url\*(C'\fR as parametar .PP .Vb 1 \& my $node = new Search::HyperEstraier::Node( \*(Aqhttp://localhost:1978/node/test\*(Aq ); .Ve .PP or in more verbose form .PP .Vb 9 \& my $node = new Search::HyperEstraier::Node( \& url => \*(Aqhttp://localhost:1978/node/test\*(Aq, \& user => \*(Aqadmin\*(Aq, \& passwd => \*(Aqadmin\*(Aq \& create => 1, \& label => \*(Aqoptional node label\*(Aq, \& debug => 1, \& croak_on_error => 1 \& ); .Ve .PP with following arguments: .IP "url" 4 .IX Item "url" \&\s-1URL\s0 to node .IP "user" 4 .IX Item "user" specify username for node server authentication .IP "passwd" 4 .IX Item "passwd" password for authentication .IP "create" 4 .IX Item "create" create node if it doesn't exists .IP "label" 4 .IX Item "label" optional label for new node if \f(CW\*(C`create\*(C'\fR is used .IP "debug" 4 .IX Item "debug" dumps a \fBlot\fR of debugging output .IP "croak_on_error" 4 .IX Item "croak_on_error" very helpful during development. It will croak on all errors instead of silently returning \f(CW\*(C`\-1\*(C'\fR (which is convention of Hyper Estraier \s-1API\s0 in other languages). .SS "set_url" .IX Subsection "set_url" Specify \s-1URL\s0 to node server .PP .Vb 1 \& $node\->set_url(\*(Aqhttp://localhost:1978\*(Aq); .Ve .SS "set_proxy" .IX Subsection "set_proxy" Specify proxy server to connect to node server .PP .Vb 1 \& $node\->set_proxy(\*(Aqproxy.example.com\*(Aq, 8080); .Ve .SS "set_timeout" .IX Subsection "set_timeout" Specify timeout of connection in seconds .PP .Vb 1 \& $node\->set_timeout( 15 ); .Ve .SS "set_auth" .IX Subsection "set_auth" Specify name and password for authentication to node server. .PP .Vb 1 \& $node\->set_auth(\*(Aqclint\*(Aq,\*(Aqeastwood\*(Aq); .Ve .SS "status" .IX Subsection "status" Return status code of last request. .PP .Vb 1 \& print $node\->status; .Ve .PP \&\f(CW\*(C`\-1\*(C'\fR means connection failure. .SS "put_doc" .IX Subsection "put_doc" Add a document .PP .Vb 1 \& $node\->put_doc( $document_draft ) or die "can\*(Aqt add document"; .Ve .PP Return true on success or false on failure. .SS "out_doc" .IX Subsection "out_doc" Remove a document .PP .Vb 1 \& $node\->out_doc( document_id ) or "can\*(Aqt remove document"; .Ve .PP Return true on success or false on failture. .SS "out_doc_by_uri" .IX Subsection "out_doc_by_uri" Remove a registrated document using it's uri .PP .Vb 1 \& $node\->out_doc_by_uri( \*(Aqfile:///document/uri/42\*(Aq ) or "can\*(Aqt remove document"; .Ve .PP Return true on success or false on failture. .SS "edit_doc" .IX Subsection "edit_doc" Edit attributes of a document .PP .Vb 1 \& $node\->edit_doc( $document_draft ) or die "can\*(Aqt edit document"; .Ve .PP Return true on success or false on failture. .SS "get_doc" .IX Subsection "get_doc" Retreive document .PP .Vb 1 \& my $doc = $node\->get_doc( document_id ) or die "can\*(Aqt get document"; .Ve .PP Return true on success or false on failture. .SS "get_doc_by_uri" .IX Subsection "get_doc_by_uri" Retreive document .PP .Vb 1 \& my $doc = $node\->get_doc_by_uri( \*(Aqfile:///document/uri/42\*(Aq ) or die "can\*(Aqt get document"; .Ve .PP Return true on success or false on failture. .SS "get_doc_attr" .IX Subsection "get_doc_attr" Retrieve the value of an atribute from object .PP .Vb 2 \& my $val = $node\->get_doc_attr( document_id, \*(Aqattribute_name\*(Aq ) or \& die "can\*(Aqt get document attribute"; .Ve .SS "get_doc_attr_by_uri" .IX Subsection "get_doc_attr_by_uri" Retrieve the value of an atribute from object .PP .Vb 2 \& my $val = $node\->get_doc_attr_by_uri( document_id, \*(Aqattribute_name\*(Aq ) or \& die "can\*(Aqt get document attribute"; .Ve .SS "etch_doc" .IX Subsection "etch_doc" Exctract document keywords .PP .Vb 1 \& my $keywords = $node\->etch_doc( document_id ) or die "can\*(Aqt etch document"; .Ve .SS "etch_doc_by_uri" .IX Subsection "etch_doc_by_uri" Retreive document .PP .Vb 1 \& my $keywords = $node\->etch_doc_by_uri( \*(Aqfile:///document/uri/42\*(Aq ) or die "can\*(Aqt etch document"; .Ve .PP Return true on success or false on failture. .SS "uri_to_id" .IX Subsection "uri_to_id" Get \s-1ID\s0 of document specified by \s-1URI\s0 .PP .Vb 1 \& my $id = $node\->uri_to_id( \*(Aqfile:///document/uri/42\*(Aq ); .Ve .PP This method won't croak, even if using \f(CW\*(C`croak_on_error\*(C'\fR. .SS "_fetch_doc" .IX Subsection "_fetch_doc" Private function used for implementing of \f(CW\*(C`get_doc\*(C'\fR, \f(CW\*(C`get_doc_by_uri\*(C'\fR, \&\f(CW\*(C`etch_doc\*(C'\fR, \f(CW\*(C`etch_doc_by_uri\*(C'\fR. .PP .Vb 3 \& # this will decode received draft into Search::Estraier::Document object \& my $doc = $node\->_fetch_doc( id => 42 ); \& my $doc = $node\->_fetch_doc( uri => \*(Aqfile:///document/uri/42\*(Aq ); \& \& # to extract keywords, add etch \& my $doc = $node\->_fetch_doc( id => 42, etch => 1 ); \& my $doc = $node\->_fetch_doc( uri => \*(Aqfile:///document/uri/42\*(Aq, etch => 1 ); \& \& # to get document attrubute add attr \& my $doc = $node\->_fetch_doc( id => 42, attr => \*(Aq@mdate\*(Aq ); \& my $doc = $node\->_fetch_doc( uri => \*(Aqfile:///document/uri/42\*(Aq, attr => \*(Aq@mdate\*(Aq ); \& \& # more general form which allows implementation of \& # uri_to_id \& my $id = $node\->_fetch_doc( \& uri => \*(Aqfile:///document/uri/42\*(Aq, \& path => \*(Aq/uri_to_id\*(Aq, \& chomp_resbody => 1 \& ); .Ve .SS "name" .IX Subsection "name" .Vb 1 \& my $node_name = $node\->name; .Ve .SS "label" .IX Subsection "label" .Vb 1 \& my $node_label = $node\->label; .Ve .SS "doc_num" .IX Subsection "doc_num" .Vb 1 \& my $documents_in_node = $node\->doc_num; .Ve .SS "word_num" .IX Subsection "word_num" .Vb 1 \& my $words_in_node = $node\->word_num; .Ve .SS "size" .IX Subsection "size" .Vb 1 \& my $node_size = $node\->size; .Ve .SS "search" .IX Subsection "search" Search documents which match condition .PP .Vb 1 \& my $nres = $node\->search( $cond, $depth ); .Ve .PP \&\f(CW$cond\fR is \f(CW\*(C`Search::Estraier::Condition\*(C'\fR object, while <$depth> specifies depth for meta search. .PP Function results \f(CW\*(C`Search::Estraier::NodeResult\*(C'\fR object. .SS "cond_to_query" .IX Subsection "cond_to_query" Return \s-1URI\s0 encoded string generated from Search::Estraier::Condition .PP .Vb 1 \& my $args = $node\->cond_to_query( $cond, $depth ); .Ve .SS "shuttle_url" .IX Subsection "shuttle_url" This is method which uses \f(CW\*(C`LWP::UserAgent\*(C'\fR to communicate with Hyper Estraier node master. .PP .Vb 1 \& my $rv = shuttle_url( $url, $content_type, $req_body, \e$resbody ); .Ve .PP \&\f(CW$resheads\fR and \f(CW$resbody\fR booleans controll if response headers and/or response body will be saved within object. .SS "set_snippet_width" .IX Subsection "set_snippet_width" Set width of snippets in results .PP .Vb 1 \& $node\->set_snippet_width( $wwidth, $hwidth, $awidth ); .Ve .PP \&\f(CW$wwidth\fR specifies whole width of snippet. It's \f(CW480\fR by default. If it's \f(CW0\fR snippet is not sent with results. If it is negative, whole document text is sent instead of snippet. .PP \&\f(CW$hwidth\fR specified width of strings from beginning of string. Default value is \f(CW96\fR. Negative or zero value keep previous value. .PP \&\f(CW$awidth\fR specifies width of strings around each highlighted word. It's \f(CW96\fR by default. If negative of zero value is provided previous value is kept unchanged. .SS "set_user" .IX Subsection "set_user" Manage users of node .PP .Vb 1 \& $node\->set_user( \*(Aqname\*(Aq, $mode ); .Ve .PP \&\f(CW$mode\fR can be one of: .IP "0" 4 delete account .IP "1" 4 .IX Item "1" set administrative right for user .IP "2" 4 .IX Item "2" set user account as guest .PP Return true on success, otherwise false. .SS "set_link" .IX Subsection "set_link" Manage node links .PP .Vb 1 \& $node\->set_link(\*(Aqhttp://localhost:1978/node/another\*(Aq, \*(Aqanother node label\*(Aq, $credit); .Ve .PP If \f(CW$credit\fR is negative, link is removed. .SS "admins" .IX Subsection "admins" .Vb 1 \& my @admins = @{ $node\->admins }; .Ve .PP Return array of users with admin rights on node .SS "guests" .IX Subsection "guests" .Vb 1 \& my @guests = @{ $node\->guests }; .Ve .PP Return array of users with guest rights on node .SS "links" .IX Subsection "links" .Vb 1 \& my $links = @{ $node\->links }; .Ve .PP Return array of links for this node .SS "cacheusage" .IX Subsection "cacheusage" Return cache usage for a node .PP .Vb 1 \& my $cache = $node\->cacheusage; .Ve .SS "master" .IX Subsection "master" Set actions on Hyper Estraier node master (\f(CW\*(C`estmaster\*(C'\fR process) .PP .Vb 3 \& $node\->master( \& action => \*(Aqsync\*(Aq \& ); .Ve .PP All available actions are documented in http://hyperestraier.sourceforge.net/nguide\-en.html#protocol .SH "PRIVATE METHODS" .IX Header "PRIVATE METHODS" You could call those directly, but you don't have to. I hope. .SS "_set_info" .IX Subsection "_set_info" Set information for node .PP .Vb 1 \& $node\->_set_info; .Ve .SS "_clear_info" .IX Subsection "_clear_info" Clear information for node .PP .Vb 1 \& $node\->_clear_info; .Ve .PP On next call to \f(CW\*(C`name\*(C'\fR, \f(CW\*(C`label\*(C'\fR, \f(CW\*(C`doc_num\*(C'\fR, \f(CW\*(C`word_num\*(C'\fR or \f(CW\*(C`size\*(C'\fR node info will be fetch again from Hyper Estraier. .SH "EXPORT" .IX Header "EXPORT" Nothing. .SH "SEE ALSO" .IX Header "SEE ALSO" .PP Hyper Estraier Ruby interface on which this module is based. .PP Hyper Estraier now also has pure-perl binding included in distribution. It's a faster way to access databases directly if you are not running \&\f(CW\*(C`estmaster\*(C'\fR P2P server. .SH "AUTHOR" .IX Header "AUTHOR" Dobrica Pavlinusic, .PP Robert Klep contributed refactored search code .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (C) 2005\-2006 by Dobrica Pavlinusic .PP This library is free software; you can redistribute it and/or modify it under the \s-1GPL\s0 v2 or later.