NAME

DBIx::Class::Indexer::WebService::Dezi - An indexer for Dezi/Lucy.

VERSION

Version 0.08

SYNOPSIS

This module was inspired (and borrowed some) by DBIx::Class::Indexer::WebService::Solr. In fact it uses DBIx::Class::Indexer as its abstract class. This indexer allows one to use a Dezi::Client to update the index on "insert", "update", or "delete".

package MyApp::Schema::Foo; 
use base 'DBIx::Class';

__PACKAGE__->load_components( qw[ Indexed ] );
__PACKAGE__->set_indexer( 'WebService::Dezi', { server => 'http://localhost:5000', content_type => 'application/json' } );

__PACKAGE__->table('person');

__PACKAGE__->add_columns(
    person_id => {
        data_type       => 'varchar',
        size            => '36',
        is_nullable     => 0,
    },
    name => {
        data_type       => 'varchar',
        is_nullable     => 0,
        indexed         => 1 
    },
    age => {
        data_type       => 'integer',
        is_nullable     => 0,
    },
    image_path => {
        data_type       => 'varchar',
        size            => '128',
        indexed         => { is_binary => 1, base64_encode => 1 },
    },
    email => {
        data_type       => 'varchar',
        size            => '128',
    },
    created => {
        data_type       => 'timestamp',
        set_on_create   => 1,
        is_nullable     => 0,
    },
);

CONFIG

indexed

Can be set to 1 or contain a hashref.

is_binary

Flags an indexied field as a binary pointer. Will attempt to slurp the contents for indexing.

base64_encode

A flag that will make a is_binary indexed field converted to base64. It is worth noting that highlighting needs to be turned off in the dezi config for this to properly index.

ATTRIBUTES

connect_info

Connect info parameters.

content_type

Connect info parameters.

disabled

Will disable any calls to Dezi::Client and indexing. This is useful in preventing exceptions if the Dezi server is temporarily down.

source

Source object

_dezi

Internal dezi object.

_field_prep

Used for noramalization of fields.

ATTRIBUTES

as_document( $self, $object )

Handles the insert operation. Generates a XML or JSON document that will be indexed by the dezi service.

BUILD( $self )

Creates a new Dezi::Client object and normalizes the fields to be indexed.

update_or_create_document( $object )

Handles the insert operation.

value_for_field( $object, $key )

Uses the indexed fields information to determine how to get the values for $key out of $object.

The logic here was borrowed from DBIx::Class::Indexer::WebService::Solr

setup_fields( $source )

Normalizes the index fields so they all have hashref members with an optional boost key.

delete( $object )

Handles the delete operation.

insert( $object )

Handles the insert operation.

update( $object )

Handles the update operation.

AUTHOR

Logan Bell, <loganbell at gmail.com>

BUGS

Please report any bugs or feature requests to bug-dbix-class-indexer-webservice-dezi at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=DBIx-Class-Indexer-WebService-Dezi. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc DBIx::Class::Indexer::WebService::Dezi

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2012 Logan Bell.

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.