From 13cf61b42c406995dfbe2e97250ceb6cde5b0ecf Mon Sep 17 00:00:00 2001 From: ghost Date: Sun, 19 Nov 2023 23:34:13 +0200 Subject: [PATCH] fix debug output --- src/cli/document/crawl.php | 47 ++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/src/cli/document/crawl.php b/src/cli/document/crawl.php index 7de5856..856ecdb 100644 --- a/src/cli/document/crawl.php +++ b/src/cli/document/crawl.php @@ -163,20 +163,36 @@ foreach($search->get() as $document) // Replace document // https://github.com/manticoresoftware/manticoresearch-php/issues/10#issuecomment-612685916 - $index->replaceDocument( - [ - 'url' => $document->get('url'), - 'title' => $title, - 'description' => $description, - 'keywords' => $keywords, - 'code' => $code, - 'size' => $size, - 'mime' => $mime, - 'time' => time(), - ], + $data = + [ + 'url' => $document->get('url'), + 'title' => $title, + 'description' => $description, + 'keywords' => $keywords, + 'code' => $code, + 'size' => $size, + 'mime' => $mime, + 'time' => time() + ]; + + $result = $index->replaceDocument( + $data, $document->getId() ); + echo sprintf( + 'index "%s" updated: %s %s' . PHP_EOL, + $config->manticore->index->document, + print_r( + $result, + true + ), + print_r( + $data, + true + ), + ); + // Crawl documents $documents = []; @@ -257,13 +273,4 @@ foreach($search->get() as $document) } } } - - echo sprintf( - 'index "%s" updated: %s' . PHP_EOL, - $config->manticore->index->document, - print_r( - $document, - true - ) - ); } \ No newline at end of file