Skip to content

Commit

Permalink
Merge pull request #3 from theonion/dumbquotes
Browse files Browse the repository at this point in the history
Adding elasticsearch char filter for transforming smart quotes into dumb ones
  • Loading branch information
Adam Wentz committed Mar 26, 2014
2 parents 78cc8d4 + 02158ae commit 2b4fc5b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions elastimorphic/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ def get_mapping(cls):
},
"properties": cls.get_mapping_properties(),
"dynamic": "strict",
"_all": {
"analyzer": "html"
}
}
}

Expand Down
15 changes: 14 additions & 1 deletion elastimorphic/conf/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,29 @@
"analyzer": {
"autocomplete": {
"type": "custom",
"char_filter": ["quotes"],
"tokenizer": "edge_ngram_tokenizer",
"filter": ["asciifolding", "lowercase"]
},
"html": {
"type": "custom",
"char_filter": ["html_strip"],
"char_filter": ["html_strip", "quotes"],
"tokenizer": "standard",
"filter": ["asciifolding", "lowercase", "stop", "snowball"]
}
},
"char_filter": {
"quotes": {
"mappings": [
"\u0091=>\u0027",
"\u0092=>\u0027",
"\u2018=>\u0027",
"\u2019=>\u0027",
"\uFF07=>\u0027"
],
"type": "mapping"
},
},
"tokenizer": {
"edge_ngram_tokenizer": {
"type": "edgeNGram",
Expand Down

0 comments on commit 2b4fc5b

Please sign in to comment.