Make sort options configurable. Closes #3125

This commit is contained in:
Rashid Khan 2015-06-02 09:42:52 -07:00
parent 9ff7304018
commit 83d8e3688e
2 changed files with 7 additions and 5 deletions

View file

@ -8,6 +8,11 @@ define(function () {
description: 'Options for the lucene query string parser',
type: 'json'
},
'sort:options': {
value: '{ "unmapped_type": "boolean" }',
description: 'Options the Elasticsearch sort parameter',
type: 'json'
},
'dateFormat': {
value: 'MMMM Do YYYY, HH:mm:ss.SSS',
description: 'When displaying a pretty formatted date, use this format',

View file

@ -1,6 +1,6 @@
define(function (require) {
var _ = require('lodash');
return function normalizeSortRequest() {
return function normalizeSortRequest(config) {
/**
* Decorate queries with default parameters
* @param {query} query object
@ -8,10 +8,7 @@ define(function (require) {
*/
return function (sortObject) {
if (!_.isArray(sortObject)) sortObject = [sortObject];
var defaultSortOptions = {
// Will cause indices missing the field to use null as sort.
unmapped_type: 'boolean'
};
var defaultSortOptions = config.get('sort:options');
/*
Normalize the sort description to the more verbose format: