Skip to content

Commit c4e9f0f

Browse files
docs(Readme): Add some more information of how some new features work, add some examples, re-organized migration doc chronologically reverse to be more meaningful.
1 parent 0a6def9 commit c4e9f0f

File tree

3 files changed

+79
-31
lines changed

3 files changed

+79
-31
lines changed

README.md

Lines changed: 73 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,19 @@ npm install solr-client
1313

1414
##Features
1515

16+
###Latest (0.6.0)
17+
18+
- Solr5 Query-Highlighting support through StandardHighlighter (@LukeTavern) (https://github.com/lbdremy/solr-node-client/pull/144)
19+
- Experimental support for SolrCloud collections administration (@LukeTavern) (https://github.com/lbdremy/solr-node-client/issues/138)
20+
- Support for large query through POST via configurable automatic switch (@kfitzgerald) (https://github.com/lbdremy/solr-node-client/pull/129)
21+
- Set Default Field (query.df()) (@cbarrientos-ias) (https://github.com/lbdremy/solr-node-client/pull/137)
22+
- Adds support for facet.pivot and facet.pivot.mincount (@nicolasembleton) (https://github.com/lbdremy/solr-node-client/issues/146)
23+
24+
Noticeable change: You can now pass a solrVersion to the Client initialization so it will activate features that are only supported
25+
by your version or higher. Be sure to check the documentation
26+
27+
###0.5.0
28+
1629
- 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 ...)
1730
- Lucene query / DisMax query
1831
- Grouping / Field Collapsing. (Apache Solr version must be >= 3.3)
@@ -44,40 +57,54 @@ client.add({ id : 12, title_t : 'Hello' },function(err,obj){
4457
});
4558
```
4659

47-
##Migration between 0.2.x and 0.3.x
60+
##Migration between 0.5.x and 0.6.x
4861

49-
The only breaking change introduced in `v0.3.0` is about method chaining of the solr `Client`.
50-
Method chaining as simply been removed because we were actually hidding something really interesting and useful
51-
the `http.ClientRequest` instance.
62+
No breaking change has been introduced to this release. However, to take advantage of facet.pivot and facet.pivot.mincount feature,
63+
you'll need to pass a solrVersion parameter to the createClient() method.
5264

53-
So, before you could have done this:
65+
Example:
5466

5567
```js
56-
var client = solr.createClient();
68+
// Will activate features specific to Solr4.0 and above (like facet.pivot and facet.pivot.mincount)
69+
var client = solr.createClient({
70+
solrVersion: '4.0'
71+
});
72+
```
5773

58-
client
59-
.search('q=hello', function(err, obj){
60-
console.log(err, obj);
61-
})
62-
.search('q=world', function(err, obj){
63-
console.log(err, obj);
64-
});
74+
A feature allowing to support large queries by switching to POST when the query size reaches the threshold was introduced. To not become
75+
a breaking change, it is by default turned OFF.
76+
77+
To activate it, pass the property `get_max_request_entity_size` to the createClient with the threshold in bytes. Minimum is 1.
78+
79+
Example:
80+
81+
```js
82+
// Will switch to POST as soon as the query size reaches 1000 bytes (limit in servers is usually 2048 or 8192)
83+
// You can set it to 1 so every request will always use POST.
84+
var client = solr.createClient({
85+
get_max_request_entity_size: 1000
86+
});
6587
```
6688

67-
Now it won't work, but you have now access to the `http.ClientRequest` instead created by `Client#search`:
89+
##Migration between 0.4.x and 0.5.x
90+
91+
The only breaking change introduced in `0.5.x` is introduced in this commit [3cbc7fc6cf631f019a4626913c0a4b616092133b](https://github.com/lbdremy/solr-node-client/commit/3cbc7fc6cf631f019a4626913c0a4b616092133b) which remove escaping of the Solr special characters in some of the methods of the `Query` class i.e in `Query#rangeFilter`, `Query#matchFilter`, `Query#group`, `Query#facet`, `Query#mlt` if you were relying on this behavior just wrap the arguments you passed to those methods into the [`solr.escapeSpecialChars(arg)`](https://github.com/lbdremy/solr-node-client/blob/master/lib/solr.js#L605) method.
92+
93+
For example, for some weird reason you wanted to escape the special char `*`, don't ask me ;)
6894

6995
```js
70-
var client = solr.createClient();
96+
var query = client.createQuery();
97+
query.q({ '*' : '*' }).rangeFilter({ field : 'id', start : 100, end : '*'})
98+
```
7199

72-
var request = client.search('q=hello', function(err, obj){
73-
console.log(err, obj);
74-
});
75-
request.setTimeout(200, function(){
76-
console.log('search timeout');
77-
});
100+
You still can:
101+
102+
```js
103+
var query = client.createQuery();
104+
query.q({ '*' : '*' }).rangeFilter({ field : 'id', start : 100, end : solr.escapeSpecialChars('*')})
78105
```
79106

80-
Post an issue if you have troubles migrating to v0.3.0.
107+
Post an issue if you have troubles migrating to v0.5.0.
81108

82109
##Migration between 0.3.x and 0.4.x
83110

@@ -97,25 +124,40 @@ client.options.bigint = true;
97124

98125
Post an issue if you have troubles migrating to v0.4.0.
99126

100-
##Migration between 0.4.x and 0.5.x
127+
##Migration between 0.2.x and 0.3.x
101128

102-
The only breaking change introduced in `0.5.x` is introduced in this commit [3cbc7fc6cf631f019a4626913c0a4b616092133b](https://github.com/lbdremy/solr-node-client/commit/3cbc7fc6cf631f019a4626913c0a4b616092133b) which remove escaping of the Solr special characters in some of the methods of the `Query` class i.e in `Query#rangeFilter`, `Query#matchFilter`, `Query#group`, `Query#facet`, `Query#mlt` if you were relying on this behavior just wrap the arguments you passed to those methods into the [`solr.escapeSpecialChars(arg)`](https://github.com/lbdremy/solr-node-client/blob/master/lib/solr.js#L605) method.
129+
The only breaking change introduced in `v0.3.0` is about method chaining of the solr `Client`.
130+
Method chaining as simply been removed because we were actually hidding something really interesting and useful
131+
the `http.ClientRequest` instance.
103132

104-
For example, for some weird reason you wanted to escape the special char `*`, don't ask me ;)
133+
So, before you could have done this:
105134

106135
```js
107-
var query = client.createQuery();
108-
query.q({ '*' : '*' }).rangeFilter({ field : 'id', start : 100, end : '*'})
136+
var client = solr.createClient();
137+
138+
client
139+
.search('q=hello', function(err, obj){
140+
console.log(err, obj);
141+
})
142+
.search('q=world', function(err, obj){
143+
console.log(err, obj);
144+
});
109145
```
110146

111-
You still can:
147+
Now it won't work, but you have now access to the `http.ClientRequest` instead created by `Client#search`:
112148

113149
```js
114-
var query = client.createQuery();
115-
query.q({ '*' : '*' }).rangeFilter({ field : 'id', start : 100, end : solr.escapeSpecialChars('*')})
150+
var client = solr.createClient();
151+
152+
var request = client.search('q=hello', function(err, obj){
153+
console.log(err, obj);
154+
});
155+
request.setTimeout(200, function(){
156+
console.log('search timeout');
157+
});
116158
```
117159

118-
Post an issue if you have troubles migrating to v0.5.0.
160+
Post an issue if you have troubles migrating to v0.3.0.
119161

120162
##Roadmap
121163

lib/solr.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ exports.createClient = createClient;
4040
* @param {Boolean} [secure=false] - if true HTTPS will be used instead of HTTP
4141
* @param {Boolean} [bigint=false] - if true JSONbig serializer/deserializer will be used instead
4242
* of JSON native serializer/deserializer
43+
* @param solrVersion ['3.2', '4.0', '5.0', '5.1'], check lib/utils/version.js for full reference
4344
*
4445
* @return {Client}
4546
* @api public

lib/utils/version.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ var Solr4_0 = 400;
77
var Solr5_0 = 500;
88
var Solr5_1 = 501;
99

10+
/**
11+
* Enum that lists supported versions of Solr. Pass one of the keys from this enum as a solrVersion property
12+
*
13+
* @type {{3.2: number, 4.0: number, 5.0: number, 5.1: number}}
14+
*/
1015
var versionsEnum = {
1116
'3.2': Solr3_2,
1217
'4.0': Solr4_0,

0 commit comments

Comments
 (0)