Type parameters

  • F: ApplicationFilterClosure<T>

Hierarchy

Methods

all

  • The method returns a search results page with the number of results equal to Search.size, beginning with Search.from.

    By default, the number of search results is 10. If you need more items, use the Search.size method.

    const searchResults = await  Application.search()
        .where((f, g) => g.and ( 
            f.__deletedAt. eq(null), 
            f.service.link(Context.data.service) 
        )) 
        .all();  
    

    Returns Promise<SignProviderItem[]>

count

  • count(): Promise<number>
  • The method allows you to get the number of results in the search (it ignores Search.from and Search.size).

    const searchResults = await Application.search()
       .where(( f, g) => g.and ( 
           f.__deletedAt.eq(null), 
           f.service. link(Context.data.service) 
       )) 
       .count(); 
    

    Returns Promise<number>

first

  • The method returns the first item among the search results.

    const searchResults = await Application.search()
       .where(( f, g) => g.and ( 
           f.__deletedAt.eq(null), 
           f.service. link(Context.data.service) 
       )) 
       .first(); 
    

    Returns Promise<SignProviderItem | undefined>

from

  • from(n: number): this
  • The Search.from method allows you to skip a specified number of results.

    Parameters

    • n: number

      Number of app items to skip. For example, when you work with a large amount of items, you can split results into chunks and define which item the search needs to begin with in a dynamic way.

      Context.data.from += 100;
      const searchResults = await Application.search()  
          .from(Context.data.from) 
          .where((f, g) => g.and ( 
              f. __deletedAt.eq(null), 
              f.service.link(Context.data.service) 
          ))  
          .all(); 
      

    Returns this

size

  • size(n: number): this
  • The method is used to limit the number of returned search results.

    Parameters

    • n: number

      Number of search results displayed (the default value is 10, the maximum is 10000).

      const searchResults = await Application.search()
          .size(500) 
          .where((f, g) => g.and ( 
              f.__deletedAt.eq(null) , 
              f.service.link(Context.data.service) 
          )) 
          .all(); 
      

    Returns this

sort

  • sort(field: keyof SignProvider, ascending?: undefined | false | true): this
  • The method is used to sort search results.

    If the results need to be sorted by different parameters, you can call the method sequentially several times.

    Parameters

    • field: keyof SignProvider

      Code of the field that sorting is based on.

    • Optional ascending: undefined | false | true

      If the parameter’s value is true, the sorting is in ascending order. If it is false, the sorting is in descending order.

      const  searchResults = await Application.search()
          .size(500) 
          .sort( '__createdAt', true) 
          .where((f, g) => g.and ( 
              f.__deletedAt. eq(null), 
              f.service.link(Context.data.service) 
          )) 
          .all();  
      

    Returns this

where

  • where(fc: F): this
  • where(eql: EqlQuery, params?: EqlParams): this
  • The Search.where method is used to set a filter for items in the collection.

    Parameters

    • fc: F

      Search filters.

      const searchResults = await Application. search()
          .where((f, g) => g.and ( 
              f.__deletedAt.eq(null),  
              f.service.link(Context.data.service) 
          )) 
          .all(); 
      

    Returns this

  • The Search.where method is used to set a filter for items in the collection.

    Parameters

    • eql: EqlQuery

      EQL expression for search.

      const searchResults = await  Application.search()
      .where(`[__id] = '66358eab-54cf-4591-86ba- 34b83739c13f'`) 
      .first(); 
      

      EQL expression with search parameters:

      const searchResults = await Application.search()
      .where(`[__id]  = @p1 or [__name] = @p2`, {p1: '66358eab-54cf-4591-86ba-34b83739c13f', p2:  'app1'}) 
      .first(); 
      
    • Optional params: EqlParams

    Returns this