NAME

MKDoc::SQL::IndexedTable - Table with inverted weighted keyword searches

SUMMARY

MKDoc::SQL::IndexedTable is a subclass of MKDoc::SQL::Table, with the following difference:

The table MUST have a list of weights for the columns which need to be indexed. See new() for details.

The MKDoc::SQL::IndexedTable adds a method, fast_search(), to perform searches on the index table and quickly retrieve records.

$class->new (%arguments);

MKDoc::SQL::IndexedTable->new (
    name     => $table_name,
    pk       => [ $name1 ],
    cols     => [ { name => $name1, type => $type1 },
                  { name => $name2, type => $type2 } ],
    unique   => { $name1 => [ $col1, $col2 ] }
    index    => { $name2 => [ $col2 ] }
    fk       => { foreign_table => { source_col => target_col } }
    ai       => TRUE / FALSE

    # extra mandatory parameters
    weight   => {
        col1   =>  1,
        col2   =>  2,
        col3   =>  5
    }
);

$self->fast_search ($condition);

Searches the index table for the keywords from $query, and returns a list of results for that search.

[ $record_id, $weight ], [ $record_id, $weight ], ...