category export class SearchSort { protected _data : any ; constructor ( data ) { if ( ! data ) { data = { } ; } this . _data = data ; } toJSON ( ) { return this . _data ; } static score ( ) { return new ScoreSearchSort ( ) ; } static id ( ) { return new IdSearchSort ( ) ; } static field ( field ) { return new FieldSearchSort ( field ) ; } static geoDistance ( field , lat , lon ) { return new GeoDistanceSearchSort ( field , lat , lon ) ; } } category export class ScoreSearchSort extends SearchSort { internal constructor ( ) { super ( { by : 'score' , } ) ; } descending ( descending ) { this . _data . desc = descending ; return this ; } } category export class IdSearchSort extends SearchSort { internal constructor ( ) { super ( { by : 'id' , } ) ; } descending ( descending ) { this . _data . desc = descending ; return this ; } } category export class FieldSearchSort extends SearchSort { internal constructor ( field ) { super ( { by : 'field' , field : field , } ) ; } type ( type ) { this . _data . type = type ; return this ; } mode ( mode ) { this . _data . mode = mode ; return this ; } missing ( missing ) { this . _data . missing = missing ; return this ; } descending ( descending ) { this . _data . desc = descending ; return this ; } } category export class GeoDistanceSearchSort extends SearchSort { internal constructor ( field , lat , lon ) { super ( { by : 'geo_distance' , field : field , location : [ lon , lat ] , } ) ; } unit ( unit ) { this . _data . unit = unit ; return this ; } descending ( descending ) { this . _data . desc = descending ; return this ; } }