NAME
Dezi::Config - Dezi server configuration
SYNOPSIS
use Dezi::Config;
use CHI;
my $dezi_config = Dezi::Config({
search_path => '/search',
index_path => '/index',
commit_path => '/commit',
rollback_path => '/rollback',
ui_path => '/ui',
ui_class => 'Dezi::UI',
# or
# ui => Dezi::UI->new()
admin_path => '/admin',
admin_class => 'Dezi::Admin',
# or
# admin => Dezi::Admin->new(),
base_uri => '',
server_class => 'Dezi::Server',
# authentication for non-idempotent requests.
# if both username && password are defined,
# then /index, /commit and /rollback require
# basic authentication credentials.
username => 'someone',
password => 'somesecret',
# optional
# see Dezi::Stats
stats_logger => Dezi::Stats->new(
type => 'DBI',
dsn => 'DBI::mysql:database=mydb;host=localhost;port=3306',
username => 'myuser',
password => 'mysecret',
),
# see Search::OpenSearch::Engine
engine_config => {
default_response_format => 'JSON',
# could be any Search::OpenSearch::Engine::* class
type => 'Lucy',
# name of the index(es)
index => [qw( path/to/your.index )],
# which facets to calculate, and how many results to consider
facets => {
names => [qw( color size flavor )],
sample_size => 10_000,
},
# result attributes in response
fields => [qw( color size flavor )],
# options passed to indexer defined by Engine type (above)
# defaults to Dezi::Lucy::Indexer->new
indexer_config => {
# see Dezi::Indexer::Config
# and http://swish-e.org/docs/swish-config.html
config => {
# searchable fields
MetaNames => 'color size flavor',
# attributes to store
PropertyNames => 'color size flavor',
# auto-vivify new fields based on POSTed docs.
# use this if you want ElasticSearch-like effect.
UndefinedMetaTags => 'auto',
# treat unknown mime types as text/plain
DefaultContents => 'TXT',
# use English snowball stemmer
FuzzyIndexingMode => 'Stemming_en1',
},
# store token positions to optimize snippet creation
highlightable_fields => 1,
},
# options passed to searcher defined by Engine type (above)
# defaults to Dezi::Lucy::Searcher->new
searcher_config => {
max_hits => 1000,
find_relevant_fields => 1,
qp_config => {
dialect => 'Lucy',
null_term => 'NULL',
# see Search::Query::Parser and Search::Query::Dialect::Lucy
# for full list of options
},
},
# see LucyX::Suggester
suggester_config => {
limit => 10,
fields => [qw( color size )],
# passed to Search::Tools::Spellcheck->new
# along with parser_config
spellcheck_config => {
lang => 'en_US',
},
},
# cache facets for speed-up.
# this is the Search::OpenSearch default setting
cache => CHI->new(
driver => 'File',
dir_create_mode => 0770,
file_create_mode => 0660,
root_dir => "/tmp/opensearch_cache",
),
# how long should the facet cache live
# each cache entry is per-unique-query
cache_ttl => 3600,
# explicitly turn off highlighting for some fields
do_not_hilite => { color => 1 },
# see Search::Tools::Snipper
snipper_config => { as_sentences => 1, strip_markup => 1, },
# see Search::Tools::HiLiter
hiliter_config => { class => 'h', tag => 'b' },
# see Search::Tools::QueryParser
parser_config => {},
# see Search::OpenSearch::Engine::Lucy
auto_commit => 1, # set to 0 to enable transactions with /commit and /rollback
}
});
DESCRIPTION
Dezi::Config parses configuration settings, applies default values, and instantiates component objects for Dezi::Server.
Mostly this class exists in order to document, in one location, all the options available for the Dezi server. You will rarely use Dezi::Config directly; it is intended as an internal class for use by Dezi::Server. Instead, your dezi_config.pl
file contents are parsed by Dezi::Config and applied to the server application.
The SYNOPSIS section provides all the default configuration values, with comments indicating where more complete documentation may be available for the relevant components. The rest of the documentation below is specific to this class and probably not what you're looking for as a Dezi user.
METHODS
new( hashref )
See the SYNOPSIS for a complete description of the keys/values supported in hashref.
The following hashref keys are also supported as accessor/mutator methods on the object returned from new():
search_path
index_path
commit_path
rollback_path
ui_path
admin_path
ui
admin
debug
base_uri
search_server
index_server
BUILD
Internal method called by new().
BUILDARGS
Internal method. Some convenient arg munging for new().
init_ui
Returns an instance of ui_class if set.
init_admin
Returns an instance of admin_class if set.
apply_default_engine_config( hashref )
Default Search::OpenSearch::Engine options are applied directly to hashref. This method is called internally by new().
authenticator
If username and password are passed to new(), the authenticator() method will return a CODE ref for passing to Plack::Middleware::Auth::Basic.
as_hash
Returns the object as a plain Perl hash of key/value pairs.
AUTHOR
Peter Karman, <karman at cpan.org>
BUGS
Please report any bugs or feature requests to bug-dezi at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Dezi. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Dezi::Config
You can also look for information at:
Website
IRC
#dezisearch at freenode
Mailing list
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
COPYRIGHT & LICENSE
Copyright 2012 Peter Karman.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
SEE ALSO
Search::OpenSearch, Search::Tools, SWISH::3, Dezi::App, Plack, Lucy