Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-solr-lambda

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-solr-lambda

Minimalistic Solr client written in functional programming style

  • 3.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

node-solr-lambda

Conventional Commits

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

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:

# run this in a separate terminal and shutdown using CTRL+C
yarn test:prepare

Now you can run the test suite:

yarn test

FAQs

Package last updated on 27 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc