From 133548a98ced6153dc748c946d2a30a3614858cc Mon Sep 17 00:00:00 2001 From: ghost Date: Sun, 26 Nov 2023 20:53:31 +0200 Subject: [PATCH] fix url check conditions --- src/cli/document/add.php | 2 +- src/cli/document/crawl.php | 2 +- src/cli/yggo/import.php | 2 +- src/webui/search.php | 12 ++++++------ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/cli/document/add.php b/src/cli/document/add.php index c65dd00..4e62fe0 100644 --- a/src/cli/document/add.php +++ b/src/cli/document/add.php @@ -28,7 +28,7 @@ $url = trim($argv[1]); $crc32url = crc32($url); // Check URL for exist -$result = $index->search('@url "' . $url . '"') +$result = $index->search('') ->filter('crc32url', $crc32url) ->limit(1) ->get(); diff --git a/src/cli/document/crawl.php b/src/cli/document/crawl.php index 1cd9549..f661d7f 100644 --- a/src/cli/document/crawl.php +++ b/src/cli/document/crawl.php @@ -255,7 +255,7 @@ foreach($search->get() as $document) $url = trim($url); $crc32url = crc32($url); - if (!$index->search('@url "' . $url . '"') + if (!$index->search('') ->filter('crc32url', $crc32url) ->limit(1) ->get() diff --git a/src/cli/yggo/import.php b/src/cli/yggo/import.php index 611a8f8..7116cde 100644 --- a/src/cli/yggo/import.php +++ b/src/cli/yggo/import.php @@ -127,7 +127,7 @@ for ($i = 0; $i <= $total; $i++) // Check for unique URL requested if (isset($argv[6])) { - $local = $index->search('@url "' . trim($url) . '"') + $local = $index->search('') ->filter('crc32url', $crc32url) ->limit(1) ->get(); diff --git a/src/webui/search.php b/src/webui/search.php index 7aaec77..6a2fd32 100644 --- a/src/webui/search.php +++ b/src/webui/search.php @@ -59,11 +59,11 @@ if ($config->webui->search->index->request->url->enabled && filter_var($q, FILTE $crc32url = crc32($url); // Check URL for exist - $exist = $index->search('@url "' . $url . '"') - ->filter('crc32url', $crc32url) - ->limit(1) - ->get() - ->getTotal(); + $exist = $index->search('') + ->filter('crc32url', $crc32url) + ->limit(1) + ->get() + ->getTotal(); if ($exist) { @@ -107,7 +107,7 @@ switch (true) { case filter_var($q, FILTER_VALIDATE_URL): - $query = $index->search('@url "' . $q . '"')->filter('crc32url', crc32($q)); + $query = $index->search('')->filter('crc32url', crc32($q)); break;