Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gsf/node-solr
Solr module for Node.js
https://github.com/gsf/node-solr
Last synced: 2 months ago
JSON representation
Solr module for Node.js
- Host: GitHub
- URL: https://github.com/gsf/node-solr
- Owner: gsf
- License: mit
- Created: 2010-02-22T15:10:09.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2015-06-05T18:52:19.000Z (over 9 years ago)
- Last Synced: 2024-10-20T02:53:05.178Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 213 KB
- Stars: 222
- Watchers: 12
- Forks: 39
- Open Issues: 1
-
Metadata Files:
- Readme: README
- License: LICENSE
Awesome Lists containing this project
README
Solr module for Node.js
*** Note!
*** I have no active Solr projects at this time and would be happy to
*** hand maintenance of node-solr off to someone more invested. Send
*** me a message and I'll redirect people to your fork.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.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 for Add documents
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'
};
```