Search::Glimpse::Index - Interface to glimpseindex
use Search::Glimpse::Index; my %opt = ( timeindex => 1, dryrun => 0, indexall => 0, indexnum => 0, incremental => 0, structural => 0, destdir => "$ENV{HOME}/myindexes", stopword => 90, # must appear in 90% of files ); my $indexer = Search::Glimpse::Index( %opt ); $indexer->index("/path/to/folder/to/index");
This module is a Perl interface to glimpseindex binary. It (hopefully) makes easier to use the application from within Perl scripts or modules.
new
The constructor receives a hash with the indexing options to use. Note that all these values have sensible defaults (mosty, the glimpseindex defaults). Although I describe briefly what each option represent, I suggest to read the complete manpage for glimpseindex.
glimpseindex
Known options are:
destdir
glimpseindex -H
This is the folder where glimpseindex will store its index files. This is also the path where you should put your exclude/include files. Future versions of this module might include an interface for those files.
dryrun
glimpseindex -I
This option is a boolean value, and sets whether glimpseindex should really index the files or just output the files that would be indexed in a real run.
bigindex
glimpseindex -b
glimpseindex has three different index sizes. By default the medium index is used (glimpseindex -o). Use this option for bigger indexes and (hopefully) faster results.
glimpseindex -o
smallindex
glimpseindex has three different index sizes. By default the medium index is used (glimpseindex -o). Use this option for smaller indexes (not using any glimpseindex switch).
indexnum
glimpseindex -n
By default, tokens with digits are not indexed. Therefore, things like abc123 or a date will not be indexed. Use this option to force tokens with digits to be indexed.
abc123
indexall
glimpseindex -E
Makes glimpseindex to index all files, independently of their file type. Note that glimpseindex will honor .glimpse_exclude files.
.glimpse_exclude
timeindex
glimpseindex -t
This option is only available for glimpse version 3.5 or newer. It changes the order by which files are indexed. By default files are indexed in a mostly arbitraty order. With this option (which doesn't work in smallindex mode), the index will store files in a reversed order of modification time (recent files first). Therefore, results of queries are returned by this order, and glimpse is able t filter results by age.
glimpse
incremental
glimpseindex -f
Useful if you have run a glimpseindex earlier and need to reindex. This option will perform an incremental indexing. If there is no current index or if this procedure fails, glimpseindex automatically reverts to the default mode (which is to index everything from scratch).
structural
glimpseindex -s
Use this option if you want to support structured queries.
swsize
glimpseindex -S
This option is used to control the amount of stop words to be considered. For further details on how the values of this option behave, please check glimpseindex manpage.
index
Use with a path to be indexed.
perl(1)
Alberto Manuel Brandão Simões, <ambs@cpan.org>
Copyright (C) 2011 by Alberto Manuel Brandão Simões
To install Search::Glimpse, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Search::Glimpse
CPAN shell
perl -MCPAN -e shell install Search::Glimpse
For more information on module installation, please visit the detailed CPAN module installation guide.