Dancer::SearchApp::IndexSchema - schema definition for the Elasticsearch index
Consider maybe extending this so different items (like Tweets, RSS) have different fields instead of mushing all metadata into the same schema
PUT /<index_name>/<type_name>/_mapping { "<type>": { "properties": { "title": { "type": "string", "fields": { "exact": { "type": "string", "index": "not_analyzed" }, "synonym": { "type": "string", "index": "analyzed", "analyzer": "synonym_analyzer" }, "stemmed": { "type": "string", "index": "analyzed", "analyzer": "stemming_analyzer" } } } } } }
And the following query should match as you wish :
POST /<index_name>/<type_name>/_search { "query": { "multi_match": { "query": "injury", "fields": [ "title.exact^3", "title.synonym^2", "title.stemmed" ] } } }
create_mapping
Defines a Dancer::SearchApp index. This is currently the following specification:
"properties" => { "url" => { type => "text" }, # file://-URL "title" => multilang_text('title',$analyzer), "author" => multilang_text('author', $analyzer), "content" => multilang_text('content',$analyzer), 'mime_type' => { type => "string" }, # text/html etc. "creation_date" => { "type" => "date", "format" => "yyyy-MM-dd HH:mm:ss", }, },
find_or_create_index
my $found = find_or_create_index( $es, $index_name, $lang, $type ); $found->then( sub { my( $name ) = @_; print "Using index '$name'\n"; });
Returns the full name for the index $index_name, concatenated with the language. The language is important to chose the correct stemmer. Existing indices will be cached in the package global variable %indices.
$index_name
%indices
The public repository of this module is https://github.com/Corion/dancer-searchapp.
The public support forum of this module is https://perlmonks.org/.
I've given a talk about this module at Perl conferences:
German Perl Workshop 2016, German
Please report bugs in this module via the RT CPAN bug queue at https://rt.cpan.org/Public/Dist/Display.html?Name=Dancer-SearchApp or via mail to dancer-searchapp-Bugs@rt.cpan.org.
Max Maischein corion@cpan.org
corion@cpan.org
Copyright 2014-2016 by Max Maischein corion@cpan.org.
This module is released under the same terms as Perl itself.
To install Dancer::SearchApp, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dancer::SearchApp
CPAN shell
perl -MCPAN -e shell install Dancer::SearchApp
For more information on module installation, please visit the detailed CPAN module installation guide.