Coder Social home page Coder Social logo

Comments (5)

lbdremy avatar lbdremy commented on June 15, 2024

Hi @mvolkmann ,
Yes you're right I haven't tested this method yet, this the reason why #18 is still open.
Well this issue seems a good occasion to add the test. ^^
The example given at http://lbdremy.github.com/solr-node-client/code/addRemoteResource.js.html .
works for me.
Could you paste the code that is not working.

from solr-node-client.

mvolkmann avatar mvolkmann commented on June 15, 2024

Here is an example of code that doesn't work for me:

var solr = require('solr-client');
var client = solr.createClient();

var options = {
  path: __dirname + '/more.json',
  format: 'json'
};
client.addRemoteResource(options, function (err) {
  console.log('err =', err);
});

Here is the content of more.json:

{
  "id": 4,
  "title": "more",
  "description": "All about more"
}

from solr-node-client.

lbdremy avatar lbdremy commented on June 15, 2024

The json in the file more.json doesn't have the structure expected by Solr.
Try with this:
more.json

[{
  "id": 4,
  "title": "more",
  "description": "All about more"
}]

Also if you want that Solr commits the documents when adding them, do

client.autoCommit = true;

Let me know if it works for you.

from solr-node-client.

mvolkmann avatar mvolkmann commented on June 15, 2024

That works. Thanks! I didn't realize that the JSON needed to be an array of documents rather than a single document.

Maybe it should check whether the JSON is an array and assume it is a single document when it is not an array.

from solr-node-client.

lbdremy avatar lbdremy commented on June 15, 2024

Well it would be a job for Solr so!
Let me know if you have others issues.

from solr-node-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.