Skip to content

Commit

Permalink
DOC-458 DidYouMean documentation revision (#363)
Browse files Browse the repository at this point in the history
  • Loading branch information
fbeaudoincoveo authored and olamothe committed Feb 15, 2017
1 parent b84c5c8 commit 0b02b6e
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/ui/DidYouMean/DidYouMean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,24 @@ export interface IDidYouMeanOptions {
}

/**
* This component is responsible for displaying query corrections. If this component is in the page
* and the query returns no results, but finds a possible query correction, the component either
* suggests the correction or automatically triggers a new query with the suggested term.
* The DidYouMean component is responsible for displaying query corrections. If this component is in the page and the
* query returns no result but finds a possible query correction, the component either suggests the correction or
* automatically triggers a new query with the suggested term.
*/
export class DidYouMean extends Component {
static ID = 'DidYouMean';

/**
* The options for the component
* @componentOptions
*/
static options: IDidYouMeanOptions = {

/**
* This option allows the `DidYouMean` component to automatically trigger a new query
* when there are no results and a correction is available.<br/>
* The default value is <code>true</code>.
* Specifies whether the DidYouMean component automatically triggers a new query when a query returns no result and
* a possible correction is available.
*
* Default value is `true`.
*/
enableAutoCorrection: ComponentOptions.buildBooleanOption({ defaultValue: true }),
};
Expand All @@ -42,10 +45,11 @@ export class DidYouMean extends Component {
private hideNext: boolean;

/**
* Create a new DidYouMean component
* @param element
* @param options
* @param bindings
* Creates a new DidYouMean component.
* @param element The HTMLElement on which to instantiate the component.
* @param options The options for the DidYouMean component.
* @param bindings The bindings that the component requires to function normally. If not set, these will be
* automatically resolved (with a slower execution time).
*/
constructor(public element: HTMLElement, public options?: IDidYouMeanOptions, public bindings?: IComponentBindings) {

Expand All @@ -67,8 +71,9 @@ export class DidYouMean extends Component {
}

/**
* Execute a query with the corrected term. <br/>
* Will throw an exception if the corrected term has not been initialized.
* Executes a query with the corrected term.
* Throws an exception if the corrected term has not been initialized.
* If successful, logs a `didyoumeanClick` event in the usage analytics.
*/
public doQueryWithCorrectedTerm() {
Assert.exists(this.correctedTerm);
Expand Down

0 comments on commit 0b02b6e

Please sign in to comment.