Pick one of a set of named result orderings.
(self)
| 203 | return aggregations |
| 204 | |
| 205 | def get_sort(self): |
| 206 | """Pick one of a set of named result orderings.""" |
| 207 | if not len(self.parser.sorts): |
| 208 | return self.SORT_DEFAULT |
| 209 | |
| 210 | sort_fields = ["_score"] |
| 211 | for field, direction in self.parser.sorts: |
| 212 | field = self.SORT_FIELDS.get(field, field) |
| 213 | type_ = get_field_type(field) |
| 214 | config = {"order": direction, "missing": "_last"} |
| 215 | es_type = get_index_field_type(type_) |
| 216 | if es_type: |
| 217 | config["unmapped_type"] = es_type |
| 218 | if field == registry.date.group: |
| 219 | field = "numeric.dates" |
| 220 | config["mode"] = "min" |
| 221 | if type_ in NUMERIC_TYPES: |
| 222 | field = field.replace("properties.", "numeric.") |
| 223 | sort_fields.append({field: config}) |
| 224 | return list(reversed(sort_fields)) |
| 225 | |
| 226 | def get_highlight(self): |
| 227 | if not self.parser.highlight: |
no test coverage detected