【问题标题】:node-solr-client: Updating Document and Commitingnode-solr-client:更新文档并提交
【发布时间】:2016-03-22 18:28:56
【问题描述】:

我正在使用 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 中可见。

【问题讨论】:

    标签: node.js solr client solr5


    【解决方案1】:

    终于搞定了。

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

    【讨论】:

    • 是的,我想说 auoCommit 选项要么不起作用,要么非常神秘。
    猜你喜欢
    • 2016-01-01
    • 1970-01-01
    • 2022-09-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多