我正在使用node-solr-client来处理solr查询。我按照这里的帖子写了一个更新查询
Add and update data to Solr-4.3.0 using node module solr-client
我的数据是:
data = {
'type_s':'applicant',
'id': 5,
'state_id':{'set':565656},
};
我已启用autocommit为true
client = solr.createClient();
client.autoCommit = true;
当我运行代码时,它会给我一个回复
{ responseHeader: { status: 0, QTime: 4 } }
意味着它已被添加到索引中。但是当我使用solr admin进行交叉检查时,我看不到更新。现在,当我运行http://localhost:8983/solr/jobs/update?commit=true并再次检查时,它在solr admin中可见。
答案 0 :(得分:2)
最后我开始工作了。
我只需要添加一个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选项不起作用或我错误配置了什么。