ApplicationSearchWithProjection

App item search object with a limited set of fields

Read more about search in Search. The first() и all() methods return results considering rules for partial loading of fields.

Type parameters

Hierarchy

  • ApplicationSearchWithProjection

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<ProjectedApplicationItem<T, P, S>[]>

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<ProjectedApplicationItem<T, P, S> | undefined>

from

size

  • The method is used to limit the number of returned search results.

    Parameters

    • n: number

    Returns ApplicationSearchWithProjection<T, P, S>

sort

  • 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 T
    • Optional ascend: undefined | false | true

    Returns ApplicationSearchWithProjection<T, P, S>

where

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

    Parameters

    • fc: ApplicationFilterClosure<T>

    Returns ApplicationSearchWithProjection<T, P, S>

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

    Parameters

    • eql: EqlQuery
    • Optional params: EqlParams

    Returns ApplicationSearchWithProjection<T, P, S>