Skip to content

Commit

Permalink
Merge cd93e06 into f339363
Browse files Browse the repository at this point in the history
  • Loading branch information
fbeaudoincoveo committed Mar 21, 2017
2 parents f339363 + cd93e06 commit 0684ed1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 20 deletions.
20 changes: 15 additions & 5 deletions src/rest/RangeValue.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
/**
* Describe a single rangle value in a group by
* The IRangeValue interface describes a single range of values in a group by clause.
*/
export interface IRangeValue {

/**
* Start of the range.
* Specifies the start of the range.
*
* E.g., `0`
*/
start?: any;

/**
* End of the range
* Specifies the end of the range.
*
* E.g., `500`
*/
end?: any;

/**
* Label to generate for this range
* Specifies the label to generate for this range.
*
* E.g., `0 - 500`
*/
label?: string;

/**
* Is the end parameter included or excluded in this range.
* Specifies whether to include the value of the [end]{@link IRangeValue.end} property in this range.
*/
endInclusive?: boolean;
}
33 changes: 18 additions & 15 deletions src/ui/FacetRange/FacetRange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export interface IFacetRangeOptions extends IFacetOptions {
* from the results of the current query.
*
* This component inherits from the Facet component. Thus, any option available for a Facet component is also available
* for a FacetRange component.
* for a FacetRange component. This also implies that you must specify a [field]{@link Facet.options.field} value for
* this component to work.
*/
export class FacetRange extends Facet implements IComponentBindings {
static ID = 'FacetRange';
Expand All @@ -34,7 +35,7 @@ export class FacetRange extends Facet implements IComponentBindings {
static options: IFacetRangeOptions = {

/**
* Specifies whether the field for which you require a range is a date field.
* Specifies whether the field for which you require ranges is a date field.
*
* This allows the component to correctly build the outgoing {@link IGroupByRequest}.
*
Expand All @@ -51,39 +52,41 @@ export class FacetRange extends Facet implements IComponentBindings {
* **Example:**
*
* ```javascript
* var myRanges = [{
* var myRanges = [
* {
* start: 0,
* end: 100,
* label: "0 - 100",
* endInclusive: false
* }, {
* },
* {
* start: 100,
* end: 200,
* label: "100 - 200",
* endInclusive: false
* }, {
* },
* {
* start: 200,
* end: 300,
* label: "200 - 300",
* endInclusive: false
* }]
*
* // You can call the init script using "pure" JavaScript:
* Coveo.init(document.querySelector('#search'), {
* FacetRange : {
* ranges : myRanges
* }
* })
* ]
*
* // Or you can call the init script using the jQuery extension:
* $("#search").coveo("init", {
* Coveo.init(document.querySelector('#search'), {
* FacetRange : {
* ranges : myRanges
* }
* })
* ```
*
* Default value is `null` and the index will automatically generate ranges.
* **Note:**
* > Ranges can overlap.
*
* By default, the index automatically generates the ranges. However, the index cannot automatically generate the
* ranges if the [field]{@link Facet.options.field} you specify for the FacetRange component is generated by a query
* function (see [Query Function](https://developers.coveo.com/x/XQCq)). When this is the case, you must specify the
* ranges at query time.
*/
ranges: ComponentOptions.buildCustomOption<IRangeValue[]>(() => {
return null;
Expand Down

0 comments on commit 0684ed1

Please sign in to comment.