import { Query } from './query'; import { Collection } from './collection'; import { CommonResponse, JsonResponseData, SearchResponse, SolrClientParams } from './types'; import * as format from './utils/format'; export declare function createClient(options?: SolrClientParams): Client; export declare function resolvePort(options: SolrClientParams): string | number; /** * Solr client. */ export declare class Client { private readonly options; private readonly UPDATE_JSON_HANDLER; private readonly UPDATE_HANDLER; private readonly TERMS_HANDLER; private readonly SPELL_HANDLER; private readonly REAL_TIME_GET_HANDLER; private readonly ADMIN_PING_HANDLER; private readonly COLLECTIONS_HANDLER; private readonly SELECT_HANDLER; private url; constructor(options?: SolrClientParams); get solrVersion(): number; /** * Construct the full path to the given "handler". * * @param handler * Relative URL path for the solr handler. * * @returns * Full URL to the handler. */ private getFullHandlerPath; /** * Common function for all HTTP requests. * * @param path * Full URL for the request. * @param method * HTTP method, like "GET" or "POST". * @param body * Optional data for the request body. * @param bodyContentType * Optional content type for the request body. * @param acceptContentType * The expected content type of the response. * * @returns * Parsed JSON response data. */ private doRequest; /** * Create credential using the basic access authentication method */ basicAuth(username: string, password: string): Client; /** * Remove authorization header */ unauth(): Client; /** * Get a document by id or a list of documents by ids using the Real-time-get feature * in SOLR4 (https://wiki.apache.org/solr/RealTimeGet) * * @param ids * ID or list of IDs that identify the documents to get. * @param query */ realTimeGet(ids: string | string[], query?: Query | Record | string): Promise>; /** * Search documents matching the `query` */ search(query: Query | Record | string): Promise>; /** * Execute an Admin Collections task on `collection` */ executeCollection(collection: Collection | Record | string): Promise; /** * Search for all documents. */ searchAll(): Promise; /** * Search documents matching the `query`, with spellchecking enabled. */ spell(query: Query): Promise; /** * Terms search. * * Provides access to the indexed terms in a field and the number of documents that match each term. */ termsSearch(query: Query | Record | string): Promise; /** * Perform an arbitrary query on a Solr handler (a.k.a. 'path'). * * @param handler * The name of the handler (or 'path' in Solr terminology). * @param query * A function, Query object, Collection object, plain object, or string * describing the query to perform. */ doQuery(handler: string, query: Collection | Query | Record | string): Promise; /** * Create an instance of `Query` */ query(): Query; /** * Create an instance of `Collection`. */ collection(): Collection; /** * Expose `format.escapeSpecialChars` from `Client.escapeSpecialChars` */ escapeSpecialChars: typeof format.escapeSpecialChars; /** * Ping the Solr server. */ ping(): Promise; }