Skip to content

Class: SearchBuilder

The SearchBuilder is an API for building OData Search options.

Hierarchy

Implements

  • IBuilder
  • IDebuggable
  • IDebuggable

Summary

Constructors

Properties

Class Properties

Currently none in this class.

Inherited Properties

Accessors

Class Accessors

Inherited Accessors

Methods

Class Methods

Inherited Methods

Constructors

constructor

+ new SearchBuilder(context: IContext, ...terms: SearchBuilder[] | string[]): SearchBuilder

Overrides void

Parameters:

Name Type
context IContext
...terms SearchBuilder[] | string[]

Returns: SearchBuilder

Accessors

terms

getter

Returns: ISearchTerm[]

Methods

and

and(...terms: SearchBuilder[] | string[]): this

The OData and operator is added to the search option by invoking the SearchBuilder and API.

example

searchBuilder.and("PriorityType:PM");
or
const searchTerm = new SearchBuilder({}, "PriorityType:PM");
searchBuilder.and(searchTerm);

This API takes a varying number of arguments of either SearchBuilder or string.

Parameters:

Name Type Description
...terms SearchBuilder[] | string[] A comma-separated list of SearchBuilder or string.

Returns: this

Returns a SearchBuilder instance for chaining.


build

build(): Promise‹any›

Overrides void

Asynchronously build the search string based on all added SearchItems.

Returns: Promise‹any›

Returns a Promise with the search string.


Protected createSearchTerm

createSearchTerm(term: any): string

Create the search string for a specific SearchItem.

Parameters:

Name Type Description
term any The search item.

Returns: string

Returns a search string.


not

not(...terms: SearchBuilder[] | string[]): this

The OData not operator is added to the search option by invoking the SearchBuilder and API.

example

searchBuilder.not("Ahthor");
or
const searchTerm = new SearchBuilder({}, "Ahthor");
searchBuilder.not(searchTerm);

This API take a varying number arguments of SearchBuilder or string.

Parameters:

Name Type Description
...terms SearchBuilder[] | string[] a comma-separated list of SearchBuilder or string.

Returns: this

return a SearchBuilder instance for chaining


or

or(...terms: SearchBuilder[] | string[]): this

The OData or operator is added to the search option by invoking the SearchBuilder or API.

example

searchBuilder.or("PriorityType:PM");
or
const searchTerm = new SearchBuilder({}, "PriorityType:PM");
searchBuilder.or(searchTerm);

This API takes a varying number of arguments of either SearchBuilder or string.

Parameters:

Name Type Description
...terms SearchBuilder[] | string[] A comma-separated list of SearchBuilder or string.

Returns: this

Returns a SearchBuilder instance for chaining.