@lableb/javascript-sdk
Version:
Lableb cloud search client for javascript
48 lines (47 loc) • 1.56 kB
TypeScript
import { BaseRequestParams, BuildRequestResult } from "../../types";
export interface SelectedFacets {
[]: string[];
}
export interface SearchRequestParams extends BaseRequestParams {
/**
* your search API Key copied from [Lableb Dashboard](https://dashboard.lableb.com)
*/
APIKey?: string;
/**
* the used search handler for the search function
*/
searchHandler?: string;
/** usually your end users query */
query: string;
/** number of documents to skip, used for paginated data */
skip?: number;
/** limit your search results to some number */
limit?: number;
/**
* You type the field name followed by the `asc` or `desc` to sort data by that field in an ascending or descending order respectively.
*
*
* ```js
* sort: "date desc"
* ```
*/
sort?: string;
/**
* Facets enable easy filtering throughout your data, say for example that your data has tags in them(where each document(data) can have one to many tags in it).
*
* To quickly filter the documents for the tags `brilliant` and `great` you can send a facet object that contains both values
*
* ```js
* facets: {
* tags: ['brilliant', 'great']
* }
* ```
*/
facets?: SelectedFacets;
}
export interface SearchRequestResult extends BuildRequestResult {
params: Omit<SearchRequestParams, "platformName" | "APIKey" | "indexName" | "searchHandler" | "query"> & {
q: string;
apikey?: string;
};
}