MCPcopy Create free account
hub / github.com/alephdata/aleph / get_sort

Method get_sort

aleph/search/query.py:205–224  ·  view source on GitHub ↗

Pick one of a set of named result orderings.

(self)

Source from the content-addressed store, hash-verified

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:

Callers 1

get_bodyMethod · 0.95

Calls 3

get_field_typeFunction · 0.90
get_index_field_typeFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected