solr-search
Advanced tools
Comparing version 0.1.1 to 0.1.3
38
index.js
'use strict'; | ||
module.exports = require('./lib/solr'); | ||
/* | ||
var request = require('./lib/request'), | ||
colog = require('colog'); | ||
var simpleSelect = 'http://localhost:8983/solr/dariuszp/select?&q=*:*&wt=json&indent=true'; | ||
var update = 'http://localhost:8983/solr/update?commit=true&wt=json'; | ||
request.post(update, '<add><doc><field name="id">1</field><field name="title">Hello</field></doc><doc><field name="id">2</field><field name="title">world</field></doc></add>', function (data) { | ||
colog.dump(data, ['green', 'bold']); | ||
}); | ||
request.get(simpleSelect, function (data) { | ||
colog.dump(JSON.parse(data), ['red', 'bgWhite', 'bold']); | ||
});*/ | ||
//var solr = require('./lib/solr'), | ||
// colog = require('colog'); | ||
// | ||
//solr.addClient('dariuszp'); | ||
// | ||
//var dc = solr.getClient('dariuszp'); | ||
// | ||
//dc.getCollection('dariuszp', function (collection) { | ||
// collection.select().query('*:*', { | ||
// fq: 'title:Hello', | ||
// fl: ['title'], | ||
// sort: { 'id': 'ASC' }, | ||
// 'success': function (se) { | ||
// console.log(se.docs()); | ||
// }, | ||
// 'error': function (err) { | ||
// console.log(err.toString()); | ||
// } | ||
// }); | ||
//}); | ||
module.exports = require('./lib/solr'); |
@@ -8,3 +8,4 @@ 'use strict'; | ||
events = require('events'), | ||
Select = require('./select'); | ||
Select = require('./Select'), | ||
SolrDocument = require('./SolrDocument'); | ||
@@ -176,4 +177,9 @@ function convertType(val) { | ||
if ((document instanceof Object) === false) { | ||
throw new Error('Document must be a JSON object'); | ||
throw new Error('Document must be a JSON object or SolrDocument type'); | ||
} | ||
if (document instanceof SolrDocument) { | ||
document = document.getRawData(); | ||
} | ||
for (field in document) { | ||
@@ -180,0 +186,0 @@ if (document.hasOwnProperty(field)) { |
{ | ||
"name": "solr-search", | ||
"version": "0.1.1", | ||
"version": "0.1.3", | ||
"author": "Półtorak Dariusz <poltorak.dariusz@gmail.com>", | ||
@@ -14,3 +14,2 @@ "description": "Small solr client", | ||
"main": "index.js", | ||
"bin": "bin/solr.js", | ||
"keywords": [ | ||
@@ -17,0 +16,0 @@ "solr", |
@@ -1,2 +0,2 @@ | ||
solr-search v0.1.0 | ||
solr-search v0.1.3 | ||
==== | ||
@@ -3,0 +3,0 @@ |
28354
14
785