2

I am using node-solr-client for handling solr queries. I have written an update query as per the post here

Add and update data to Solr-4.3.0 using node module solr-client

My data is:

data = {
    'type_s':'applicant',
    'id': 5,
    'state_id':{'set':565656},
};

I have enabled autocommit to true

client = solr.createClient();
client.autoCommit = true;

When I run the code it gives me a response

{ responseHeader: { status: 0, QTime: 4 } }

Meaning it has been added to the index. But when I crosscheck using solr admin, I don't see the updates. Now when I run http://localhost:8983/solr/jobs/update?commit=true and check again then it is visible in solr admin.

4

1 に答える 1

4

最後に、私はそれを機能させました。

softcommit() を追加する必要がありました。これがコードです。

data = {
    'type_s':'applicant',
    'id': 5,
    'state_id':{'set':565656},
};

client = solr.createClient();

//client.autoCommit = true;

client.add(data, function(err, obj) {
    if (err) {
      console.log(err.stack);
    } else {
      client.softCommit();
    }
  });
});

うまくいきました。autoCommit オプションが機能していないか、設定が間違っていると思います。

于 2015-12-17T04:06:47.147 に答える