prorm API Reference
    Preparing search index...

    Class SolrStore

    SolrStore wraps a solr-client client and exposes Solr's document indexing, querying, deletion, and commit/optimize operations as a typed, promise-based API.

    Implements

    Index
    name: "solr" = 'solr'

    The name of the store (e.g. 'mongodb', 'redis', 'dynamodb')

    library: "solr-client" = 'solr-client'

    The client library being used

    • Add (index) one or more documents, then commit so they become searchable. Solr buffers adds until a commit, so the two are done together here for the common "index and see it" case; call add via getClient() directly if you want to batch many adds before a single commit.

      Parameters

      • docs: Record<string, unknown> | Record<string, unknown>[]

      Returns Promise<unknown>

    • Run a query. Pass either a raw query object/string (Solr query params, e.g. 'q=title:solr&rows=10') or a query built by SolrStore.query. Returns the driver's raw response object ({ responseHeader, response: { numFound, docs, ... } }).

      Parameters

      • query: unknown

      Returns Promise<unknown>

    • Build a query with the driver's fluent builder (.q(...), .start(...), .rows(...), .sort(...), ...), when the driver exposes client.query(). Throws if this driver build doesn't provide a builder - construct a raw query object/string and pass it straight to SolrStore.search in that case.

      Returns unknown

    • Delete a single document by its unique-key value, then commit.

      Parameters

      • id: string | number

      Returns Promise<unknown>

    • Delete every document matching a Solr query (e.g. 'category:obsolete'), then commit.

      Parameters

      • query: string

      Returns Promise<unknown>

    • Commit buffered writes so they become visible to search.

      Returns Promise<unknown>

    • Optimize the index (merge segments). Optional - not every solr-client build exposes optimize; throws a DatabaseError if this one doesn't.

      Returns Promise<unknown>