# node-solr-lambda

> Minimalistic Solr client written in functional programming style

Latest version **3.0.6** (published 2023-06-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-solr-lambda
pnpm add node-solr-lambda
yarn add node-solr-lambda
bun add node-solr-lambda
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.6 |
| Published | 2023-06-27 |
| First published | 2023-06-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.0.0 |
| Dependencies | 1 |
| Unpacked size | 36.1 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Viliam Simko |
| Maintainers | vlx |

## Links

- npm: https://www.npmjs.com/package/node-solr-lambda
- Repository: https://github.com/vsimko/node-solr-lambda
- npm.io page: https://npm.io/package/node-solr-lambda

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^0.27.2

## Recent versions

- 3.0.6 (latest) — 2023-06-27

## README

# node-solr-lambda

[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)

## Features

- functional-style API with jsdoc type annotations
- plain javascipt in commonjs format - no additional build step required
- ES6+ including async/await, lambdas, spread operator...
- typechecking support in vscode (without compiling typescript code)
- no runtime dependencies other than `axios`
- as close as possible to the Solr Json-based REST API
- functions for working with documents, fields, field types, cores

## Example

```js
const { prepareSolrClient } = require("node-solr-lambda");
const solr = prepareSolrClient("mycore");

async function myfun() {
  const result = await solr.query({ query: "label:something" });
  console.log(result);

  await solr.addField({ name: "price", type: "plong", multiValued: false });
  await solr.addField({
    name: "category",
    type: "string",
    multiValued: true,
    docValues: true
  });

  const item1 = { id: "item1", price: 123, category: ["cpu", "ram"] };
  const item2 = { id: "item2", price: 456, category: ["cpu", "usb"] };
  await solr.add(item1); // works with single object
  await solr.add([item1, item2]); // works with object[]
  await solr.commit()

  await solr.query({
    query: "*:*",
    facet: {
      top_5_categories: {
        terms: {
          field: "category",
          limit: 5,
          facet: {
            avg_price: "avg(price)"
          }
        }
      }
    }
  });
}
```

## How to test

We provide a docker-compose with a solr instance for testing.
The testing solr instance needs to run first:
```sh
# run this in a separate terminal and shutdown using CTRL+C
yarn test:prepare
```

Now you can run the test suite:
```sh
yarn test
```

---
_Source: https://npm.io/package/node-solr-lambda · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
