mirror of
https://github.com/YGGverse/Yo.git
synced 2025-03-13 05:41:18 +00:00
add rank field
This commit is contained in:
parent
6f4abe4729
commit
50dc9d315a
@ -47,7 +47,15 @@ if ($result->getTotal())
|
|||||||
// Add
|
// Add
|
||||||
$result = $index->addDocument(
|
$result = $index->addDocument(
|
||||||
[
|
[
|
||||||
'url' => $url
|
'url' => $url,
|
||||||
|
'rank' => (int) mb_strlen(
|
||||||
|
urldecode(
|
||||||
|
parse_url(
|
||||||
|
$url,
|
||||||
|
PHP_URL_PATH
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
],
|
],
|
||||||
$crc32url
|
$crc32url
|
||||||
);
|
);
|
||||||
|
@ -104,6 +104,7 @@ foreach($index->search('')
|
|||||||
'code' => $document->get('code'),
|
'code' => $document->get('code'),
|
||||||
'size' => $document->get('size'),
|
'size' => $document->get('size'),
|
||||||
'mime' => $document->get('mime'),
|
'mime' => $document->get('mime'),
|
||||||
|
'rank' => $document->get('rank'),
|
||||||
'time' => $time
|
'time' => $time
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -359,15 +360,21 @@ foreach($index->search('')
|
|||||||
->get()
|
->get()
|
||||||
->getTotal())
|
->getTotal())
|
||||||
{
|
{
|
||||||
echo 'add';
|
|
||||||
/*
|
|
||||||
$index->addDocument(
|
$index->addDocument(
|
||||||
[
|
[
|
||||||
'url' => $url
|
'url' => $url,
|
||||||
|
'rank' => (int) mb_strlen(
|
||||||
|
urldecode(
|
||||||
|
parse_url(
|
||||||
|
$url,
|
||||||
|
PHP_URL_PATH
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
],
|
],
|
||||||
$crc32url
|
$crc32url
|
||||||
);
|
);
|
||||||
*/
|
|
||||||
|
|
||||||
if ($config->cli->document->crawl->debug->level->notice)
|
if ($config->cli->document->crawl->debug->level->notice)
|
||||||
{
|
{
|
||||||
@ -385,16 +392,10 @@ foreach($index->search('')
|
|||||||
|
|
||||||
// Replace document data
|
// Replace document data
|
||||||
// https://github.com/manticoresoftware/manticoresearch-php/issues/10#issuecomment-612685916
|
// https://github.com/manticoresoftware/manticoresearch-php/issues/10#issuecomment-612685916
|
||||||
|
|
||||||
// @TODO optimization for replacements required
|
|
||||||
// https://manual.manticoresearch.com/Data_creation_and_modification/Updating_documents/REPLACE
|
|
||||||
echo 'replace';
|
|
||||||
/*
|
|
||||||
$result = $index->replaceDocument(
|
$result = $index->replaceDocument(
|
||||||
$data,
|
$data,
|
||||||
$document->getId()
|
$document->getId()
|
||||||
);
|
);
|
||||||
*/
|
|
||||||
|
|
||||||
// Debug result
|
// Debug result
|
||||||
if ($config->cli->document->crawl->debug->level->notice)
|
if ($config->cli->document->crawl->debug->level->notice)
|
||||||
|
@ -76,6 +76,10 @@ $result = $index->create(
|
|||||||
[
|
[
|
||||||
'type' => 'integer'
|
'type' => 'integer'
|
||||||
],
|
],
|
||||||
|
'rank' =>
|
||||||
|
[
|
||||||
|
'type' => 'integer'
|
||||||
|
],
|
||||||
'time' =>
|
'time' =>
|
||||||
[
|
[
|
||||||
'type' => 'integer'
|
'type' => 'integer'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user