Giter VIP home page Giter VIP logo

dbix-class-indexer-webservice-lucene's Introduction

NAME
    DBIx::Class::Indexer::WebService::Lucene - Automatic indexing of
    DBIx::Class objects via WebService::Lucene

SYNOPSIS
        package MySchema::Foo;
    
        use base qw( DBIx::Class );
    
        __PACKAGE__->load_components( qw( Indexed Core ) );
        __PACKAGE__->table('foo');
        __PACKAGE__->set_indexer('WebService::Lucene');
        __PACKAGE__->add_columns(
            foo_id => {
                data_type         => 'integer',
                is_auto_increment => 1
            },
            name => {
                data_type => 'varchar',
                size      => 10,
                indexed   => {
                    type => 'text',
                }
            },
            location => {
                data_type => 'varchar',
                size      => 50,
                indexed   => 'text'
            }
        );
    
        __PACKAGE__->has_many( widgets => 'widget' );
        __PACKAGE__->add_index_fields(
            widget => {
                source => 'widgets.name'
                type   => 'unstored'
            },
            widget_updated => {
                source => 'widgets.ctime.epoch',
            },
            author => {
                source => sub {
                    map {
                        join ' ', $_->first_name, $_->last_name
                    } shift->authors
                },
            },
            all => {
                source => sub {
                    my $self = shift;
                    join ' ', map { $self->$_ } qw( name location );
                }
                type => 'unstored',
                role => 'default_field' # will be search if no field prefix
                                        # is specified
            }
        );
    
DESCRIPTION
    This is a DBIx::Class component to make full-text indexing a seamless
    part of database objects. All that is required is the registration of
    desired fields for the index. Notice that fields are not necessarily the
    same as columns. For instance, suppose you have a schema representing a
    film and its actors. The index representing the film table may have a
    fields called 'actor' which can have multiple values, depending on the
    number of actors associated with the film.

        package Film;
    
        __PACKAGE__->add_index_fields(
            actor => {
                type   => 'text',
                source => 'actors.name'
            },
        );
    
METHODS
  new( \%connect_info, $source_class )
    Instantiates a new Lucene Web Service indexer.

  setup_index( $source, $index )
    If the index does not yet exist, this method will create it for you.

  setup_fields( $source )
    Normalizes the index fields so they all have hashref members with a
    "type" key at a minimum. It all attemps to figure out which field will
    be used as the primary identifier and what field might be used for the
    last updated column (optional).

  field_for_role( $source, $role )
    Looks through the field list for a member with role equal to $role.

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

  as_document( [ $document ] )
    If a document is passed to the method, it will replaces the document's
    current fields with those outlined by the source's registered fields. If
    no document is passed, it will construct a new
    WebService::Lucene::Document object, populate it, and return it.

  insert( $object )
    Calls "update_or_create_document".

  update( $object )
    Calls "update_or_create_document".

  delete( $object )
    Deletes document from the index.

  update_or_create_document( $object )
    Will either update or add a document to the index, depending on its
    existence in the index.

SEE ALSO
    * DBIx::Class
    * DBIx::Class::Indexed
    * WebService::Lucene
    * The Lucene Web Service (http://www.lucene-ws.net/)

AUTHOR
    * Adam Paynter <[email protected]>
    * Brian Cassidy <[email protected]>

COPYRIGHT AND LICENSE
    Copyright 2006 by Adam Paynter

    This library is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.

dbix-class-indexer-webservice-lucene's People

Contributors

bricas avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.