Skip to content

Latest commit

 

History

History
74 lines (59 loc) · 6.12 KB

api-reference.md

File metadata and controls

74 lines (59 loc) · 6.12 KB

Public API reference

This page documents the package root entry point. Runtime and declaration files are produced by npm run build; the release check verifies that the ESM, CommonJS, and top-level TypeScript entry points declared in package.json exist. The documentation check compares this method list with the public SolrClient and SolrTransport class declarations, and compares every API inventory entry with those declarations.

Install with npm install node-solr-lambda, then import createSolrClient from node-solr-lambda. The factory returns a SolrClient. Configure exactly one of core or collection for scoped operations. See getting started and configuration.

Client methods

All methods below are available on SolrClient. Unless otherwise noted, methods return a Promise containing the parsed Solr response. Generic response parameters allow consumers to provide application-specific response types.

Method Purpose Detailed guide
SolrClient.query() Execute a typed Select query Query API
SolrClient.queryJson() Execute the JSON Request API Query API
SolrClient.add() Add documents Update API
SolrClient.update() Replace documents Update API
SolrClient.updateCommands() Submit typed JSON update commands Update API
SolrClient.atomicUpdate() Apply typed atomic field modifiers Update API
SolrClient.delete() Delete documents by ID or query Update API
SolrClient.commit() Commit pending updates Update API
SolrClient.softCommit() Make updates visible without a hard commit Update API
SolrClient.optimize() Request index segment optimization Update API
SolrClient.rollback() Roll back pending updates Update API
SolrClient.ping() Check Solr health Administration
SolrClient.schema() Execute typed Schema API commands Schema API
SolrClient.config() Execute typed Config API commands Config API
SolrClient.getConfig() Read the effective configuration Config API
SolrClient.getConfigOverlay() Read the persisted Config API overlay Config API
SolrClient.coreAdmin() Execute CoreAdmin actions Administration
SolrClient.collections() Execute Collections API actions Administration
SolrClient.replication() Execute ReplicationHandler commands Replication API
SolrClient.replicationFile() Read ReplicationHandler file content Replication API
SolrClient.systemInfo() Read Solr system information Administration
SolrClient.systemProperties() Read JVM and process properties Administration
SolrClient.systemThreads() Read JVM thread diagnostics Administration
SolrClient.systemLogging() Read logger configuration and levels Administration
SolrClient.metrics() Read Solr metrics Administration
SolrClient.security() Read or update authentication and authorization settings Administration
SolrClient.stream() Execute a Streaming Expression and parse its JSON response Streaming Expressions
SolrClient.export() Return the raw Export handler response Streaming and Export
SolrClient.exportStream() Return the Export response body as a byte stream Streaming and Export
SolrClient.request() Send a custom request through the shared transport Raw requests
SolrClient.requestRaw() Send a custom request and retain the Fetch Response Raw requests

Root exports

The root entry point exports createSolrClient, SolrClient, the public error classes, query helper functions, and the public TypeScript models. Type exports include client configuration and request controls; query, facet, grouping, highlighting, statistics, and JSON Request API models; update and atomic-update models; Schema, Config, CoreAdmin, and Collections command plus alias/cluster-status response models; replication and backup/restore models; Export, Metrics, System, Security, and Streaming Expressions models; and error/validation models.

Use named imports from the package root:

import { createSolrClient, SolrHttpError, solrFilter } from "node-solr-lambda";
import type { SolrClientConfig, SolrQuery, SolrUpdateOptions } from "node-solr-lambda";

const config: SolrClientConfig = { baseUrl: "http://localhost:8983", core: "books" };
const solr = createSolrClient(config);
const query: SolrQuery = { query: "*:*", limit: 10 };
const updateOptions: SolrUpdateOptions = { commitWithin: 1_000 };

try {
  await solr.query(query);
  await solr.add({ id: "book-1", title: "Solr in Action" }, updateOptions);
} catch (error) {
  if (error instanceof SolrHttpError) console.error(error.status, error.message);
  throw error;
}

The full operation inventory, type-coverage notes, unit-test status, and Solr 8/9/10 evidence are maintained in the API coverage matrix and machine-readable API inventory. The stable/experimental/internal decision for every root export and the client method review are recorded in the public API review. See compatibility before relying on behavior that is marked unverified. Generic request() and requestRaw() are escape hatches and do not imply typed support for arbitrary Solr handlers.

Module and declaration entry points

The package publishes ESM and CommonJS runtime entry points and conditional declarations for both module systems. The top-level types field remains available for tooling that does not resolve NodeNext package conditions. The package build creates these files; CI checks that each path declared by package.json exists after building.