.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" 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" '' . ds C` . ds C' '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. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" 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 "WebService::Solr 3pm" .TH WebService::Solr 3pm "2014-02-07" "perl v5.18.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" WebService::Solr \- Module to interface with the Solr (Lucene) webservice .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& my $solr = WebService::Solr\->new; \& $solr\->add( @docs ); \& \& my $response = $solr\->search( $query ); \& for my $doc ( $response\->docs ) { \& print $doc\->value_for( $id ); \& } .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" WebService::Solr is a client library for Apache Lucene's Solr; an enterprise-grade indexing and searching platform. .SH "ACCESSORS" .IX Header "ACCESSORS" .IP "\(bu" 4 url \- the webservice base url .IP "\(bu" 4 agent \- a user agent object .IP "\(bu" 4 autocommit \- a boolean value for automatic \fIcommit()\fR after add/update/delete (default: enabled) .IP "\(bu" 4 default_params \- a hashref of parameters to send on every request .IP "\(bu" 4 last_response \- stores a WebService::Solr::Response for the last request .SH "HTTP KEEP-ALIVE" .IX Header "HTTP KEEP-ALIVE" Enabling \s-1HTTP\s0 Keep-Alive is as simple as passing your custom user-agent to the constructor. .PP .Vb 3 \& my $solr = WebService::Solr\->new( $url, \& { agent => LWP::UserAgent\->new( keep_alive => 1 ) } \& ); .Ve .PP Visit LWP::UserAgent's documentation for more information and available options. .SH "METHODS" .IX Header "METHODS" .ie n .SS "new( $url, \e%options )" .el .SS "new( \f(CW$url\fP, \e%options )" .IX Subsection "new( $url, %options )" Creates a new WebService::Solr instance. If \f(CW$url\fR is omitted, then \&\f(CW\*(C`http://localhost:8983/solr\*(C'\fR is used as a default. Available options are listed in the \s-1ACCESSORS\s0 section. .ie n .SS "\s-1BUILDARGS\s0( @args )" .el .SS "\s-1BUILDARGS\s0( \f(CW@args\fP )" .IX Subsection "BUILDARGS( @args )" A Moose override to allow our custom constructor. .ie n .SS "add( $doc|\e@docs, \e%options )" .el .SS "add( \f(CW$doc\fP|\e@docs, \e%options )" .IX Subsection "add( $doc|@docs, %options )" Adds a number of documents to the index. Returns true on success, false otherwise. A document can be a WebService::Solr::Document object or a structure that can be passed to \f(CW\*(C`WebService::Solr::Document\->new\*(C'\fR. Available options as of Solr 1.4 are: .IP "\(bu" 4 overwrite (default: true) \- Replace previously added documents with the same uniqueKey .IP "\(bu" 4 commitWithin (in milliseconds) \- The document will be added within the specified time .ie n .SS "update( $doc|\e@docs, \e%options )" .el .SS "update( \f(CW$doc\fP|\e@docs, \e%options )" .IX Subsection "update( $doc|@docs, %options )" Alias for \f(CW\*(C`add()\*(C'\fR. .SS "delete( \e%options )" .IX Subsection "delete( %options )" Deletes documents matching the options provided. The delete operation currently accepts \f(CW\*(C`query\*(C'\fR and \f(CW\*(C`id\*(C'\fR parameters. Multiple values can be specified as array references. .PP .Vb 5 \& # delete documents matching "title:bar" or uniqueId 13 or 42 \& $solr\->delete( { \& query => \*(Aqtitle:bar\*(Aq, \& id => [ 13, 42 ], \& } ); .Ve .ie n .SS "delete_by_id( $id )" .el .SS "delete_by_id( \f(CW$id\fP )" .IX Subsection "delete_by_id( $id )" Deletes all documents matching the id specified. Returns true on success, false otherwise. .ie n .SS "delete_by_query( $query )" .el .SS "delete_by_query( \f(CW$query\fP )" .IX Subsection "delete_by_query( $query )" Deletes documents matching \f(CW$query\fR. Returns true on success, false otherwise. .ie n .SS "search( $query, \e%options )" .el .SS "search( \f(CW$query\fP, \e%options )" .IX Subsection "search( $query, %options )" Searches the index given a \f(CW$query\fR. Returns a WebService::Solr::Response object. All key-value pairs supplied in \f(CW\*(C`\e%options\*(C'\fR are serialized in the request \s-1URL.\s0 .PP If filter queries are needed, create WebService::Solr::Query objects and pass them into the \f(CW%options\fR. For example, if you were searching a database of books for a subject of \*(L"Perl\*(R", but wanted only paperbacks and a copyright year of 2011 or 2012: .PP .Vb 7 \& my $query = WebService::Solr::Query\->new( { subject => \*(AqPerl\*(Aq } ); \& my %options = ( \& fq => [ \& WebService::Solr::Query\->new( { binding => \*(AqPaperback\*(Aq } ), \& WebService::Solr::Query\->new( { year => [ 2011, 2012 ] } ), \& ], \& ); \& \& my $response = $solr\->search( $query, \e%options ); .Ve .PP The filter queries are typically added when drilling down into search results and selecting a facet to drill into. .SS "auto_suggest( \e%options )" .IX Subsection "auto_suggest( %options )" Get suggestions from a list of terms for a given field. The Solr wiki has more details about the available options (http://wiki.apache.org/solr/TermsComponent) .SS "commit( \e%options )" .IX Subsection "commit( %options )" Sends a commit command. Returns true on success, false otherwise. You must do a commit after an add, update or delete. By default, autocommit is enabled. You may disable autocommit to allow you to issue commit commands manually: .PP .Vb 3 \& my $solr = WebService::Solr\->new( undef, { autocommit => 0 } ); \& $solr\->add( $doc ); # will not automatically call commit() \& $solr\->commit; .Ve .PP Options as of Solr 1.4 include: .IP "\(bu" 4 maxSegments (default: 1) \- Optimizes down to at most this number of segments .IP "\(bu" 4 waitFlush (default: true) \- Block until index changes are flushed to disk .IP "\(bu" 4 waitSearcher (default: true) \- Block until a new searcher is opened .IP "\(bu" 4 expungeDeletes (default: false) \- Merge segments with deletes away .SS "rollback( )" .IX Subsection "rollback( )" This method will rollback any additions/deletions since the last commit. .SS "optimize( \e%options )" .IX Subsection "optimize( %options )" Sends an optimize command. Returns true on success, false otherwise. .PP Options as of Solr 1.4 are the same as \f(CW\*(C`commit()\*(C'\fR. .SS "ping( )" .IX Subsection "ping( )" Sends a basic ping request. Returns true on success, false otherwise. .ie n .SS "generic_solr_request( $path, \e%query )" .el .SS "generic_solr_request( \f(CW$path\fP, \e%query )" .IX Subsection "generic_solr_request( $path, %query )" Performs a simple \f(CW\*(C`GET\*(C'\fR request appending \f(CW$path\fR to the base \s-1URL\s0 and using key-value pairs from \f(CW\*(C`\e%query\*(C'\fR to generate the query string. This should allow you to access parts of the Solr \s-1API\s0 that don't yet have their own correspondingly named function (e.g. \f(CW\*(C`dataimport\*(C'\fR ). .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "\(bu" 4 http://lucene.apache.org/solr/ .IP "\(bu" 4 Solr \- an alternate library .SH "AUTHORS" .IX Header "AUTHORS" Brian Cassidy .PP Kirk Beers .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright 2008\-2014 National Adult Literacy Database .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.