# Class JSearchApi

#### Hierarchy (View Summary)

- JBaseApi
  - JSearchApi

- Defined in jamespot-user-api/src/apis/search/search.ts:15

##### Index

### Constructors

constructor

### Properties

jApi
network

### Methods

getAdminConfig
getConfig
getLastQueries
proposition
searchQuery
setAdminConfig

## Constructors

### constructor

- new JSearchApi(jApi: JamespotUserApi): JSearchApi

  #### Parameters

  - jApi: JamespotUserApi

  #### Returns JSearchApi

  Inherited from JBaseApi.constructor

  - Defined in jamespot-user-api/src/apis/base.ts:8

## Properties

### jApi

jApi: JamespotUserApi

Inherited from JBaseApi.jApi

- Defined in jamespot-user-api/src/apis/base.ts:5

### network

network: Network

Inherited from JBaseApi.network

- Defined in jamespot-user-api/src/apis/base.ts:6

## Methods

### getAdminConfig

- getAdminConfig(): Promise<ApiWrapper<any, BaseMessages>>

  return the current platform json search-config object

  #### Returns Promise<ApiWrapper<any, BaseMessages>>

  - Defined in jamespot-user-api/src/apis/search/search.ts:86

### getConfig

- getConfig(): Promise<ApiWrapper<SearchConfig, BaseMessages>>

  return a completed version of the current config, taking in account platform installed modules

  #### Returns Promise<ApiWrapper<SearchConfig, BaseMessages>>

  - Defined in jamespot-user-api/src/apis/search/search.ts:19

### getLastQueries

- getLastQueries(): Promise<ApiWrapper<SearchLastQuery[], BaseMessages>>

  return the five last keywords typed in the searchbar by the user

  #### Returns Promise<ApiWrapper<SearchLastQuery[], BaseMessages>>

  - Defined in jamespot-user-api/src/apis/search/search.ts:77

### proposition

- proposition(
  query: { format?: "list" | "little"; query: string },
  signal?: AbortSignal,
  ): Promise<ApiWrapper<SearchResultCatProps[], BaseMessages>>

  Return a maximum of 8 results for a given text query, classed upon config categories

  #### Parameters

  - query: { format?: "list" | "little"; query: string }

    string, words can be preceded by + and - for inclusive/exclusive search

  - `Optional` signal: AbortSignal

  #### Returns Promise<ApiWrapper<SearchResultCatProps[], BaseMessages>>

  #### Abort Signal

  to cancel the fetch

  - Defined in jamespot-user-api/src/apis/search/search.ts:28

### searchQuery

- searchQuery(
  query: SearchQuery,
  params?: {
  formatExtension?: (
  | "comments"
  | "search"
  | "actions"
  | "attachments"
  | "contact"
  | "filebank"
  | "licenses"
  | "licensesExtrabot"
  | "messenger"
  | "filebankPath"
  | "parentArticle"
  | "quarantine"
  | "quizFieldDefinitions"
  | "quizResponseRecord"
  | "recurringEventRecord"
  | "socialEventRecord"
  | "surveyDateRecord"
  | "bookmark"
  )[];
  signal?: AbortSignal;
  },
  ): Promise<
  ApiWrapper<
  {
  categories: SearchCategoryValue[];
  count: number;
  facets: SearchFacetValueModel[];
  results: jObjectLittle[];
  start: number;
  },
  BaseMessages,
  >,
  >

  Return a page of results based on a text query and various filters. All parameters are optional

  #### Parameters

  - query: SearchQuery

    - ##### `Optional` category?: string

    - ##### `Optional` facetCategories?: boolean

    - ##### `Optional` facets?: SearchFacetModel[]

    - ##### `Optional` filters?: SearchQueryFilterModel[]

    - ##### `Optional` format?: FormatList

    - ##### `Optional` keywords?: string

    - ##### `Optional` limit?: number

    - ##### `Optional` options?: SearchQueryOption

    - ##### `Optional` page?: number

    - ##### `Optional` sort?: SearchQuerySortModel

  - `Optional` params: {
    formatExtension?: (
    | "comments"
    | "search"
    | "actions"
    | "attachments"
    | "contact"
    | "filebank"
    | "licenses"
    | "licensesExtrabot"
    | "messenger"
    | "filebankPath"
    | "parentArticle"
    | "quarantine"
    | "quizFieldDefinitions"
    | "quizResponseRecord"
    | "recurringEventRecord"
    | "socialEventRecord"
    | "surveyDateRecord"
    | "bookmark"
    )[];
    signal?: AbortSignal;
    }

  #### Returns Promise<
  ApiWrapper<
  {
  categories: SearchCategoryValue[];
  count: number;
  facets: SearchFacetValueModel[];
  results: jObjectLittle[];
  start: number;
  },
  BaseMessages,
  >,
  >

  #### Search Query Filter Model

  @SearchQueryFilterModel.

  #### Search Query Sort Model

  default score then date

  #### Abort Signal

  to cancel the fetch

  // Todo add query.facets (to be specified first)

  - Defined in jamespot-user-api/src/apis/search/search.ts:51

### setAdminConfig

- setAdminConfig(config: any): Promise<ApiWrapper<any, BaseMessages>>

  set the platform search-config to the given json object

  #### Parameters

  - config: any

    object. json search config

  #### Returns Promise<ApiWrapper<any, BaseMessages>>

  - Defined in jamespot-user-api/src/apis/search/search.ts:96