Socket
Book a DemoInstallSign in
Socket

solwr-fork

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

solwr-fork

solr wrapper for nodejs withour debug log - forked from https://www.npmjs.com/package/solwr

0.1.5
latest
npmnpm
Version published
Weekly downloads
2
100%
Maintainers
1
Weekly downloads
 
Created
Source

npm version

Solwr(-fork)

Solr nodejs wrapper, mongoose inspired (with a simple log removal)

Getting Started

Prerequisites

  • Solr >= 5

You should install solr server

solr create_core -c querytest
solr create_core -c products

Installing

npm install --save solwr-fork

Running the tests

npm run test

Example

Performing create core, you should create core on server

config server

solwr.address( {
  host: "http://<ip or domain>",
  port: <port>
} );

get core

solwr.core(<core_name>, <opts>)

// return core
var users = solwr.core('users');

you try duplicate core throw duplicate error.

opts
* wt //request and respones type (json, xml)

remove core

users.removeCore()
     .exec()
     .then(<success_callback>)
     .then(null, <error_callback>);


alternatively

users.removeCore(function(err, data){
 if(err) handle err
});

create document

users.create({id: '1', name: 'omer'}, <opts>)
     .exec()
     .then(<success_callback>)
     .then(null, <error_callback>)


//document array
users.create([{id: '1', name: 'omer'}, {id: '2', name: 'markakod'}], <opts>)
     .exec()
     .then(<success_callback>)
     .then(null, <error_callback>)


this alternative is usable all of query

users.create({id: '1', name: 'omer'}, function(err, data){
  if(err) handle err
});


opts
* dataFormat //json, xml

find

//get documents by query
users.find("*:*", <opts>)
     .exec()
     .then(function(_users){
       //use response users
     })
     .then(null, function(err){
       //handle error
     })

opts
* format //json, xml

only

//if you want only data, response contains
users.find("*:*", <opts>)
     .only()
     .exec()
     .then(<success_callback>)
     .then(null, <error_callback>)

opts
* format //json, xml

xml response is not parsed, is string

sort

//get documents by query
users.find("*:*")
     .sort("id desc")
     .only()
     .exec()
     .then(<success_callback>)
     .then(null, <error_callback>)

opts
* format //json, xml

limit

//get documents by query
users.find("*:*", <opts>)
     .limit(4)
     .exec()
     .then(<success_callback>)
     .then(null, <error_callback>)

opts
* format //json, xml

skip

//get documents by query
users.find("*:*", <opts>)
     .skip(100)
     .exec()
     .then(<success_callback>)
     .then(null, <error_callback>)

if you want, you can pagination with skip and limit functions

opts
* format //json, xml

remove document

//get documents by query
users.remove("id:1", <opts>)
     .exec()
     .then(<success_callback>)
     .then(null, <error_callback>)

opts
* format //json, xml

Built With

  • Axios - request library

Built With

heavily inspired by mongoose

License

MIT

Keywords

solr

FAQs

Package last updated on 27 Mar 2021

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.