gpt4 book ai didi

node.js - Node solr 客户端 : Updating Document and Commiting

转载 作者:太空宇宙 更新时间:2023-11-03 23:34:28 25 4
gpt4 key购买 nike

我正在使用 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},
};

我已启用自动提交为 true

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

当我运行代码时,它会给我一个响应

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

表示它已被添加到索引中。但是当我使用 solr admin 进行交叉检查时,我没有看到更新。现在当我运行http://localhost:8983/solr/jobs/update?commit=true时并再次检查,然后它在 solr admin 中可见。

最佳答案

终于我成功了。

我只需要添加一个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 选项不起作用或者我配置错误。

关于node.js - Node solr 客户端 : Updating Document and Commiting,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34315084/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com