Browse Source

add cleanup limit argument

main
yggverse 9 months ago
parent
commit
79b82d46e1
  1. 6
      README.md
  2. 10
      src/cli/document/clean.php

6
README.md

@ -99,11 +99,13 @@ php src/cli/document/crawl.php @@ -99,11 +99,13 @@ php src/cli/document/crawl.php
##### Clean
Make index optimization, apply new configuration rules
```
php src/cli/document/clean.php
php src/cli/document/clean.php [limit]
```
* make index optimization
* `limit` - integer, documents quantity per queue
##### Search

10
src/cli/document/clean.php

@ -79,7 +79,15 @@ foreach ($config->cli->document->crawl->skip->stripos->url as $condition) @@ -79,7 +79,15 @@ foreach ($config->cli->document->crawl->skip->stripos->url as $condition)
$documents = 0;
$snaps = 0;
foreach($index->search(sprintf('@url "%s"', $condition))->get() as $document)
foreach(
$index->search(
sprintf(
'@url "%s"',
$condition
)
)->limit(
isset($argv[1]) ? (int) $argv[1] : 10
)->get() as $document)
{
// Delete found document by it ID
$result = $index->deleteDocument(

Loading…
Cancel
Save