UNPKG

feathers-solr

Version:

A Feathers service adapter for Solr

76 lines (75 loc) 3.15 kB
import { AdapterBase, AdapterParams, AdapterServiceOptions, PaginationOptions, AdapterQuery } from '@feathersjs/adapter-commons'; import type { NullableId, Id, Paginated } from '@feathersjs/feathers'; import type { HttpClient, RequestOptions } from './httpClient'; export interface SolrAdapterOptions extends AdapterServiceOptions { host: string; core: string; commit?: { softCommit?: boolean; commitWithin?: number; overwrite?: boolean; }; queryHandler?: string; updateHandler?: string; defaultSearch?: any; defaultParams?: any; createUUID?: boolean; requestOptions?: RequestOptions['requestOptions']; escapeFn?: (key: string, value: any) => { key: string; value: any; }; logger?: (msg: any) => any; } export type SolrAdapterParams<Q = AdapterQuery> = AdapterParams<Q, Partial<SolrAdapterOptions>>; type SolrQueryParams = {}; type SolrQueryFacet = {}; export interface SolrQuery { query: string; fields: string; limit: number; offset: number; sort?: string; filter?: string[]; params?: SolrQueryParams; facet?: SolrQueryFacet; } export declare class SolrAdapter<Result, Data = Partial<Result>, ServiceParams extends SolrAdapterParams<any> = SolrAdapterParams, PatchData = Partial<Data>> extends AdapterBase<Result, Data, PatchData, ServiceParams, SolrAdapterOptions> { client: HttpClient; queryHandler: string; updateHandler: string; constructor(options: SolrAdapterOptions); filterQuery(id: NullableId | Id, params: ServiceParams): { query: { params: any; facet: any; sort: any; query: any; fields: any; limit: any; offset: any; filter: any[]; }; paginate: import("@feathersjs/adapter-commons").PaginationParams; }; _getOrFind(id: NullableId | NullableId, params: ServiceParams): Promise<Result | Paginated<Result> | Result[]>; _get(id: Id | NullableId, params?: ServiceParams): Promise<Result>; _find(params?: ServiceParams & { paginate?: PaginationOptions; }): Promise<Paginated<Result>>; _find(params?: ServiceParams & { paginate: false; }): Promise<Result[]>; _find(params?: ServiceParams): Promise<Paginated<Result> | Result[]>; _create(data: Data, params?: ServiceParams): Promise<Result>; _create(data: Data[], params?: ServiceParams): Promise<Result[]>; _create(data: Data | Data[], _params?: ServiceParams): Promise<Result | Result[]>; _patch(id: null, data: PatchData, params?: ServiceParams): Promise<Result[]>; _patch(id: NullableId, data: PatchData, params?: ServiceParams): Promise<Result>; _patch(id: NullableId, data: PatchData, _params?: ServiceParams): Promise<Result | Result[]>; _update(id: NullableId, data: Data, params?: ServiceParams): Promise<Result>; _remove(id: null, params?: ServiceParams): Promise<Result[]>; _remove(id: NullableId, params?: ServiceParams): Promise<Result>; _remove(id: NullableId, _params?: ServiceParams): Promise<Result | Result[]>; } export {};