Rechercher une page de manuel
WebService::Solr.3pm
Langue: en
Version: 2010-03-17 (ubuntu - 24/10/10)
Section: 3 (Bibliothèques de fonctions)
Sommaire
- NAME
- SYNOPSIS
- DESCRIPTION
- ACCESSORS
- METHODS
- new( $url, \%options )
- BUILDARGS( @args )
- add( $doc|\@docs, \%options )
- update( $doc|\@docs, \%options )
- delete( \%options )
- delete_by_id( $id )
- delete_by_query( $query )
- search( $query, \%options )
- auto_suggest( \%options )
- commit( \%options )
- rollback( )
- optimize( \%options )
- ping( )
- generic_solr_request( $path, \%query )
- SEE ALSO
- AUTHORS
- COPYRIGHT AND LICENSE
NAME
WebService::Solr - Module to interface with the Solr (Lucene) webserviceSYNOPSIS
my $solr = WebService::Solr->new; $solr->add( @docs ); my $response = $solr->search( $query ); for my $doc ( $response->docs ) { print $doc->value_for( $id ); }
DESCRIPTION
WebService::Solr is a client library for Apache Lucene's Solr; an enterprise-grade indexing and searching platform.ACCESSORS
- •
- url - the webservice base url
- •
- agent - a user agent object
- •
- autocommit - a boolean value for automatic commit() after add/update/delete
- •
- default_params - a hashref of parameters to send on every request
METHODS
new( $url, \%options )
Creates a new WebService::Solr instance. If $url is omitted, then "http://localhost:8983/solr" is used as a default. Available options are listed in the ACCESSORS section.BUILDARGS( @args )
A Moose override to allow our custom constructor.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 "WebService::Solr::Document->new". Available options as of Solr 1.4 are:- •
- overwrite (default: true) - Replace previously added documents with the same uniqueKey
- •
- commitWithin (in milliseconds) - The document will be added within the specified time
update( $doc|\@docs, \%options )
Alias for "add()".delete( \%options )
Deletes documents matching the options provided. The delete operation currently accepts "query" and "id" parameters. Multiple values can be specified as array references.# delete documents matching "title:bar" or uniqueId 13 or 42 $solr->delete( { query => 'title:bar', id => [ 13, 42 ], } );
delete_by_id( $id )
Deletes all documents matching the id specified. Returns true on success, false otherwise.delete_by_query( $query )
Deletes documents matching $query. Returns true on success, false otherwise.search( $query, \%options )
Searches the index given a $query. Returns a WebService::Solr::Response object. All key-value pairs supplied in "\%options" are serialzied in the request URL.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)commit( \%options )
Sends a commit command. Returns true on success, false otherwise. You must do a commit after an add, update or delete. You can turn autocommit on to have the library do it for you:my $solr = WebService::Solr->new( undef, { autocommit => 1 } ); $solr->add( $doc ); # will not automatically call commit() $solr->commit;
Options as of Solr 1.4 include:
- •
- maxSegments (default: 1) - Optimizes down to at most this number of segments
- •
- waitFlush (default: true) - Block until index changes are flushed to disk
- •
- waitSearcher (default: true) - Block until a new searcher is opened
- •
- expungeDeletes (default: false) - Merge segments with deletes away
rollback( )
This method will rollback any additions/deletions since the last commit.optimize( \%options )
Sends an optimize command. Returns true on success, false otherwise.Options as of Solr 1.4 are the same as "commit()".
ping( )
Sends a basic ping request. Returns true on success, false otherwise.generic_solr_request( $path, \%query )
Performs a simple "GET" request appending $path to the base URL and using key-value pairs from "\%query" to generate the query string. This should allow you to access parts of the Solr API that don't yet have their own correspodingly named function (e.g. "dataimport" ).SEE ALSO
- •
- http://lucene.apache.org/solr/
- •
- Solr - an alternate library
AUTHORS
Brian Cassidy <bricas@cpan.org>Kirk Beers <kirk.beers@nald.ca>
COPYRIGHT AND LICENSE
Copyright 2008-2010 National Adult Literacy DatabaseThis library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre