Dezi::Indexer::Config - read/write Indexer config files
use Dezi::Indexer::Config; my $config = Dezi::Indexer::Config->new; $config->write2(); $config->read2('path/to/file.conf'); $config->write3();
The Dezi::Indexer::Config class reads and writes Swish-e 2.x configuration files, and converts them to Swish3-style XML configuration format.
See the Swish-e documentation for a list of configuration parameters. Each parameter has an accessor/mutator method as part of the Config object. http://swish-e.org/docs/swish-config.html.
NOTE: Every config parameter can take either a scalar or an array ref as a value. In addition, you may append config values to any existing values by passing an additional true argument. The return value of any 'get' is always an array ref.
Example:
$config->MetaNameAlias( ['foo bar', 'one two', 'red yellow'] ); $config->MetaNameAlias( 'green blue', 1 ); print join("\n", @{ $config->MetaNameAlias }), " \n"; # would print: # foo bar # one two # red yellow # green blue
Instantiate a new Config object. Takes a hash of key/value pairs, where each key may be a configuration parameter.
my $config = Dezi::Indexer::Config->new( DefaultContents => 'HTML*' ); print "DefaultContents is ", $config->DefaultContents, "\n";
Internal method called by new().
Simple heuristics to test whether file represents a libswish3-style file or string.
Returns the object as a XML string in libswish3 header format.
Class method.
Returns array ref of all the option (method) names supported.
Reads version 2 compatible config file and stores in current object. Returns parsed config file as a hashref or undef on failure to parse.
use Dezi::Indexer::Config; my $config = Dezi::Indexer::Config->new(); my $parsed = $config->read2( 'my/file.cfg' ); # should print same thing print $config->WordCharacters->[0], "\n"; print $parsed->{WordCharacters}, "\n";
Slurps file into the swish3_config() attribute.
Writes Swish-e version 2 compatible config file.
If path/file is omitted, a temp file will be written using File::Temp.
If prog_mode is true all config directives inappropriate for the -S prog mode in the Native::Indexer are skipped. The default is false.
Returns full path to file.
Full path is also available via file() method.
Returns name of the file written by write2().
Write config object to file in SWISH::3::Config XML format.
Returns current Config object as a hash ref.
Returns array ref of all MetaNames, regardless of whether they are declared as MetaNames, MetaNamesRank or MetaNameAlias config options.
Returns object as version 2 formatted scalar.
If prog_mode is true skips inappropriate directives for running the Native::Indexer. Default is false. See write2().
This method is used to overload the object for printing, so these are equivalent:
print $config->stringify; print $config;
Utility method for converting Swish-e version 2 style config files to SWISH::3::Config XML style.
Converts file to XML format and returns as XML string.
my $xmlconf = $config->ver2_to_ver3( 'my/file.config' );
If file is omitted, uses the current values in the calling object.
The following fields are converted but are ignored by SWISH::3::Config.
AbsoluteLinks BumpPositionCounterCharacters Buzzwords BeginCharacters ConvertHTMLEntities Delay DontBumpPositionOnEndTags DontBumpPositionOnStartTags EnableAltSearchSyntax EndCharacters EquivalentServer ExtractPath FileFilter FileFilterMatch FileMatch FileRules HTMLLinksMetaName IgnoreFirstChar IgnoreLastChar IgnoreLimit IgnoreMetaTags IgnoreNumberChars IgnoreTotalWordCountWhenRanking IgnoreWords ImageLinksMetaName IndexAltTagMetaName IndexComments IndexDir IndexOnly IndexPointer IndexReport MaxDepth MaxWordLimit MinWordLimit NoContents obeyRobotsNoIndex PreSortedIndex PropCompressionLevel RecursionDepth ReplaceRules ResultExtFormatName SpiderDirectory SwishProgParameters SwishSearchDefaultRule SwishSearchOperators TmpDir TranslateCharacters TruncateDocSize UseSoundex UseStemming UseWords WordCharacters Words
The following fields are converted to the their SWISH::3::Config equivalents.
CascadeMetaContext DefaultContents FollowSymLinks FollowXInclude FuzzyIndexingMode IncludeConfigFile IndexAdmin IndexContents IndexDescription IndexDir IndexFile IndexName IndexReport MetaNameAlias MetaNames MetaNamesRank ParserWarnLevel PropertyNameAlias PropertyNames PropertyNamesCompareCase PropertyNamesDate PropertyNamesIgnoreCase PropertyNamesMaxLength PropertyNamesNoStripChars PropertyNamesNumeric PropertyNamesSortKeyLength StoreDescription TagAlias UndefinedMetaTags UndefinedMetaNames UndefinedXMLAttributes XMLClassAttributes
Returns the 2-letter language code for the Snowball stemmer corresponding to fuzzymode. If fuzzymode is not defined, calls FuzzyIndexingMode() method on the config object.
IgnoreTotalWordCountWhenRanking defaults to 0 which is not the default in Swish-e 2.x.
Peter Karman, <perl@peknet.com>
Please report any bugs or feature requests to bug-swish-prog at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Dezi-App. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-swish-prog at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Dezi
You can also look for information at:
Mailing list
http://lists.swish-e.org/listinfo/users
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Dezi-App
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Dezi-App
CPAN Ratings
http://cpanratings.perl.org/d/Dezi-App
Search CPAN
http://search.cpan.org/dist/Dezi-App/
Copyright 2006-2018 by Peter Karman
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
http://swish-e.org/
To install Dezi::App, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dezi::App
CPAN shell
perl -MCPAN -e shell install Dezi::App
For more information on module installation, please visit the detailed CPAN module installation guide.