Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

89 Commits

Repository files navigation

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");constsolr=prepareSolrClient("mycore");asyncfunctionmyfun(){constresult=awaitsolr.query({query: "label:something"});console.log(result);awaitsolr.addField({name: "price",type: "plong",multiValued: false});awaitsolr.addField({name: "category",type: "string",multiValued: true,docValues: true});constitem1={id: "item1",price: 123,category: ["cpu","ram"]};constitem2={id: "item2",price: 456,category: ["cpu","usb"]};awaitsolr.add(item1);// works with single objectawaitsolr.add([item1,item2]);// works with object[]awaitsolr.commit()awaitsolr.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

About

Minimalistic Solr client written in functional programming style

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages