Author image Marvin Humphrey
and 1 contributors

NAME

KinoSearch::InvIndex - An inverted index.

SYNOPSIS

    use MySchema;
    my $invindex = MySchema->clobber('/path/to/invindex');

DESCRIPTION

"InvIndex" is short for "inverted index", the name for the data structure which KinoSearch is based around. Generically, an inverted index, as opposed to any other kind of index, contains mappings from keywords to documents, allowing you to look up a term and find out where it occurs within a collection.

A KinoSearch::InvIndex object has two main parts: a Schema and a Folder. The Schema describes how the index data is structured, and the Folder provides the I/O capabilities for actually getting at the data and doing something with it.

CONSTRUCTORS

InvIndex provides three constructors: create(), clobber(), and open(). They all take two hash-style params.

  • schema - an instance of an object which isa KinoSearch::Schema.

  • folder - Either an object which isa KinoSearch::Store::Folder, or a filepath. If a filepath is supplied, an FSFolder object will be created.

These constructors are usually called via factory methods from Schema:

    my $invindex = MySchema->clobber($filepath);

    # ... is the same as...

    my $invindex = KinoSearch::InvIndex->clobber(
        schema => MySchema->new,
        folder => KinoSearch::Store::FSFolder->new( path => $filepath ),
    );

However, when called directly, InvIndex's constructors allow you more flexibility in supplying the folder argument, so you can do things like supply a RAMFolder.

create

    my $invindex = KinoSearch::InvIndex->create(
        schema => MySchema->new,
        folder => $path_or_folder_obj,
    );

Initialize a new invindex, creating a directory on the file system if appropriate. Fails unless the Folder is empty.

clobber

    my $invindex = KinoSearch::InvIndex->clobber(
        schema => MySchema->new,
        folder => $path_or_folder_obj,
    );

Similar to create, but firsts attempts to delete any files within the Folder that look like index files.

open

    my $invindex = KinoSearch::InvIndex->open(
        schema => MySchema->new,
        folder => $path_or_folder_obj,
    );

Open an existing invindex for either reading or updating.

COPYRIGHT

Copyright 2007 Marvin Humphrey

LICENSE, DISCLAIMER, BUGS, etc.

See KinoSearch version 0.20.