Data::SearchEngine::Solr
version 0.20
my $solr = Data::SearchEngine::Solr->new( url => 'http://localhost:8983/solr', options => { fq => 'category:Foo', facets => 'true' } ); my $query = Data::SearchEngine::Query->new( count => 10, page => 1, query => 'ice cream', ); my $results = $solr->search($query); foreach my $item ($results->items) { print $item->get_value('name')."\n"; }
Data::SearchEngine::Solr is a Data::SearchEngine backend for the Solr search server.
Data::SearchEngine::Solr - Data::SearchEngine backend for Solr
This module uses the values from Data::SearchEngine::Query's filters to populate the fq parameter. Before talking to Solr we iterate over the filters and add the filter's value to fq.
filters
fq
$query->filters->{'last name watson'} = 'last_name:watson';
Will results in fq=name:watson. Multiple filters will be appended.
Facets may be enabled thusly:
$solr->options->{facets} = 'true'; $solr->options->{facet.field} = 'somefield';
You may also use other facet.* parameters, as defined by Solr.
facet.*
To access facet data, consult the documentation for Data::SearchEngine::Results and it's facets method.
facets
Queries may be spellchecked using Solr's spellcheck component. If you supply the correct parameters through the URL or to your URI handler then Data::SearchEngine::Solr will see it in the results and populate the bits from Data::SearchEngine::Results::Spellcheck. Note that some of the features may not work properly unless spellcheck.extendedResults is true in your query.
spellcheck.extendedResults
HashRef that is passed to WebService::Solr. Please see the above documentation on filters and facets before using this directly.
The URL at which to contact the Solr instance.
Adds a list of Data::SearchEngine::Items to the Solr index. The Items are converted into WebService::Solr::Documents using the follow means:
score
id
Calls WebService::Solr's optimize method.
optimize
Deletes an item from the index. A straight dispatch to WebService::Solr's delete.
delete
Delete a specific document by it's id.
Accepts a Data::SearchEngine::Query and returns a Data::SearchEngine::Results object containing the data from Solr.
Alias for add.
add
Cory G Watson, <gphat at cpan.org>
<gphat at cpan.org>
Copyright 2009 - 2011 Cory G Watson.
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.
Cory G Watson <gphat@cpan.org>
This software is copyright (c) 2011 by Cold Hard Code, LLC.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Data::SearchEngine::Solr, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::SearchEngine::Solr
CPAN shell
perl -MCPAN -e shell install Data::SearchEngine::Solr
For more information on module installation, please visit the detailed CPAN module installation guide.