Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buffering documents in the add method and remove them after is wrong #20

Closed
lbdremy opened this issue Jul 10, 2012 · 1 comment
Closed
Labels

Comments

@lbdremy
Copy link
Owner

lbdremy commented Jul 10, 2012

I implemented this a while ago, and it appears it's not a good idea.
If buffering is necessary it should be done outside of this method.

Case where it causes trouble:

var solr = require('solr-client');
var client1 = solr.createClient({host : 'localhost',port : 8983});
var client2 = solr.createClient({host: '12.67.78.98',port : 8983});
var docs = [ { id : 3938, title: 'blalbkjj'},{ id :78783, title : 'broubrou'}];
client1.add(docs,function(err,obj){});
client2.add(docs,function(err,obj){}); // Well, I'm sorry for you client2 but your array of docs is empty

The quick fix, without breaking the buffering feature in the add method would be to clean the array of docs only if this.updateEach !=1 and so add a condition where the splice is done
if(this.updateEach != 1){ this.adds.splice(0,this.adds.length); // Remove every elements}

I will remove the buffering feature and so this.adds, and the method flushAdd in the next minor release but for now I will just add this condition above.

@lbdremy
Copy link
Owner Author

lbdremy commented Jul 10, 2012

Actually the suite test doesn't pass with this change, so let's drop this feature in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant