NAME

Search::Fulltext - Fulltext search module

SYNOPSIS

use Search::Fulltext;


my $query = 'beer';
my @docs = (
    'I like beer the best',
    'Wine makes people saticefied',  # does not include beer
    'Beer makes people happy',
);


my $fts = Search::Fulltext->new({
    docs => \@docs,
});
my $results = $fts->search($query);
is_deeply($results, [0, 2]);         # 1st & 3rd doc include 'beer'

DESCRIPTION

Search::Fulltext is a fulltext search module. It can be used in a few steps.

Search::Fulltext has pluggable tokenizer feature, which possibly provides fulltext search for any language. Currently, English and Japanese fulltext search are officially supported, although any other languages which have spaces for separating words could be also used. See ["CUSTOM TOKENIZERS"](#CUSTOM TOKENIZERS) section to learn how to search non-English languages.

SQLite's FTS4 is used as an indexer. Various queries supported by FTS4 (AND, OR, NEAR, ...) are fully provided. See Search::Fulltext->search section for types of queries.

METHODS

Search::Fulltext->new

Creates fulltext index for documents.

Search::Fulltext->search

Search terms in documents by query language.

CUSTOM TOKENIZERS

Custom tokenizers can be implemented by pure perl thanks to ["Perl tokenizers" in DBD::SQLite](http://search.cpan.org/perldoc?DBD::SQLite#Perl tokenizers). Search::Fulltext::Tokenizer::MeCab is an example of custom tokenizers.

See ["Perl tokenizers" in DBD::SQLite](http://search.cpan.org/perldoc?DBD::SQLite#Perl tokenizers) and Search::Fulltext::Tokenizer::MeCab module to learn how to develop custom tokenizers.

SUPPORTS

Bug reports and pull requests are welcome at https://github.com/laysakura/Search-Fulltext !

VERSION

Version 1.00

AUTHOR

Sho Nakatani lay.sakura@gmail.com, a.k.a. @laysakura