异常写文档ID

Bri*_*ell 5 php solr solr5

我有一个solr 5.4.1表,我允许用户发表评论.通过PHP,用户运行以下功能:

function solr_update($id, $comments) {
  $ch = curl_init("http://url:8983/solr/asdf/update?commit=true");


  $data = array(
            "id" => $id,
            "comments" => array(
              "set" => $comments),
            );

  $data_string = json_encode(array($data));          

  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  curl_setopt($ch, CURLOPT_POST, TRUE);
  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
  curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);

  echo curl_exec($ch);

}
Run Code Online (Sandbox Code Playgroud)

虽然大部分时间都有效但我得到了这样的答复:

{"responseHeader":{"status":0,"QTime":83}}
Run Code Online (Sandbox Code Playgroud)

最近,当我得到这样的回应时,我已经遇到过这种情况curl_exec($ch).

{"responseHeader":{"status":400,"QTime":6},
"error":{"msg":"Exception writing document id 376299 
to the index; possible analysis error.","code":400}}
Run Code Online (Sandbox Code Playgroud)

我不确定是什么导致这种情况,但是当它发生时,它就像整个表死了,我必须使用恢复点来恢复它 (http://url:8983/solr/asdf/replication?command=restore&name=solr_backup_20161028).

如果我尝试在solr(http://url:8983/solr/asdf)中加载核心,则不会出现任何记录,并显示"Luke未配置".虽然我仍然可以运行查询:( http://url:8983/solr/asdf/select?q=*:*),我根本看不到记录计数或修改数据库.

我做错了导致我的桌子被损坏了吗?

编辑

赏金时间.我真的需要一些帮助解决这个问题!

Edit2 - 服务器日志

d:\ Solr的\ Solr的-5.4.1 \服务器\日志\ solr.log.2

    2016-11-15 13:59:49.997 ERROR (qtp434176574-19) [   x:invoice] 
o.a.s.s.HttpSolrCall null:org.apache.lucene.index.IndexNotFoundException:
 no segments* file found in
 NRTCachingDirectory(MMapDirectory@D:\solr\solr-
5.4.1\server\solr\asdf\data\restore.snapshot.solr_backup_20161104
 lockFactory=org.apache.lucene.store.NativeFSLockFactory@17df8f10;
 maxCacheMB=48.0 maxMergeSizeMB=4.0): files: [_pej4.fdt,
 _pej4_Lucene50_0.doc, _pej4_Lucene50_0.tim, _wxvy.fdt,
 _wxvy_Lucene50_0.doc, _wxvy_Lucene50_0.tim]
Run Code Online (Sandbox Code Playgroud)

另外,我现在在我的asdf/data文件夹中有几个"solr_backupYYYYMM"文件夹.我可以手动删除这些而不会导致问题吗?我相信,唯一能在下午5点之后对solr运行的是我每晚写入备份solr的python脚本,并且作为脚本的一部分,它当前正在删除任何具有YYYYMM7天的字符串的文件夹(所以我没有用完空间).截至昨天我已经从脚本中删除了那部分内容,以防可能导致问题的原因.我只是想想一切.

在此输入图像描述

Ser*_*dev 2

看来您的问题在这里描述:http://lucene.472066.n3.nabble.com/Exception-writing-document-to-the-index-possible-analysis-error-td4174845.html

由于有一个完整的讨论,我将复制两个引文和讨论底线:

“我认为您已尝试将空字符串索引到数字字段中。这是行不通的。它必须是有效的数字,否则您需要将该字段完全保留”。

“该字段_collection_id在架构中是必需的,但未填写在我的更新请求中”。

你的第二个问题“ IndexNotFoundException: no segments* file found in”发生是因为在异常 IndexWriter 死掉后write.lock,临时索引文件就位。此问题在https://wilsonericn.wordpress.com/2011/12/14/my-first-5-lucene-mistakes的“#3:保持 IndexWriter 打开”下进行了描述。标题。