3.0.0 • Published 2 years ago
@findkit/fetch v3.0.0
Findkit Fetch
Low level read-only API for Findkit indices used by @valu/react-valu-search.
Install
npm install @findkit/fetch
In browsers it uses the native fetch()
but in Node.js you must provide it from
node-fetch and set it as global.
Usage
import { findkitFetch } from "@findkit/fetch";
// Returns SearchResponse[]
const responses = await findkitFetch({
// See FindkitFetchOptions below for more details
customer: "wikipedia",
terms: "genie",
apiKey: "your-api-key-here", // Contact your Findkit provider for api key
groups: [
{
tagQuery: [],
size: 10,
from: 0,
},
],
});
Each group will add a SearchResponse
object to the resolved array. The array
order will correspond with the groups order.
API
findkitFetch()
takes FindkitFetchOptions
as request params and returns
Promise<SearchResponse[]>
.
function findkitFetch(params: FindkitFetchOptions): Promise<SearchResponse[]>;
interface FindkitFetchOptions {
terms: string;
groups: SearchGroupParams[];
customer?: string;
searchEndpoint?: string;
apiKey: string;
staging?: boolean;
logResponseTimes?: boolean;
}
interface SearchGroupParams {
tagQuery: string[][];
createdDecay?: number;
modifiedDecay?: number;
decayScale?: string;
highlightLength?: number;
size: number;
from: number;
lang?: string;
}
interface SearchResponse {
total: number;
duration?: number;
hits: {
score: number;
title: string;
language: string;
url: string;
domain: string;
created: string;
modified: string;
highlight: string;
tags: string[];
customFields: CustomFields;
}[];
}
type CustomFields = {
[customField: string]:
| { type: "date"; value: string }
| { type: "keyword"; value: string }
| { type: "number"; value: number }
| undefined;
};
2.0.0-dev.4e47618ef3
2 years ago
2.0.0-dev.0ae960b522
2 years ago
2.0.0-dev.eef0c2d586
2 years ago
3.0.0
2 years ago
2.0.0-dev.9ed04b04e5
2 years ago
2.0.0-dev.6f6a1c6044
2 years ago
2.0.0-dev.e357e4cb34
2 years ago
3.0.0-dev.c7cdbef62d
2 years ago
2.0.0-dev.9431f37717
2 years ago
2.0.0-dev.751ece779c
2 years ago
2.0.0-dev.372c0f246a
2 years ago
2.0.0-dev.35344ae15e
3 years ago
2.0.0-dev.ee14ffb5a3
3 years ago
2.0.0-dev.6f4e684575
3 years ago
2.0.0-dev.6e8a823f08
3 years ago
2.0.0-dev.8b844dfc8b
3 years ago
1.1.0
3 years ago
1.0.3-dev.562b59ae98
3 years ago
1.0.2
3 years ago
1.0.3
3 years ago
1.0.1
4 years ago
1.0.0
4 years ago