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: clobber(), open(), and read(). 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.

clobber

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

Initialize a new invindex, creating a directory on the file system if appropriate. 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 invindex for reading/writing. Initializes a new invindex if one does not already exist.

read

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

Open an invindex for either reading or updating. Fails if the invindex doesn't exist.

METHODS

get_folder get_invindex

Getters for folder and invindex.

COPYRIGHT

Copyright 2007 Marvin Humphrey

LICENSE, DISCLAIMER, BUGS, etc.

See KinoSearch version 0.20.