Lingua::Thesaurus::Storage::SQLite - Thesaurus storage in an SQLite database
my $storage = Lingua::Thesaurus::Storage::SQLite->new($dbname); my $storage = Lingua::Thesaurus::Storage::SQLite->new(%args);
new() has only one scalar argument, this is interpreted as
new(dbname => $arg). Otherwise, parameters should be passed as a hash or hashref, with the following options :
Filename for storing the DBD::SQLite database. This could also be
:memory:for an in-memory database.
Optional handle to an already connected database (in that case, the
dbnameparameter will not be used).
Hashref of key-value pairs that will be stored into the database, and can be retrieved by other processes using the thesaurus. This package interprets the following keys :
If true, the
termtable will use SQLite's fulltext functionalities. This means that
$thesaurus->search_terms('sci*')will also retrieve
'computer science'; you can also issue boolean queries like
'sci* AND NOT comp*'.
If true, the
termtable is just a regular SQLite table, and queries will be interpreted through SQLite's
This parameter only makes sense together with
use_fulltext. It will activate "unaccent" in Search::Tokenizer, so that a query for
thésauruswill also find
thesaurus, or vice-versa.
Name of the class for instanciating terms. Default is Lingua::Thesaurus::Term.
Name of the class for instanciating "relation types". Default is Lingua::Thesaurus::RelType.
See "Populating the database" in Lingua::Thesaurus::Storage for the API.
Below are some particular notes about the SQLite implementation.
This method just performs
commit, because inserts into an SQLite database are much faster under a transaction. No support for rollbacks is programmed, because in this context there is no need for it.
use_fulltext is false, terms are stored in a regular table with a UNIQUE constraint, so it is not possible to store the same term string twice.
use_fulltext is true, no constraint is enforced.