# solr

> A low-level Solr client

Latest version **0.3.0** (published 2015-04-28) · 0 weekly downloads

## Install

```sh
npm install solr
pnpm add solr
yarn add solr
bun add solr
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2015-04-28 |
| First published | 2011-01-24 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.4.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Gabriel Farrell |
| Maintainers | gsf |

## Links

- npm: https://www.npmjs.com/package/solr
- Repository: https://github.com/pabloviquez/node-solr
- Issues: https://github.com/pabloviquez/node-solr/issues
- npm.io page: https://npm.io/package/solr

## Recent versions

- 0.3.0 (latest) — 2015-04-28
- 0.2.2 — 2012-06-27
- 0.2.1 — 2012-02-06
- 0.2.0 — 2011-12-13
- 0.1.6 — 2011-12-11
- 0.1.5 — 2011-08-24
- 0.1.4 — 2011-03-31
- 0.1.3 — 2011-03-07
- 0.1.1 — 2011-01-24
- 0.1.0 — 2011-01-24

## README

# Solr module for Node.js

## References
* Node.js: http://github.com/joyent/node
* Solr: http://lucene.apache.org/solr/

Run tests with `npm test`. Edit "test/common.js" if you don't have Solr running at 127.0.0.1:8983. 

## Usage Example

See tests for usage. Here's a quick example:

```javascript
    var solr = require('solr');

    var client = solr.createClient();
    var doc1 = {
      id: '1',
      title_t: 'Foo bar',
      text_t: 'Fizz buzz frizzle'
    };
    var doc2 = {
      id: '2',
      title_t: 'Far boo',
      text_t: 'Wuzz fizz drizzle'
    };

    client.add(doc1, function(err) {
      if (err) throw err;
      console.log('First document added');
      client.add(doc2, function(err) {
        if (err) throw err;
        console.log('Second document added');
        client.commit(function(err) {
          var query = 'text_t:fizz'
          client.query(query, function(err, response) {
            if (err) throw err;
            var responseObj = JSON.parse(response);
            console.log('A search for "' + query + '" returned ' +
                responseObj.response.numFound + ' documents.');
            console.log('First doc title: ' + 
                responseObj.response.docs[0].title_t);
            console.log('Second doc title: ' + 
                responseObj.response.docs[1].title_t);
            client.del(null, query, function(err, response) {
              if (err) throw err;
              console.log('Deleted all docs matching query "' + query + '"');
              client.commit()
            });
          });
        });
      });
    });
```

## Optional Parameters

Solr add/replace documents supports optional parameters.

```javascript
var doc1 = {
  id: '1',
  title_t: {
    params: {
      boost: '2.0'
    },
    value: 'Foo bar',
  },
  text_t: 'Fizz buzz frizzle'
};
```

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