GitXplorerGitXplorer
g

node-solr

public
222 stars
39 forks
1 issues

Commits

List of commits on branch master.
Unverified
c36dc6bf310829af8f1c1643be9d801568c6c621

Merge pull request #25 from pabloviquez/master

ppabloviquez committed 10 years ago
Unverified
36aae73dbed0ba4c9a9ef1b046ca2c8f96ebeddd

Incrementing version for package

ppabloviquez committed 10 years ago
Unverified
4cf1785ba0b700fcfdc68e786889ff9ecccce85e

Adding admin call reload to client

ppabloviquez committed 10 years ago
Unverified
0bf6f5153d86b568db867abfbf932b14b31bc1e2

Incrementing version on package

ppabloviquez committed 10 years ago
Unverified
e4097a4f5312ce846a80b6a842ee870ffe5d40ba

Merge pull request #24 from pabloviquez/master

ggsf committed 10 years ago
Unverified
37075ce8c5da5a402d828d3c01f456287f86c8cc

Fixed issue when null values are present

ppabloviquez committed 10 years ago

README

The README file for this repository.

Solr module for Node.js

References

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:

    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.

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