27 Oct 2007 19:46:10 UTC
- Development release
- Distribution: KinoSearch
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (5)
- Testers (21 / 5 / 2)
- KwaliteeBus factor: 0
- License: perl_5
- Activity24 month
- Download (460.82KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionCREAMYG Marvin Humphreyand 1 contributors
- Marvin Humphrey <marvin at rectangular dot com>
- LICENSE, DISCLAIMER, BUGS, etc.
KinoSearch::InvIndex - An inverted index.
use MySchema; my $invindex = MySchema->clobber('/path/to/invindex');
"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.
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.
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
folderargument, so you can do things like supply a RAMFolder.
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.
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.
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.
Getters for folder and invindex.
Copyright 2007 Marvin Humphrey
See KinoSearch version 0.20.