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

solwr

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

solwr

solr wrapper for nodejs

  • 0.1.3
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

npm version

Solwr

Solr nodejs wrapper, mongoose inspired

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

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

Built With

heavily inspired by mongoose

License

MIT

Keywords

FAQs

Package last updated on 07 Apr 2017

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