set crc32url as document id

This commit is contained in:
ghost 2024-01-22 22:52:37 +02:00
parent 93baed4b90
commit 6f4abe4729
7 changed files with 25 additions and 73 deletions

View file

@ -29,7 +29,7 @@ $crc32url = crc32($url);
// Check URL for exist
$result = $index->search('')
->filter('crc32url', $crc32url)
->filter('id', $crc32url)
->limit(1)
->get();
@ -47,9 +47,9 @@ if ($result->getTotal())
// Add
$result = $index->addDocument(
[
'url' => $url,
'crc32url' => $crc32url
]
'url' => $url
],
$crc32url
);
echo sprintf(