UNPKG

@azure/search-documents

Version:
80 lines (79 loc) 3.73 kB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var searchClient_exports = {}; __export(searchClient_exports, { SearchClient: () => SearchClient }); module.exports = __toCommonJS(searchClient_exports); var import_api = require("./api/index.js"); var import_operations = require("./api/operations.js"); class SearchClient { _client; /** The pipeline used by this client to make requests */ pipeline; constructor(endpointParam, credential, indexName, options = {}) { const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; const userAgentPrefix = prefixFromOptions ? `${prefixFromOptions} azsdk-js-client` : `azsdk-js-client`; this._client = (0, import_api.createSearch)(endpointParam, credential, indexName, { ...options, userAgentOptions: { userAgentPrefix } }); this.pipeline = this._client.pipeline; } /** Autocompletes incomplete query terms based on input text and matching terms in the index. */ autocompletePost(searchText, suggesterName, options = { requestOptions: {} }) { return (0, import_operations.autocompletePost)(this._client, searchText, suggesterName, options); } /** Autocompletes incomplete query terms based on input text and matching terms in the index. */ autocompleteGet(searchText, suggesterName, options = { requestOptions: {} }) { return (0, import_operations.autocompleteGet)(this._client, searchText, suggesterName, options); } /** Sends a batch of document write actions to the index. */ index(batch, options = { requestOptions: {} }) { return (0, import_operations.index)(this._client, batch, options); } /** Suggests documents in the index that match the given partial query text. */ suggestPost(searchText, suggesterName, options = { requestOptions: {} }) { return (0, import_operations.suggestPost)(this._client, searchText, suggesterName, options); } /** Suggests documents in the index that match the given partial query text. */ suggestGet(searchText, suggesterName, options = { requestOptions: {} }) { return (0, import_operations.suggestGet)(this._client, searchText, suggesterName, options); } /** Retrieves a document from the index. */ getDocument(key, options = { requestOptions: {} }) { return (0, import_operations.getDocument)(this._client, key, options); } /** Searches for documents in the index. */ searchPost(options = { requestOptions: {} }) { return (0, import_operations.searchPost)(this._client, options); } /** Searches for documents in the index. */ searchGet(options = { requestOptions: {} }) { return (0, import_operations.searchGet)(this._client, options); } /** Queries the number of documents in the index. */ getDocumentCount(options = { requestOptions: {} }) { return (0, import_operations.getDocumentCount)(this._client, options); } } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { SearchClient }); //# sourceMappingURL=searchClient.js.map