Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
9c5a0a3
Test added for group query
juzerali Nov 17, 2012
50dd3b7
Test added for MoreLikeThis query
juzerali Nov 18, 2012
8cb446c
Test added for facet-query
juzerali Nov 18, 2012
5e1edd4
NEW: Add 'get' method to make arbitrary requests
vlad-x May 13, 2014
ac53d76
making the solr connection params configurable during test as per sug…
marc-portier Jul 16, 2014
1e6b880
merging with upstream
marc-portier Jul 16, 2014
f904146
introducing the figc configurability and describing how to use it. Cl…
marc-portier Jul 17, 2014
723ef87
tabs/spaces - follow current code style
marc-portier Jul 17, 2014
2a4f74c
figc is only a dev-dependency
marc-portier Jul 17, 2014
a991d0d
silly typeglitch - and urgent remind to self never to try and edit th…
marc-portier Jul 17, 2014
857a4df
making the solr connection params configurable during test as per sug…
marc-portier Jul 18, 2014
16a1819
merging in the prepared tests from juzerali + applying the new config…
marc-portier Jul 18, 2014
a2f764a
making the facet-test pass --> by picking a facet field (author) that…
marc-portier Jul 18, 2014
7274bcf
making the mlt test work --> by just adding the fields to the expecte…
marc-portier Jul 18, 2014
b926043
remove logging statement
marc-portier Jul 18, 2014
34bb8e4
making the group test work --> by changing our expectations about the…
marc-portier Jul 18, 2014
31f71e6
better no logging, and surely not before the sassert.ok
marc-portier Jul 18, 2014
bd08866
Add support for deep-paging through cursorMarks as suggested in #89
marc-portier Jul 19, 2014
7bb0bc5
adding tests for common features in order to fulfill the suggestions …
marc-portier Jul 19, 2014
b92afb1
Merge remote-tracking branch 'upstream/v0.3.x' into v0.3.x
marc-portier Jul 19, 2014
cd24531
Introducing real-time-get support as suggested in #88
marc-portier Jul 20, 2014
ce7e3b7
remove the debug statement to make for silent testing
marc-portier Jul 20, 2014
29b3d46
Merge remote-tracking branch 'origin/v0.3.x-patch85' into v0.3.x
marc-portier Jul 20, 2014
312da1d
Merge remote-tracking branch 'vladif/make-any-request-to-solr' into v…
marc-portier Jul 20, 2014
fbc322d
Alternative implementation for the #83 suggestion.
marc-portier Jul 20, 2014
4946e46
adding tests for generic handleGet and handlePost
marc-portier Jul 20, 2014
94e6d42
add test to not leave lingering docs
marc-portier Jul 21, 2014
a29205c
let's name this version correctly
marc-portier Jul 21, 2014
5932ef0
Merge remote-tracking branch 'upstream/v0.3.x' into v0.3.x
marc-portier Jul 29, 2014
c07e1d7
Merge remote-tracking branch 'upstream/v0.3.x' into v0.3.x
marc-portier Jul 30, 2014
9b6c0ce
Merge remote-tracking branch 'upstream/v0.3.x' into v0.3.x
marc-portier Jul 31, 2014
1ad313f
first stab at uploading files into the extractor-index, including tes…
marc-portier Aug 5, 2014
dcc304a
Merge remote-tracking branch 'upstream/v0.3.x' into v0.3.x-patch90
marc-portier Aug 5, 2014
0b17ca4
These jar files to include have dropped the apache- prefix in their n…
marc-portier Aug 5, 2014
23d44fb
Allowing to pass down streams and not only files to extract into the …
marc-portier Aug 5, 2014
4554c0e
Fix: #71
marc-portier Aug 13, 2014
5ae561e
Thanks to the swift resolution and release of the duplicate-key issue…
marc-portier Aug 15, 2014
bae5f28
NEW: Update JSONStream and request modules to the latest version.
lbdremy Aug 16, 2014
70886cd
NEW: Add support for HTTPS, close #111.
lbdremy Aug 16, 2014
323f733
NEW: Update and add examples for Client#{get, softCommit, prepareComm…
lbdremy Aug 16, 2014
85ac54c
FIX: Update README to reflech recent changes made on the library.
lbdremy Aug 16, 2014
b524f66
RELEASE: v0.3.0, big thanks to @marc-portier .
lbdremy Aug 16, 2014
f60efc5
Merge remote-tracking branch 'upstream/master' into v0.3.x
marc-portier Aug 16, 2014
c69ace4
advancing version to cater for upcoming release on this branch
marc-portier Aug 16, 2014
e95ecbd
Adding createExtractStream() in the fix for #90 to lign up with the s…
marc-portier Aug 21, 2014
ba65550
continuing down the stream-way of working to answer the ideas in #90
marc-portier Aug 27, 2014
014cbc7
essential fix - avoid undefined options
marc-portier Sep 9, 2014
808d1b1
data event should communicate the correct return
marc-portier Sep 25, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ npm install solr-client
```

##Features
- Commands supported: search(select), index, delete, update, commit, rollback, optimize, ping

- Commands supported: search(select), add, delete, update, commit, rollback, optimize, ping, real-time get, prepare commit, soft commit, arbitrary search handler (i.e: mlt, luke ...)
- Lucene query / DisMax query
- Grouping / Field Collapsing. (Apache Solr version must be >= 3.3)
- Convenients methods for querying with Facet, MoreLikeThis
- HTTP Basic Access Authentication
- Over HTTPS as well
- Use json-bigint to parse and stringify correctly *_l fields of Solr

##Documentation
See the website at http://lbdremy.github.com/solr-node-client/.
Expand All @@ -34,7 +37,7 @@ client.add({ id : 12, title_t : 'Hello' },function(err,obj){
if(err){
console.log(err);
}else{
console.log('Solr response:' + obj);
console.log('Solr response:', obj);
}
});
```
Expand All @@ -57,7 +60,6 @@ client.add({ id : 12, title_t : 'Hello' },function(err,obj){
```
npm test
```
### v0.3.x

Tests are executed against a running SOLR instance, so you might want to:
- install the schema.xml and solrconfig.xml expected by the tests. You find these in test/materials
Expand Down Expand Up @@ -85,6 +87,9 @@ npm run-script report
This command will generate a file named `coverage.html`, use your browser to visualize it.

##Licence

(The MIT License)

Copyright 2011-2012 HipSnip Limited

Copyright 2013-2014 Rémy Loubradou
18 changes: 18 additions & 0 deletions examples/deleteAll.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Delete all documents
*/

// Use `var solr = require('solr-client')` in your code
var solr = require('./../lib/solr');

var client = solr.createClient();

client.deleteAll(function(err,obj){
if(err){
console.log(err);
}else{
console.log(obj);
}
// Do not forget to commit now
// to see the changes
});
7 changes: 4 additions & 3 deletions examples/deleteByID.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Delete document with the given `id`
*/

// Use `var solr = require('solr-client')` in your code
// Use `var solr = require('solr-client')` in your code
var solr = require('./../lib/solr');

var client = solr.createClient();
Expand All @@ -12,8 +12,9 @@ client.deleteByID(id,function(err,obj){
if(err){
console.log(err);
}else{
console.log(obj);
console.log(obj);
}
// Do not forget to commit now
// to see the changes
});

client.commit();
8 changes: 5 additions & 3 deletions examples/deleteByQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Delete documents matching the given `query`
*/

// Use `var solr = require('solr-client')` in your code
// Use `var solr = require('solr-client')` in your code
var solr = require('./../lib/solr');

var client = solr.createClient();
Expand All @@ -12,8 +12,10 @@ client.deleteByQuery(query,function(err,obj){
if(err){
console.log(err);
}else{
console.log(obj);
console.log(obj);
}
// Do not forget to commit now
// to see the changes
});

client.commit();

10 changes: 6 additions & 4 deletions examples/deleteByRange.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* Delete set of documents based on a range
* Delete set of documents based on a range
*/

// Use `var solr = require('solr-client')` in your code
// Use `var solr = require('solr-client')` in your code
var solr = require('./../lib/solr');

var client = solr.createClient();
Expand All @@ -14,8 +14,10 @@ client.deleteByRange('last_update',startOffset,stopOffset,function(err,obj){
if(err){
console.log(err);
}else{
console.log(obj);
console.log(obj);
}
// Do not forget to commit now
// to see the changes
});

client.commit();

4 changes: 2 additions & 2 deletions examples/facet.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Use `var solr = require('solr-client')` in your code
// Use `var solr = require('solr-client')` in your code
var solr = require('./../lib/solr');

var client = solr.createClient();
Expand All @@ -21,6 +21,6 @@ client.search(query,function(err,obj){
if(err){
console.log(err);
}else{
console.log(obj);
console.log(obj);
}
});
19 changes: 19 additions & 0 deletions examples/get.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Send an arbitrary HTTP GET request to Solr
* Use case: use a Search handler exposed by Solr but not supported by this client
* for example MoreLikeThisHandler (https://wiki.apache.org/solr/MoreLikeThisHandler)
*/

// Use `var solr = require('solr-client')` in your code
var solr = require('./../lib/solr');

var client = solr.createClient();

var query = 'q=id:UTF8TEST&mlt.fl=manu,cat&mlt.mindf=1&mlt.mintf=1';
client.get('mlt', query, function(err, obj){
if(err){
console.log(err);
}else{
console.log(obj);
}
});
16 changes: 8 additions & 8 deletions examples/optimize.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
/*!
* Optimize: This is similar to a defrag command on a hard drive.
* Optimize: This is similar to a defrag command on a hard drive.
* It will reorganize the index into segments (increasing search speed) and remove any deleted (replaced) documents.
* Solr is a read only data store so every time you index a document it will mark the old document as deleted and
* then create a brand new document to replace the deleted one. Optimize will remove these deleted documents.
* You can see the search document vs. deleted document count by going to the Solr Statistics page and looking
* then create a brand new document to replace the deleted one. Optimize will remove these deleted documents.
* You can see the search document vs. deleted document count by going to the Solr Statistics page and looking
* at the numDocs vs. maxDocs numbers. The difference between the two numbers is the amount of deleted (non-search able)
* documents in the index.
* Also Optimize builds a whole NEW index from the old one and then switches to the new index when complete.
* Also Optimize builds a whole NEW index from the old one and then switches to the new index when complete.
* Therefore the command requires double the space to perform the action. So you will
* need to make sure that the size of your index does not exceed %50 of your available hard drive space.
* need to make sure that the size of your index does not exceed %50 of your available hard drive space.
* (This is a rule of thumb, it usually needs less then %50 because of deleted documents)
*
*
* from Stackoverflow : http://stackoverflow.com/questions/2137607/solr-commit-and-optimize-questions wrote by James Roland
*/

/**
* Optimize Solr index.
*/

// Use `var solr = require('solr-client')` in your code
// Use `var solr = require('solr-client')` in your code
var solr = require('./../lib/solr');

var client = solr.createClient();
Expand All @@ -32,7 +32,7 @@ client.optimize(options,function(err,obj){
if(err){
console.log(err);
}else{
console.log(obj);
console.log(obj);
}
});
// waitFlush : default is true
Expand Down
4 changes: 2 additions & 2 deletions examples/ping.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Ping the Solr server
*/

// Use `var solr = require('solr-client')` in your code
// Use `var solr = require('solr-client')` in your code
var solr = require('./../lib/solr');

var client = solr.createClient();
Expand All @@ -11,6 +11,6 @@ client.ping(function(err,obj){
if(err){
console.log(err);
}else{
console.log(obj);
console.log(obj);
}
});
16 changes: 16 additions & 0 deletions examples/prepareCommit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* Prepare commit
*/

// Use `var solr = require('solr-client')` in your code
var solr = require('./../lib/solr');

var client = solr.createClient();

client.prepareCommit(function(err,res){
if(err){
console.log(err);
}else{
console.log(res);
}
});
33 changes: 33 additions & 0 deletions examples/realTimeGet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Use real-time get feature
*/

// Use `var solr = require('solr-client')` in your code
var solr = require('./../lib/solr');

var client = solr.createClient();

// Retrieve only one document
var id = 3973873;
client.realTimeGet(id, function(err, obj){
if(err){
console.log(err);
}else{
console.log(obj);
}
});

// Retrieve multiple documents
var ids = [
4874847,
9449747,
949448
];
client.realTimeGet(ids, function(err, obj){
if(err){
console.log(err);
}else{
console.log(obj);
}
});

14 changes: 8 additions & 6 deletions examples/softCommit.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
/**
* Commit your changes in the index with or without options.
* Soft commit
*/

// Use `var solr = require('solr-client')` in your code
// Use `var solr = require('solr-client')` in your code
var solr = require('./../lib/solr');

var client = solr.createClient();

// Soft commit
client.commit({ softCommit : true },function(err,res){
if(err) console.log(err);
if(res) console.log(res);
client.softCommit(function(err,res){
if(err){
console.log(err);
}else{
console.log(res);
}
});
17 changes: 17 additions & 0 deletions examples/spell.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Search documents matching the `query` with Spellcheck enabled.
*/

// Use `var solr = require('solr-client')` in your code
var solr = require('./../lib/solr');

var client = solr.createClient();
var query = client.createQuery()
.q('laptop');
client.spell(query,function(err,obj){
if(err){
console.log(err);
}else{
console.log(obj);
}
});
Loading