category export class SearchFacet { protected _data : any ; constructor ( data ) { if ( ! data ) { data = { } ; } this . _data = data ; } toJSON ( ) { return this . _data ; } static term ( field , size ) { return new TermSearchFacet ( field , size ) ; } static numeric ( field , size ) { return new NumericSearchFacet ( field , size ) ; } static date ( field , size ) { return new DateSearchFacet ( field , size ) ; } } category export class TermSearchFacet extends SearchFacet { internal constructor ( field , size ) { super ( { field : field , size : size , } ) ; } } category export class NumericSearchFacet extends SearchFacet { internal constructor ( field , size ) { super ( { field : field , size : size , numeric_ranges : [ ] , } ) ; } addRange ( name , min ? , max ? ) { this . _data . numeric_ranges . push ( { name : name , min : min , max : max , } ) ; return this ; } } category export class DateSearchFacet extends SearchFacet { internal constructor ( field , size ) { super ( { field : field , size : size , date_ranges : [ ] , } ) ; } addRange ( name , start ? , end ? ) { this . _data . date_ranges . push ( { name : name , start : start , end : end , } ) ; return this ; } }