| 1 |
<?php |
| 2 |
/** |
| 3 |
* Elasticsearch mapping for terms |
| 4 |
* |
| 5 |
* @since 3.1 |
| 6 |
* @package elasticpress |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; // Exit if accessed directly. |
| 11 |
} |
| 12 |
|
| 13 |
return [ |
| 14 |
'settings' => [ |
| 15 |
'index.mapping.total_fields.limit' => apply_filters( 'ep_term_total_field_limit', 5000 ), |
| 16 |
'index.max_result_window' => apply_filters( 'ep_term_max_result_window', 1000000 ), |
| 17 |
|
| 18 |
/** |
| 19 |
* Filter Elasticsearch term maximum shingle difference |
| 20 |
* |
| 21 |
* @hook ep_max_shingle_diff |
| 22 |
* @param {int} $number Max difference |
| 23 |
* @return {int} New number |
| 24 |
*/ |
| 25 |
'index.max_shingle_diff' => apply_filters( 'ep_term_max_shingle_diff', 8 ), |
| 26 |
|
| 27 |
'analysis' => [ |
| 28 |
'analyzer' => [ |
| 29 |
'default' => [ |
| 30 |
'tokenizer' => 'standard', |
| 31 |
/* This filter is documented in includes/mappings/post/7-0.php */ |
| 32 |
'filter' => apply_filters( 'ep_default_analyzer_filters', [ 'lowercase', 'ep_stop', 'ewp_snowball' ] ), |
| 33 |
/* This filter is documented in includes/mappings/post/7-0.php */ |
| 34 |
'language' => apply_filters( 'ep_analyzer_language', 'english', 'analyzer_default' ), |
| 35 |
], |
| 36 |
'default_search' => [ |
| 37 |
'tokenizer' => 'standard', |
| 38 |
/* This filter is documented in includes/mappings/post/7-0.php */ |
| 39 |
'filter' => apply_filters( 'ep_default_search_analyzer_filters', [ 'lowercase', 'ep_stop', 'ewp_snowball' ] ), |
| 40 |
/* This filter is documented in includes/mappings/post/7-0.php */ |
| 41 |
'char_filter' => apply_filters( 'ep_default_search_analyzer_char_filters', [ 'html_strip' ] ), |
| 42 |
/* This filter is documented above */ |
| 43 |
'language' => apply_filters( 'ep_analyzer_language', 'english', 'analyzer_default' ), |
| 44 |
], |
| 45 |
'shingle_analyzer' => [ |
| 46 |
'type' => 'custom', |
| 47 |
'tokenizer' => 'standard', |
| 48 |
'filter' => [ 'lowercase', 'shingle_filter' ], |
| 49 |
], |
| 50 |
'ewp_lowercase' => [ |
| 51 |
'type' => 'custom', |
| 52 |
'tokenizer' => 'keyword', |
| 53 |
'filter' => [ 'lowercase' ], |
| 54 |
], |
| 55 |
], |
| 56 |
'filter' => [ |
| 57 |
'shingle_filter' => [ |
| 58 |
'type' => 'shingle', |
| 59 |
'min_shingle_size' => 2, |
| 60 |
'max_shingle_size' => 5, |
| 61 |
], |
| 62 |
'ewp_snowball' => [ |
| 63 |
'type' => 'snowball', |
| 64 |
/* This filter is documented in includes/mappings/post/7-0.php */ |
| 65 |
'language' => apply_filters( 'ep_analyzer_language', 'english', 'filter_ewp_snowball' ), |
| 66 |
], |
| 67 |
'edge_ngram' => [ |
| 68 |
'side' => 'front', |
| 69 |
'max_gram' => 10, |
| 70 |
'min_gram' => 3, |
| 71 |
'type' => 'edge_ngram', |
| 72 |
], |
| 73 |
'ep_stop' => [ |
| 74 |
'type' => 'stop', |
| 75 |
'ignore_case' => true, |
| 76 |
/* This filter is documented in includes/mappings/post/7-0.php */ |
| 77 |
'stopwords' => apply_filters( 'ep_analyzer_language', 'english', 'filter_ep_stop' ), |
| 78 |
], |
| 79 |
], |
| 80 |
'normalizer' => [ |
| 81 |
'lowerasciinormalizer' => [ |
| 82 |
'type' => 'custom', |
| 83 |
'filter' => [ 'lowercase', 'asciifolding' ], |
| 84 |
], |
| 85 |
], |
| 86 |
], |
| 87 |
], |
| 88 |
'mappings' => [ |
| 89 |
'date_detection' => false, |
| 90 |
'dynamic_templates' => [ |
| 91 |
[ |
| 92 |
'template_meta_types' => [ |
| 93 |
'path_match' => 'meta.*', |
| 94 |
'mapping' => [ |
| 95 |
'type' => 'object', |
| 96 |
'properties' => [ |
| 97 |
'value' => [ |
| 98 |
'type' => 'text', |
| 99 |
'fields' => [ |
| 100 |
'sortable' => [ |
| 101 |
'type' => 'keyword', |
| 102 |
'ignore_above' => 10922, |
| 103 |
'normalizer' => 'lowerasciinormalizer', |
| 104 |
], |
| 105 |
'raw' => [ |
| 106 |
'type' => 'keyword', |
| 107 |
'ignore_above' => 10922, |
| 108 |
], |
| 109 |
], |
| 110 |
], |
| 111 |
'raw' => [ /* Left for backwards compat */ |
| 112 |
'type' => 'keyword', |
| 113 |
'ignore_above' => 10922, |
| 114 |
], |
| 115 |
'long' => [ |
| 116 |
'type' => 'long', |
| 117 |
], |
| 118 |
'double' => [ |
| 119 |
'type' => 'double', |
| 120 |
], |
| 121 |
'boolean' => [ |
| 122 |
'type' => 'boolean', |
| 123 |
], |
| 124 |
'date' => [ |
| 125 |
'type' => 'date', |
| 126 |
'format' => 'yyyy-MM-dd', |
| 127 |
], |
| 128 |
'datetime' => [ |
| 129 |
'type' => 'date', |
| 130 |
'format' => 'yyyy-MM-dd HH:mm:ss', |
| 131 |
], |
| 132 |
'time' => [ |
| 133 |
'type' => 'date', |
| 134 |
'format' => 'HH:mm:ss', |
| 135 |
], |
| 136 |
], |
| 137 |
], |
| 138 |
], |
| 139 |
], |
| 140 |
], |
| 141 |
|
| 142 |
'properties' => [ |
| 143 |
'term_id' => [ |
| 144 |
'type' => 'long', |
| 145 |
], |
| 146 |
'ID' => [ |
| 147 |
'type' => 'long', |
| 148 |
], |
| 149 |
'name' => [ |
| 150 |
'type' => 'text', |
| 151 |
'fields' => [ |
| 152 |
'name' => [ |
| 153 |
'type' => 'text', |
| 154 |
], |
| 155 |
'sortable' => [ |
| 156 |
'type' => 'keyword', |
| 157 |
'ignore_above' => 10922, |
| 158 |
'normalizer' => 'lowerasciinormalizer', |
| 159 |
], |
| 160 |
'raw' => [ |
| 161 |
'type' => 'keyword', |
| 162 |
'ignore_above' => 10922, |
| 163 |
], |
| 164 |
], |
| 165 |
], |
| 166 |
'slug' => [ |
| 167 |
'type' => 'text', |
| 168 |
'fields' => [ |
| 169 |
'name' => [ |
| 170 |
'type' => 'text', |
| 171 |
], |
| 172 |
'raw' => [ |
| 173 |
'type' => 'keyword', |
| 174 |
'ignore_above' => 10922, |
| 175 |
], |
| 176 |
], |
| 177 |
], |
| 178 |
'term_group' => [ |
| 179 |
'type' => 'long', |
| 180 |
], |
| 181 |
'term_taxonomy_id' => [ |
| 182 |
'type' => 'long', |
| 183 |
], |
| 184 |
'taxonomy' => [ |
| 185 |
'type' => 'text', |
| 186 |
'fields' => [ |
| 187 |
'description' => [ |
| 188 |
'type' => 'text', |
| 189 |
], |
| 190 |
'raw' => [ |
| 191 |
'type' => 'keyword', |
| 192 |
'ignore_above' => 10922, |
| 193 |
], |
| 194 |
], |
| 195 |
], |
| 196 |
'description' => [ |
| 197 |
'type' => 'text', |
| 198 |
'fields' => [ |
| 199 |
'description' => [ |
| 200 |
'type' => 'text', |
| 201 |
], |
| 202 |
'sortable' => [ |
| 203 |
'type' => 'keyword', |
| 204 |
'ignore_above' => 10922, |
| 205 |
'normalizer' => 'lowerasciinormalizer', |
| 206 |
], |
| 207 |
'raw' => [ |
| 208 |
'type' => 'keyword', |
| 209 |
'ignore_above' => 10922, |
| 210 |
], |
| 211 |
], |
| 212 |
], |
| 213 |
'parent' => [ |
| 214 |
'type' => 'long', |
| 215 |
], |
| 216 |
'count' => [ |
| 217 |
'type' => 'long', |
| 218 |
], |
| 219 |
'meta' => [ |
| 220 |
'type' => 'object', |
| 221 |
], |
| 222 |
'hierarchy' => [ |
| 223 |
'type' => 'object', |
| 224 |
], |
| 225 |
'object_ids' => [ |
| 226 |
'type' => 'object', |
| 227 |
], |
| 228 |
], |
| 229 |
], |
| 230 |
]; |
| 231 |
|