Add the ability to delete query statitics from the ui, do not count api queries in stats, a=chris

Chris Pollett [2022-11-06 02:Nov:th]
Add the ability to delete query statitics from the ui, do not count api queries in stats, a=chris
Filename
src/configs/Config.php
src/controllers/SearchController.php
src/controllers/components/CrawlComponent.php
src/locale/ar/configure.ini
src/locale/bn/configure.ini
src/locale/de/configure.ini
src/locale/el_GR/configure.ini
src/locale/en_US/configure.ini
src/locale/en_US/statistics.txt
src/locale/es/configure.ini
src/locale/fa/configure.ini
src/locale/fr_FR/configure.ini
src/locale/he/configure.ini
src/locale/hi/configure.ini
src/locale/id/configure.ini
src/locale/it/configure.ini
src/locale/ja/configure.ini
src/locale/kn/configure.ini
src/locale/ko/configure.ini
src/locale/nl/configure.ini
src/locale/pl/configure.ini
src/locale/pt/configure.ini
src/locale/ru/configure.ini
src/locale/te/configure.ini
src/locale/th/configure.ini
src/locale/tl/configure.ini
src/locale/tr/configure.ini
src/locale/vi_VN/configure.ini
src/locale/zh_CN/configure.ini
src/models/ImpressionModel.php
src/views/elements/QuerystatsElement.php
diff --git a/src/configs/Config.php b/src/configs/Config.php
index 925b3176e..b58d3e884 100755
--- a/src/configs/Config.php
+++ b/src/configs/Config.php
@@ -1207,7 +1207,7 @@ nsdefine('GROUP_IMPRESSION', 3);
  */
 nsdefine('QUERY_IMPRESSION', 4);
 /**
- * Impression type used to record one search query view
+ * Impression type used to record one search cache request view
  */
 nsdefine('CACHE_IMPRESSION', 5);
 /**
diff --git a/src/controllers/SearchController.php b/src/controllers/SearchController.php
index a8e1a3bd2..f92be4e84 100755
--- a/src/controllers/SearchController.php
+++ b/src/controllers/SearchController.php
@@ -1420,7 +1420,8 @@ EOD;
             $phrase_results['TOTAL_ROWS'] : 0;
         $data['LIMIT'] = $limit;
         $data['RESULTS_PER_PAGE'] = $results_per_page;
-        if ($add_query_impression && !empty($data['QUERY'])) {
+        if ($add_query_impression && !empty($data['QUERY'])
+            && strtolower($_REQUEST['f']) != 'api') {
             $this->model("impression")->addQueryImpression($data['QUERY']);
         }
     }
diff --git a/src/controllers/components/CrawlComponent.php b/src/controllers/components/CrawlComponent.php
index 5e666c2d3..e1a822fab 100644
--- a/src/controllers/components/CrawlComponent.php
+++ b/src/controllers/components/CrawlComponent.php
@@ -71,8 +71,8 @@ class CrawlComponent extends Component implements CrawlConstants
         $parent = $this->parent;
         $crawl_model = $parent->model("crawl");
         $possible_arguments =
-            ["delete", "index", "options", "querystats", "resume", "start",
-            "statistics", "stop"];
+            ["delete", "deletestats", "index", "options", "querystats",
+            "resume", "start", "statistics", "stop"];
         $need_machines_arguments = ["delete", "options", "resume", "statistics",
             "start", "stop"];
         $data["ELEMENT"] = "managecrawls";
@@ -117,6 +117,14 @@ class CrawlComponent extends Component implements CrawlConstants
                             $request_fields);
                      }
                     break;
+                case "deletestats":
+                    $_REQUEST['arg'] = "querystats";
+                    $impression_model = $parent->model("impression");
+                    $impression_model->deleteQueryStatistics();
+                    return $parent->redirectWithMessage(
+                        tl('crawl_component_stats_deleted'),
+                        array_merge(["arg"], $request_fields));
+                    break;
                 case "index":
                     $timestamp = substr($parent->clean($_REQUEST['timestamp'],
                         "int"), 0,  C\TIMESTAMP_LEN);
@@ -129,6 +137,7 @@ class CrawlComponent extends Component implements CrawlConstants
                     break;
                 case "querystats":
                     $data["ELEMENT"] = "querystats";
+                    $data['SCRIPT'] = "";
                     $data["leftorright"] = (L\getLocaleDirection() == 'ltr') ?
                         "right": "left";
                     $impression_model = $parent->model("impression");
@@ -3166,4 +3175,4 @@ class CrawlComponent extends Component implements CrawlConstants
         }
         return $data;
     }
-}
\ No newline at end of file
+}
diff --git a/src/locale/ar/configure.ini b/src/locale/ar/configure.ini
index 344ce6d41..e376fb589 100755
--- a/src/locale/ar/configure.ini
+++ b/src/locale/ar/configure.ini
@@ -403,6 +403,7 @@ store_component_ad_updated = "الإعلان تحديث"
 ; CrawlComponent.php
 crawl_component_delete_crawl_success = "حذف الزحف. . .هذا سوف يستغرق بعض وقت لتحديث ."
 crawl_component_delete_crawl_fail = "حذف فشل الزحف!!"
+crawl_component_stats_deleted = ""
 crawl_component_set_index = "وضع الزحف لاستخدامها كمؤشر"
 managegroups_element_no_activity = "أي نشاط"
 crawl_component_resume_crawl = "استئناف الزحف. . .هذا سوف يستغرق بعض وقت لتحديث ."
diff --git a/src/locale/bn/configure.ini b/src/locale/bn/configure.ini
index b35757141..b698b9110 100755
--- a/src/locale/bn/configure.ini
+++ b/src/locale/bn/configure.ini
@@ -403,6 +403,7 @@ store_component_ad_updated = "বিজ্ঞাপন আপডেট"
 ; CrawlComponent.php
 crawl_component_delete_crawl_success = "মুছে ফেলার হামাগুড়ি. . .এই একটি মুহূর্ত, নিতে হবে রিফ্রেশ করুন."
 crawl_component_delete_crawl_fail = "মুছে হামাগুড়ি ব্যর্থ!!"
+crawl_component_stats_deleted = ""
 crawl_component_set_index = "সেটিং হামাগুড়ি হিসাবে ব্যবহার করার জন্য সূচক"
 managegroups_element_no_activity = "কোন কার্যকলাপ"
 crawl_component_resume_crawl = "চালু হামাগুড়ি. . .এই একটি মুহূর্ত, নিতে হবে রিফ্রেশ করুন."
diff --git a/src/locale/de/configure.ini b/src/locale/de/configure.ini
index 71109edbb..1e7255d6c 100755
--- a/src/locale/de/configure.ini
+++ b/src/locale/de/configure.ini
@@ -403,6 +403,7 @@ store_component_ad_updated = "Werbung Aktualisiert"
 ; CrawlComponent.php
 crawl_component_delete_crawl_success = "Löschen Kriechen. . .Dies wird einen moment dauern, zu aktualisieren."
 crawl_component_delete_crawl_fail = "Löschen Crawl Gescheitert!!"
+crawl_component_stats_deleted = ""
 crawl_component_set_index = "Einstellung Kriechen Zu Verwenden, die als Index"
 managegroups_element_no_activity = "Keine Aktivität"
 crawl_component_resume_crawl = "Wiederaufnahme kriechen. . .Dies wird einen moment dauern, zu aktualisieren."
diff --git a/src/locale/el_GR/configure.ini b/src/locale/el_GR/configure.ini
index 183c66665..769043cc6 100644
--- a/src/locale/el_GR/configure.ini
+++ b/src/locale/el_GR/configure.ini
@@ -403,6 +403,7 @@ store_component_ad_updated = "Η διαφήμιση ενημερώθηκε"
 ; CrawlComponent.php
 crawl_component_delete_crawl_success = "Διαγραφή Ανίχνευσης...Θα χρειαστεί λίγος χρόνος για να ανανεωθεί."
 crawl_component_delete_crawl_fail = "Η διαγραφή σάρωσης απέτυχε!!"
+crawl_component_stats_deleted = ""
 crawl_component_set_index = "Ρύθμιση σάρωσης για χρήση ως ευρετήριο"
 managegroups_element_no_activity = "Καμία δραστηριότητα"
 crawl_component_resume_crawl = "Συνέχιση σάρωσης...Θα χρειαστεί λίγος χρόνος για να ανανεωθεί."
diff --git a/src/locale/en_US/configure.ini b/src/locale/en_US/configure.ini
index 8a5258605..c38f0ec14 100644
--- a/src/locale/en_US/configure.ini
+++ b/src/locale/en_US/configure.ini
@@ -403,6 +403,7 @@ store_component_ad_updated = "Advertisement Updated"
 ; CrawlComponent.php
 crawl_component_delete_crawl_success = "Deleting Crawl. . .This will take a moment to refresh."
 crawl_component_delete_crawl_fail = "Delete Crawl Failed!!"
+crawl_component_stats_deleted = "Query Statists Deleted!"
 crawl_component_set_index = "Setting Crawl To Use as Index"
 managegroups_element_no_activity = "No Activity"
 crawl_component_resume_crawl = "Resuming crawl. . .This will take a moment to refresh."
@@ -557,7 +558,7 @@ crawl_component_regex_feed = "Regex Feed"
 crawl_component_feed_podcast = "Feed Podcast"
 crawl_component_scrape_podcast = "Scrape Podcast"
 crawl_component_trending_value = "Trending Value"
-crawl_component_description_source = ""
+crawl_component_description_source = "Description Source"
 crawl_component_never = "Never"
 crawl_component_one_day = "One Day"
 crawl_component_one_week = "One Week"
diff --git a/src/locale/en_US/statistics.txt b/src/locale/en_US/statistics.txt
index b6bef56f0..5a165df53 100755
--- a/src/locale/en_US/statistics.txt
+++ b/src/locale/en_US/statistics.txt
@@ -1 +1 @@
-d:99;
\ No newline at end of file
+d:100;
\ No newline at end of file
diff --git a/src/locale/es/configure.ini b/src/locale/es/configure.ini
index ad69bd2ea..084b0328a 100755
--- a/src/locale/es/configure.ini
+++ b/src/locale/es/configure.ini
@@ -403,6 +403,7 @@ store_component_ad_updated = "Anuncio Actualizado"
 ; CrawlComponent.php
 crawl_component_delete_crawl_success = "Eliminando el rastreo. . . Esto tomará un momento para recargar."
 crawl_component_delete_crawl_fail = "Eliminar el rastreo no tuvo éxito"
+crawl_component_stats_deleted = ""
 crawl_component_set_index = "Usar el rastreo como índice"
 managegroups_element_no_activity = "No Hay Actividad"
 crawl_component_resume_crawl = "Reanundando el rastreo. . . Esto tomará un momento para recargar."
diff --git a/src/locale/fa/configure.ini b/src/locale/fa/configure.ini
index 9f07551f8..7ea152bc9 100755
--- a/src/locale/fa/configure.ini
+++ b/src/locale/fa/configure.ini
@@ -403,6 +403,7 @@ store_component_ad_updated = "تبلیغات به روز شده"
 ; CrawlComponent.php
 crawl_component_delete_crawl_success = "در حال حذف کردن خزش ... چند لحظه تا باز آوری طول می‌کشد. "
 crawl_component_delete_crawl_fail = "حذف خزش شکست خورد!!"
+crawl_component_stats_deleted = ""
 crawl_component_set_index = "قرار دادن خزش به عنوان نمایه"
 managegroups_element_no_activity = "هیچ فعالیت"
 crawl_component_resume_crawl = "در حال از سرگیری خزش ... چند لحظه تا باز آوری طول می‌کشد. "
diff --git a/src/locale/fr_FR/configure.ini b/src/locale/fr_FR/configure.ini
index 9709f534e..151a6ecdf 100755
--- a/src/locale/fr_FR/configure.ini
+++ b/src/locale/fr_FR/configure.ini
@@ -403,6 +403,7 @@ store_component_ad_updated = "Annonce mise à jour"
 ; CrawlComponent.php
 crawl_component_delete_crawl_success = "La suppression d'analyse. . .Cela va prendre un moment pour se rafraîchir."
 crawl_component_delete_crawl_fail = "Suppression d'analyse a échoué!!"
+crawl_component_stats_deleted = ""
 crawl_component_set_index = "Paramètre d'analyse à utiliser comme Indice"
 managegroups_element_no_activity = "Aucune activité"
 crawl_component_resume_crawl = "De reprendre l'analyse. . .Cela va prendre un moment pour se rafraîchir."
diff --git a/src/locale/he/configure.ini b/src/locale/he/configure.ini
index a65c149bc..9b766f7f4 100755
--- a/src/locale/he/configure.ini
+++ b/src/locale/he/configure.ini
@@ -403,6 +403,7 @@ store_component_ad_updated = "פרסומת מעודכן"
 ; CrawlComponent.php
 crawl_component_delete_crawl_success = "מחיקת לזחול. . .זה יקח כמה דקות כדי לרענן."
 crawl_component_delete_crawl_fail = "למחוק לזחול נכשל!!"
+crawl_component_stats_deleted = ""
 crawl_component_set_index = "הגדרת לזחול להשתמש כמו מדד"
 managegroups_element_no_activity = "אין פעילות"
 crawl_component_resume_crawl = "חידוש לזחול. . .זה יקח כמה דקות כדי לרענן."
diff --git a/src/locale/hi/configure.ini b/src/locale/hi/configure.ini
index 9f77050a8..2484b2a0d 100755
--- a/src/locale/hi/configure.ini
+++ b/src/locale/hi/configure.ini
@@ -403,6 +403,7 @@ store_component_ad_updated = "विज्ञापन अद्यतन"
 ; CrawlComponent.php
 crawl_component_delete_crawl_success = "हटाने क्रॉल. . .इस ले जाएगा एक पल को ताज़ा करने के लिए."
 crawl_component_delete_crawl_fail = "हटाने क्रॉल में विफल रहा है!!"
+crawl_component_stats_deleted = ""
 crawl_component_set_index = "सेटिंग क्रॉल करने के लिए उपयोग के रूप में सूचकांक"
 managegroups_element_no_activity = "कोई गतिविधि"
 crawl_component_resume_crawl = "क्रॉल पुनः आरंभ करें"
diff --git a/src/locale/id/configure.ini b/src/locale/id/configure.ini
index fd703b92a..d88934845 100755
--- a/src/locale/id/configure.ini
+++ b/src/locale/id/configure.ini
@@ -403,6 +403,7 @@ store_component_ad_updated = "Iklan Diperbarui"
 ; CrawlComponent.php
 crawl_component_delete_crawl_success = "Menghapus Crawl. . .Ini akan mengambil waktu sejenak untuk me-refresh."
 crawl_component_delete_crawl_fail = "Menghapus Crawl Gagal!!"
+crawl_component_stats_deleted = ""
 crawl_component_set_index = "Pengaturan Merangkak Untuk Digunakan sebagai Indeks"
 managegroups_element_no_activity = "Tidak Ada Kegiatan"
 crawl_component_resume_crawl = "Melanjutkan merangkak. . .Ini akan mengambil waktu sejenak untuk me-refresh."
diff --git a/src/locale/it/configure.ini b/src/locale/it/configure.ini
index 525ae584f..b9182f021 100755
--- a/src/locale/it/configure.ini
+++ b/src/locale/it/configure.ini
@@ -403,6 +403,7 @@ store_component_ad_updated = "Annuncio Aggiornato"
 ; CrawlComponent.php
 crawl_component_delete_crawl_success = "Scansione cancellata... Serve qualche momento per aggiornare."
 crawl_component_delete_crawl_fail = "Cancellazione Scansione fallita!!"
+crawl_component_stats_deleted = ""
 crawl_component_set_index = "Usa Scansione come indice"
 managegroups_element_no_activity = "Nessuna Attività"
 crawl_component_resume_crawl = "Scansione ripresa... Serve qualche momento per aggiornare."
diff --git a/src/locale/ja/configure.ini b/src/locale/ja/configure.ini
index ee06e2c7a..6e6d3920a 100755
--- a/src/locale/ja/configure.ini
+++ b/src/locale/ja/configure.ini
@@ -403,6 +403,7 @@ store_component_ad_updated = "広告更新"
 ; CrawlComponent.php
 crawl_component_delete_crawl_success = "検索を削除する。ちょっと待ってください。"
 crawl_component_delete_crawl_fail = "検索削除を失敗しました"
+crawl_component_stats_deleted = ""
 crawl_component_set_index = "指数のための検索設定する。"
 managegroups_element_no_activity = "活動なし"
 crawl_component_resume_crawl = "検索を再会する。ちょっと待ってください。"
diff --git a/src/locale/kn/configure.ini b/src/locale/kn/configure.ini
index a27639f41..8c57d8e17 100755
--- a/src/locale/kn/configure.ini
+++ b/src/locale/kn/configure.ini
@@ -403,6 +403,7 @@ store_component_ad_updated = "ಜಾಹೀರಾತು ಅಪ್ಡೇಟ್ಗ
 ; CrawlComponent.php
 crawl_component_delete_crawl_success = "ಕ್ರಾವ್ಲನ್ನು ಅಳಿಸುತಿದ್ದಿವಿ...ಈ ತೆರೆ ಸ್ವಲ್ಪ ಕ್ಷಣಗಳ ನಂತರ ಮಾರ್ಪಡುವುದು"
 crawl_component_delete_crawl_fail = "ಕ್ರಾವ್ಲನ್ನು ಅಳಿಸಲು ವಿಫಲವಾಗಿದೆ!! "
+crawl_component_stats_deleted = ""
 crawl_component_set_index = "ಸೂಚಿಕೆಯಾಗಿ ಹೊಂದಿಸಲಾಗುತ್ತಿದೆ"
 managegroups_element_no_activity = "ಯಾವುದೇ ಚಟುವಟಿಕೆ"
 crawl_component_resume_crawl = "ಕ್ರಾವ್ಲನ್ನು ಮರುಚಾಲಿಸುತಿದ್ದಿ...ಈ ತೆರೆ ಸ್ವಲ್ಪ ಕ್ಷಣಗಳ ನಂತರ ಮಾರ್ಪಡುವುದು "
diff --git a/src/locale/ko/configure.ini b/src/locale/ko/configure.ini
index 102b31981..fc6ef735c 100755
--- a/src/locale/ko/configure.ini
+++ b/src/locale/ko/configure.ini
@@ -403,6 +403,7 @@ store_component_ad_updated = "광고 업데이트"
 ; CrawlComponent.php
 crawl_component_delete_crawl_success = "크롤을 삭제합니다. 잠시만 기다려 주십시요."
 crawl_component_delete_crawl_fail = "크롤 삭제 실패!!"
+crawl_component_stats_deleted = ""
 crawl_component_set_index = "크롤을 인덱스로써 사용하기 지정"
 managegroups_element_no_activity = "활동이 없"
 crawl_component_resume_crawl = "크롤을 다시 시작합니다. 잠시만 기다려 주십시요."
diff --git a/src/locale/nl/configure.ini b/src/locale/nl/configure.ini
index 5de6c1fe9..6f2da4390 100644
--- a/src/locale/nl/configure.ini
+++ b/src/locale/nl/configure.ini
@@ -403,6 +403,7 @@ store_component_ad_updated = "Advertentie Bijgewerkt"
 ; CrawlComponent.php
 crawl_component_delete_crawl_success = "Verwijderen Crawl. . .Dit Zal even duren om te vernieuwen."
 crawl_component_delete_crawl_fail = "Wis Crawl!! mislukt"
+crawl_component_stats_deleted = ""
 crawl_component_set_index = "Instellen Crawl om te gebruiken als Index"
 managegroups_element_no_activity = "Geen Activiteit"
 crawl_component_resume_crawl = "Hervatten kruipen. . .Dit Zal even duren om te vernieuwen."
diff --git a/src/locale/pl/configure.ini b/src/locale/pl/configure.ini
index 588496997..633d20167 100755
--- a/src/locale/pl/configure.ini
+++ b/src/locale/pl/configure.ini
@@ -403,6 +403,7 @@ store_component_ad_updated = "Ogłoszenie Aktualizacja"
 ; CrawlComponent.php
 crawl_component_delete_crawl_success = "Usuwanie Czołgać. . .To zajmie trochę czasu, aby zaktualizować."
 crawl_component_delete_crawl_fail = "Usunąć Czołgać Nie Mógł!!"
+crawl_component_stats_deleted = ""
 crawl_component_set_index = "Konfigurowanie indeksowania do wykorzystania jako indeksu"
 managegroups_element_no_activity = "Żadnej Aktywności"
 crawl_component_resume_crawl = "Wznowienie obchód. . .To zajmie trochę czasu, aby zaktualizować."
diff --git a/src/locale/pt/configure.ini b/src/locale/pt/configure.ini
index fb6d15b9c..c1d91561c 100755
--- a/src/locale/pt/configure.ini
+++ b/src/locale/pt/configure.ini
@@ -403,6 +403,7 @@ store_component_ad_updated = "Anúncio Atualizado"
 ; CrawlComponent.php
 crawl_component_delete_crawl_success = "A Exclusão De Rastreamento. . .Isso levará um tempo para atualizar."
 crawl_component_delete_crawl_fail = "Rastreamento De Exclusão Falhou!!"
+crawl_component_stats_deleted = ""
 crawl_component_set_index = "Configuração de Rastreamento Para Utilização como Índice de"
 managegroups_element_no_activity = "Nenhuma Atividade"
 crawl_component_resume_crawl = "Retomar de rastreamento. . .Isso levará um tempo para atualizar."
diff --git a/src/locale/ru/configure.ini b/src/locale/ru/configure.ini
index 25125b0ac..c83720d24 100755
--- a/src/locale/ru/configure.ini
+++ b/src/locale/ru/configure.ini
@@ -403,6 +403,7 @@ store_component_ad_updated = "Объявление Обновлено"
 ; CrawlComponent.php
 crawl_component_delete_crawl_success = "Удаление Ползать. . .Это займет некоторое время, чтобы обновить."
 crawl_component_delete_crawl_fail = "Удалить Доползти Не Смог!!"
+crawl_component_stats_deleted = ""
 crawl_component_set_index = "Настройка обхода для использования в качестве индекса"
 managegroups_element_no_activity = "Никакой Активности"
 crawl_component_resume_crawl = "Возобновив обход. . .Это займет некоторое время, чтобы обновить."
diff --git a/src/locale/te/configure.ini b/src/locale/te/configure.ini
index ae57ccdbf..7c30cfce7 100644
--- a/src/locale/te/configure.ini
+++ b/src/locale/te/configure.ini
@@ -403,6 +403,7 @@ store_component_ad_updated = "ప్రకటన నవీకరించబడ
 ; CrawlComponent.php
 crawl_component_delete_crawl_success = "క్రాల్ తొలగించ బడుతోంది ... కొంత నమయం పట్టవచ్చు"
 crawl_component_delete_crawl_fail = "డిలీట్ క్రాల్ విజయవంతం కాలేదు"
+crawl_component_stats_deleted = ""
 crawl_component_set_index = "క్రాల్ ని సూచిక గా ఉపయోగించడానికి ఏర్పాటు చేయబడినది"
 managegroups_element_no_activity = "ఏ కార్యాచరణ"
 crawl_component_resume_crawl = "క్రాల్ తిరిగి  మొదలు అవుతున్నది ... కొంత నమయం పట్టవచ్చు"
diff --git a/src/locale/th/configure.ini b/src/locale/th/configure.ini
index d889391da..6695c9578 100755
--- a/src/locale/th/configure.ini
+++ b/src/locale/th/configure.ini
@@ -403,6 +403,7 @@ store_component_ad_updated = "อัพเดทโฆษณา"
 ; CrawlComponent.php
 crawl_component_delete_crawl_success = "กำลังลบคลานไปไม่นาน . .นี่จะใช้เวลาสักครู่เพื่อปรับปรุง."
 crawl_component_delete_crawl_fail = "ลบคลานล้มเหลว!!"
+crawl_component_stats_deleted = ""
 crawl_component_set_index = "การตั้งค่าคลานต้องใช้เป็นดัชนี"
 managegroups_element_no_activity = "ไม่มีกิจกรรม"
 crawl_component_resume_crawl = "Resuming คลานไปไม่นาน . .นี่จะใช้เวลาสักครู่เพื่อปรับปรุง."
diff --git a/src/locale/tl/configure.ini b/src/locale/tl/configure.ini
index b12411013..c8bc5c6d3 100644
--- a/src/locale/tl/configure.ini
+++ b/src/locale/tl/configure.ini
@@ -403,6 +403,7 @@ store_component_ad_updated = "Advertisement Na-Update"
 ; CrawlComponent.php
 crawl_component_delete_crawl_success = "Pagtanggal Ng Mga Pag-Crawl. . .Ito ay tumagal ng ilang sandali upang i-refresh."
 crawl_component_delete_crawl_fail = "Tanggalin Ang Mga Pag-Crawl Nabigo!!"
+crawl_component_stats_deleted = ""
 crawl_component_set_index = "Mga Setting ng pag-Crawl Upang Gamitin bilang Index"
 managegroups_element_no_activity = "Walang Aktibidad"
 crawl_component_resume_crawl = "Pagpapatuloy ng pag-crawl. . .Ito ay tumagal ng ilang sandali upang i-refresh."
diff --git a/src/locale/tr/configure.ini b/src/locale/tr/configure.ini
index 038028dba..7fe4a4c8e 100755
--- a/src/locale/tr/configure.ini
+++ b/src/locale/tr/configure.ini
@@ -403,6 +403,7 @@ store_component_ad_updated = "Ilan Güncelleme"
 ; CrawlComponent.php
 crawl_component_delete_crawl_success = "Silme Sürün. . .Bu yenileme için bir dakikanızı alacaktır."
 crawl_component_delete_crawl_fail = "Sil Gezinme Başarısız Oldu!"
+crawl_component_stats_deleted = ""
 crawl_component_set_index = "Gezinme Dizin olarak Kullanmak İçin ayarlama "
 managegroups_element_no_activity = "Hiçbir Faaliyet"
 crawl_component_resume_crawl = "Sürdürme sürün. . .Bu yenileme için bir dakikanızı alacaktır."
diff --git a/src/locale/vi_VN/configure.ini b/src/locale/vi_VN/configure.ini
index 31fc150bb..6b8f1bb65 100755
--- a/src/locale/vi_VN/configure.ini
+++ b/src/locale/vi_VN/configure.ini
@@ -403,6 +403,7 @@ store_component_ad_updated = "Quảng Cáo Cập Nhật"
 ; CrawlComponent.php
 crawl_component_delete_crawl_success = "Xóa thu thập dữ liệu thành công"
 crawl_component_delete_crawl_fail = "Xóa thu thập dữ liệu không thành công"
+crawl_component_stats_deleted = ""
 crawl_component_set_index = "Thiết lập thu thập dữ liệu để sử dụng làm chỉ mục"
 managegroups_element_no_activity = "Không Có Hoạt Động"
 crawl_component_resume_crawl = "Tiếp tục thu thập dữ liệu"
diff --git a/src/locale/zh_CN/configure.ini b/src/locale/zh_CN/configure.ini
index e95f8313d..6a9c14832 100755
--- a/src/locale/zh_CN/configure.ini
+++ b/src/locale/zh_CN/configure.ini
@@ -403,6 +403,7 @@ store_component_ad_updated = "广告的更新"
 ; CrawlComponent.php
 crawl_component_delete_crawl_success = "刪除搜尋,需要一段時間更新"
 crawl_component_delete_crawl_fail = "刪除搜尋失敗"
+crawl_component_stats_deleted = ""
 crawl_component_set_index = "設置索引"
 managegroups_element_no_activity = "没有任何活动,"
 crawl_component_resume_crawl = "回復搜尋,需要一段時間更新"
diff --git a/src/models/ImpressionModel.php b/src/models/ImpressionModel.php
index abd819a2c..8f25f4541 100644
--- a/src/models/ImpressionModel.php
+++ b/src/models/ImpressionModel.php
@@ -597,4 +597,19 @@ class ImpressionModel extends Model
             ITEM_TYPE=?";
         $db->execute($sql, [$item_id, $type_id]);
     }
+    /**
+     * Deletes statistics related to web queries.
+     */
+    public function deleteQueryStatistics()
+    {
+        $db = $this->db;
+        $sql = "DELETE FROM ITEM_IMPRESSION WHERE ITEM_TYPE= " .
+            C\QUERY_IMPRESSION . " OR ITEM_TYPE=" . C\CACHE_IMPRESSION;
+        $db->execute($sql);
+        $sql = "DELETE FROM ITEM_IMPRESSION_SUMMARY WHERE ITEM_TYPE= " .
+            C\QUERY_IMPRESSION . " OR ITEM_TYPE=" . C\CACHE_IMPRESSION;
+        $db->execute($sql);
+        $sql = "DELETE FROM QUERY_ITEM";
+        $db->execute($sql);
+    }
 }
diff --git a/src/views/elements/QuerystatsElement.php b/src/views/elements/QuerystatsElement.php
index ac096a527..0fcaefe69 100644
--- a/src/views/elements/QuerystatsElement.php
+++ b/src/views/elements/QuerystatsElement.php
@@ -52,10 +52,15 @@ class QuerystatsElement extends Element
     public function render($data)
     {
         $token = C\CSRF_TOKEN . "=" . $data[C\CSRF_TOKEN];
+        $icon_helper = $this->view->helper('iconlink');
         ?>
         <div class="current-activity">
         <?=$this->view->element('crawlcontrols')->render($data); ?>
         <h2><?=tl('querystats_element_query_statistics') ?></h2>
+        <div class="float-opposite"><?php
+            $icon_helper->renderLink(B\controllerUrl("admin", true) .
+            "a=manageCrawls&amp;$token&amp;arg=deletestats", "delete");
+        ?></div>
         <form>
         <div>
         <b><label for='query-filter'><?=
ViewGit