0

全文検索にsolrを使用しています。

私はsolrを初めて使用し、phpソラリウムクライアントによってsolrインデックスからレコードを削除しようとしています。次のコードを使用してレコードを削除しています:

include_once("vendor/autoload.php");
$client = new Solarium\Client();

if(isset($_POST['delete']))
{
    $update = $client->createUpdate();

    // add the delete query and a commit command to the update query
    $update->addDeleteQuery('*:*');
    $update->addCommit();

    // this executes the query and returns the result
    $result = $client->update($update);

    echo '<b>Update query executed</b><br/>';
    echo 'Query status: ' . $result->getStatus(). '<br/>';
    echo 'Query time: ' . $result->getQueryTime();
}

しかし、ブラウザで次のエラーが表示されます。

致命的なエラー: メッセージ「Solr HTTP エラー: OK (500) {"responseHeader":{"status":500,"QTime":1},"error":{"trace" を伴うキャッチされない例外 'Solarium\Exception\HttpException' :"java.lang.NullPointerException\n\tat org.apache.lucene.search.BooleanClause.hashCode(BooleanClause.java:99)\n\tat java.util.AbstractList.hashCode(AbstractList.java:542)\n\ tat org.apache.lucene.search.BooleanQuery.hashCode(BooleanQuery.java:520)\n\tat java.util.HashMap.put(HashMap.java:389)\n\tat org.apache.lucene.index.BufferedUpdates .addQuery(BufferedUpdates.java:152)\n\tat org.apache.lucene.index.DocumentsWriterDeleteQueue$QueryArrayNode.apply(DocumentsWriterDeleteQueue.java:365)\n\tat org.apache.lucene.index.DocumentsWriterDeleteQueue$DeleteSlice.apply (DocumentsWriterDeleteQueue.java:280)\n\tat org.apache.lucene.index.DocumentsWriterDeleteQueue.tryApplyGlobalSlice(DocumentsWriterDeleteQueue.java:200)\n\tat org.apache.lucene.index.DocumentsWriterDeleteQueue.addDelete(DocumentsWriterDeleteQueue.java:107)\n\tat org.apache.lucene.index.DocumentsWriter.delete /var/www/library/Solarium/Core/Query/Result/Result.php の 103 行目

4

2 に答える 2

0

すべてのインデックスを削除する場合は、ブラウザも使用できます。次のリンクをコピーしてブラウザに貼り付けるだけです。 http://localhost:8983/solr/update?stream.body=:&commit=true

于 2015-02-19T06:14:35.617 に答える
0

次のクエリを使用して、solr からレコードを削除します -

  1. ドメイン:[ポート]/solr/#/collection1/クエリ
  2. Request-Handler (qt) の「/select」を「/delete」に変更
  3. すべてのレコードを削除するには、q = :を押して Enter キーを押します。
  4. 特定の ID id: を削除するには、Enter キーを押します
于 2014-07-31T08:25:17.270 に答える