The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

SolarBeam - Async Solr search driver

VERSION

0.04

SYNOPSIS

    use SolarBeam;
    my $solr = SolarBeam->new;
    $solr->search(...);

DESCRIPTION

Interface to acquire Solr index engine connections.

SolarBeam is currently EXPERIMENTAL.

ATTRIBUTES

SolarBeam implements the the following attributes.

ua

    $ua = $self->ua
    $self = $self->ua(Mojo::UserAgent->new);

A Mojo::UserAgent compatible object.

url

  $url = $self->url;

Solr endpoint as a Mojo::URL object. Note that passing in "url" as a string to "new" also works.

default_query

A hashref with default parameters used for every query.

METHODS

new

  $self = SolarBeam->new(%attributes);

Object constructor.

  $self = $self->search($query, [%options], sub { my ($self, $res) = @_; });

Used to search for data in Solr. $res is a SolarBeam::Response object.

Example $query:

  • Hash

      $self->search({surname => q("Thorsen"), age => [33, 34]});

    The query above will result in this Solr query:

      (surname:("Thorsen") AND age:(33) OR age:(34))
  • String

      $self->search("active:1");

    The query above will result in this Solr query:

      active:1

%options can hold Solr query parameters and some special instuctions to this module, such a "page" and "rows".

autocomplete

    $self = $self->autocomplete($prefix, [%options], sub { my ($self, $res) = @_; });

TODO.

$res is a SolarBeam::Response object.

%options can be:

  • -postfix - defaults to \w+

  • regex.flag -

  • regex -

COPYRIGHT AND LICENSE

Copyright (C) 2011-2016, Magnus Holm

This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.

AUTHOR

Magnus Holm - judofyr@gmail.com

Jan Henning Thorsen - jhthorsen@cpan.org

Nicolas Mendoza - mendoza@pvv.ntnu.no