Permalink
Browse files

Added a custom analyzer for "content" (ngrams, word delimiter)

  • Loading branch information...
1 parent 85a78a2 commit 66a3f0b5844e158938e35959187d52ae45cb948d @clintongormley clintongormley committed with Sep 10, 2012
Showing with 24 additions and 8 deletions.
  1. +24 −8 config.example.rb
View
@@ -7,17 +7,33 @@ module Hide
:directories => ['guide', 'community', 'tutorials', 'videos'],
:index_name => 'elastic-search-website',
- :mappings => {
+ :settings => {
+ :analysis => {
+ :filter => {
+ :ngrams => {:type => 'edgeNGram', :max_gram => 30},
+ :word_delim => {:type => 'word_delimiter', :preserve_original => 1},
+ },
+ :analyzer => {
+ :content => {
+ :filter => ['standard','lowercase','word_delim','ngrams'],
+ :type => 'custom',
+ :tokenizer => 'standard'
+ }
+ }
+ }
+ },
+
+ :mappings => {
:guide => {
:properties => {
- :title => { :type => 'string', :boost => 2.0, :analyzer => 'snowball' },
- :content => { :type => 'string', :analyzer => 'snowball' },
- :id => { :type => 'string', :index => 'not_analyzed', :include_in_all => false },
- :url => { :type => 'string', :index => 'not_analyzed', :include_in_all => false },
- :category => { :type => 'string', :analyzer => 'keyword', :include_in_all => false },
-
+ :title => { :type => 'string', :boost => 2.0, :analyzer => 'content' },
+ :content => { :type => 'string', :analyzer => 'content' },
+ :id => { :type => 'string', :index => 'not_analyzed', :include_in_all => false },
+ :url => { :type => 'string', :index => 'not_analyzed', :include_in_all => false },
+ :category => { :type => 'string', :analyzer => 'keyword', :include_in_all => false },
+
},
- :_all => { :analyzer => 'snowball' }
+ :_all => { :analyzer => 'content' }
}
},

0 comments on commit 66a3f0b

Please sign in to comment.