Hi Peter,
I am now trying to get a handle on using full dezi config file shown on
https://metacpan.org/pod/Dezi::Config .
Here is what I did:
1. %dezi --dezi-config
deziconfig.pl
I get the following error:
Error parsing
deziconfig.pl: Undefined subroutine &Dezi::Config called at
deziconfig.pl line 8.
at /home/user1/perl5/perlbrew/perls/perl-5.24.0/bin/dezi line 58.
2. Earlier in my simpler setting where dezi client ran ok, when I tried running ui in my browser, e.g.,
http://localhost:5000/ui , I get error: 'Resource not found'. May be this path '/ui' is not set as default and I need to spell it out in the config file!
3. One other question, what should I do in my dezi client script for executing a complex query that matches terms in different columns (something like a where clause in sql), e.g.: $query='field1:term1 AND field2:term2',
Or to do complete field/column match: equivalent to using regex like, $field1=~/^term1$/
Thank you much!
#
deziconfig.pl
---------------
#!/usr/bin/perl
use strict;
use warnings;
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( dezi.index )],
# which facets to calculate, and how many results to consider
facets => {
names => [qw( product type )],
sample_size => 10_000,
},
# result attributes in response
fields => [qw( product type )],
# 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 => 'product type',
# attributes to store
PropertyNames => 'product type',
# 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 => ".",
),
# 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
}
});