_binary From ce148509eff4f905eee1b9496d19a7b8f759a2fe Mon Sep 17 00:00:00 2001
From: Gargi Sheguri <gargiegs@gmail.com>
Date: Wed, 20 Sep 2023 15:17:05 -0700
Subject: [PATCH] Added new bonus factors WIKI_BONUS and NUM_SLASHES_BONUS

---
 src/configs/Config.php                        | 10 +++
 src/configs/PublicHelpPages.php               | 10 ++-
 src/controllers/SearchController.php          |  2 +
 src/controllers/components/CrawlComponent.php |  1 +
 src/library/FeedDocumentBundle.php            |  3 +-
 src/library/IndexDocumentBundle.php           | 73 +++++++++++++++----
 .../NetworkIterator.php                       |  2 +
 .../index_bundle_iterators/WordIterator.php   | 24 ++++++
 src/library/media_jobs/FeedsUpdateJob.php     |  3 +-
 src/locale/ar/configure.ini                   |  2 +
 src/locale/bn/configure.ini                   |  2 +
 src/locale/de/configure.ini                   |  2 +
 src/locale/el_GR/configure.ini                |  2 +
 src/locale/en_US/configure.ini                |  2 +
 src/locale/es/configure.ini                   |  2 +
 src/locale/fa/configure.ini                   |  2 +
 src/locale/fr_FR/configure.ini                |  2 +
 src/locale/he/configure.ini                   |  2 +
 src/locale/hi/configure.ini                   |  2 +
 src/locale/id/configure.ini                   |  2 +
 src/locale/it/configure.ini                   |  2 +
 src/locale/ja/configure.ini                   |  2 +
 src/locale/kn/configure.ini                   |  2 +
 src/locale/ko/configure.ini                   |  2 +
 src/locale/nl/configure.ini                   |  2 +
 src/locale/pl/configure.ini                   |  2 +
 src/locale/pt/configure.ini                   |  2 +
 src/locale/ru/configure.ini                   |  2 +
 src/locale/te/configure.ini                   |  2 +
 src/locale/th/configure.ini                   |  2 +
 src/locale/tl/configure.ini                   |  2 +
 src/locale/tr/configure.ini                   |  2 +
 src/locale/vi_VN/configure.ini                |  2 +
 src/locale/zh_CN/configure.ini                |  2 +
 src/models/ProfileModel.php                   |  4 +-
 src/views/elements/PageoptionsElement.php     | 10 +++
 36 files changed, 171 insertions(+), 21 deletions(-)

diff --git a/src/configs/Config.php b/src/configs/Config.php
index 24bef127c..5f588c584 100755
--- a/src/configs/Config.php
+++ b/src/configs/Config.php
@@ -584,6 +584,16 @@ if (file_exists(WORK_DIRECTORY . PROFILE_FILE_NAME)) {
      *  to the overall score used for ranking
      */
     nsdefine('USER_RANK_BONUS', 5);
+    /**
+     *  Bonus to add to doc rank score if the url points to a wikipedia page
+     */
+    nsdefine('WIKI_BONUS', 0.5);
+    /**
+     *  Bonus to add to doc rank score based on the number of '/' present in
+     *  the url, based on the idea that the lesser the count, the closer the url is
+     *  to the root page
+     */
+    nsdefine('NUM_SLASHES_BONUS', 0.5);
     /**
      * If that many exist, the minimum number of results to get
      * and group before trying to compute the top x (say 10) results
diff --git a/src/configs/PublicHelpPages.php b/src/configs/PublicHelpPages.php
index 5618767a1..fd2893d54 100644
--- a/src/configs/PublicHelpPages.php
+++ b/src/configs/PublicHelpPages.php
@@ -43381,8 +43381,12 @@ page_header=
 
 page_footer=
 
+page_theme=
+
 page_type=standard
 
+properties=
+
 robots=
 
 share_expires=-2
@@ -43393,6 +43397,8 @@ toc=true
 
 url_shortener=
 
+update_description=no-lookup
+
 END_HEAD_VARSThe score used to rank a page is computed as the document rank score + a relevance score. This score is then combined with a proximity score if the query has more than two terms using reciprocal rank fusion. Below are some bonuses which may be applied to the document rank and relevance scores.
 
 ; &#039;&#039;&#039;Host Keyword Bonus&#039;&#039;&#039; :  Potential bonus to add to relevance score. The number of occurrences of search term divided by the number of host name keywords is the fraction of this bonus that will be added to the relevance score.
@@ -43402,8 +43408,8 @@ END_HEAD_VARSThe score used to rank a page is computed as the document rank scor
 ; &#039;&#039;&#039;CLD Url Bonus&#039;&#039;&#039; : Bonus to add to doc rank score if the url is a company level domain.
 ; &#039;&#039;&#039;Host Url Bonus&#039;&#039;&#039; : Bonus to add to doc rank score if the url is a a hostname.
 ; &#039;&#039;&#039;User Rank  Bonus&#039;&#039;&#039; : User rank scores (created by making a classifier) for a document are normalized between 0 and 1, this is the weighting factor to multiply that basic score before adding it to the overall score used for ranking.
-
-
+; &#039;&#039;&#039;Wiki Bonus&#039;&#039;&#039; : Bonus to add to doc rank score if the url points to a wikipedia page.
+; &#039;&#039;&#039;Num Slashes Bonus&#039;&#039;&#039; : Bonus to add to doc rank score based on the number of &#039;/&#039; present in the url, based on the idea that the lesser the count, the closer the url is to the root page.
 EOD;
 $help_pages["en-US"]["Page_Rules"] = <<< 'EOD'
 page_type=standard
diff --git a/src/controllers/SearchController.php b/src/controllers/SearchController.php
index c400bea4c..1b8f77873 100755
--- a/src/controllers/SearchController.php
+++ b/src/controllers/SearchController.php
@@ -339,6 +339,8 @@ class SearchController extends Controller implements CrawlConstants
             "proximity_bonus" => C\PROXIMITY_BONUS,
             "title_bonus" => C\TITLE_BONUS,
             "user_rank_bonus" => C\USER_RANK_BONUS,
+            "wiki_bonus" => C\WIKI_BONUS,
+            "num_slashes_bonus" => C\NUM_SLASHES_BONUS,
             ] as $factor => $default) {
             if (isset($_REQUEST[$factor])) {
                 $ranking_factors[strtoupper($factor)] =
diff --git a/src/controllers/components/CrawlComponent.php b/src/controllers/components/CrawlComponent.php
index e4729008e..32b9740a3 100644
--- a/src/controllers/components/CrawlComponent.php
+++ b/src/controllers/components/CrawlComponent.php
@@ -1705,6 +1705,7 @@ class CrawlComponent extends Component implements CrawlConstants
             'TITLE_BONUS' => 5, 'PATH_KEYWORD_BONUS' => 3,
             'PROXIMITY_BONUS' => 20,
             'CLD_URL_BONUS' => 2, 'HOST_URL_BONUS' => 0.5,
+            'WIKI_BONUS' => 0.5, 'NUM_SLASHES_BONUS' => 0.5,
             'MIN_RESULTS_TO_GROUP' => C\MIN_RESULTS_TO_GROUP,
             'USER_RANK_BONUS' => 5];
         $change = false;
diff --git a/src/library/FeedDocumentBundle.php b/src/library/FeedDocumentBundle.php
index d199f2377..61efca596 100644
--- a/src/library/FeedDocumentBundle.php
+++ b/src/library/FeedDocumentBundle.php
@@ -328,8 +328,9 @@ class FeedDocumentBundle extends IndexDocumentBundle
     public static function computeDocId($site)
     {
         $raw_guid = unbase64Hash($site[self::HASH]);
+        // chr(24) refers to 'feed' doc type
         $doc_id = crawlHash($site[self::URL], true) .
-            $raw_guid . "f" . substr(crawlHash(
+            $raw_guid . chr(24) . substr(crawlHash(
             UrlParser::getHost($site[self::URL]) . "/", true), 1);
         return $doc_id;
     }
diff --git a/src/library/IndexDocumentBundle.php b/src/library/IndexDocumentBundle.php
index 11e90cf3c..633ec137f 100644
--- a/src/library/IndexDocumentBundle.php
+++ b/src/library/IndexDocumentBundle.php
@@ -985,18 +985,18 @@ class IndexDocumentBundle implements CrawlConstants
         if (isset($site[self::TYPE]) && $site[self::TYPE] == "link") {
             $doc_id = $site[self::HTTP_CODE];
         } else {
-            $letter_code = 'b';
+            $letter_code = chr(0);
             $main_type = (!empty($site[self::TYPE])) ?
                 substr($site[self::TYPE], 0, 4) : "binary";
             if (!empty($site[self::IS_VIDEO])) {
-                $letter_code = 'v';
+                $letter_code = chr(64);
             } else if ($main_type == "text" ) {
-                $letter_code = 't';
+                $letter_code = chr(56);
             } else if ($main_type == "imag") {
-                $letter_code = 'p';
+                $letter_code = chr(48);
             }
             $hash = $site[self::HASH];
-            if ($letter_code == "t" && !empty($site[self::TITLE])) {
+            if ($letter_code == chr(56) && !empty($site[self::TITLE])) {
                 $trim_title = trim($site[self::TITLE]);
                 $hash = substr(crawlHash($trim_title, true), 0, 4) .
                     substr($hash, 4);
@@ -1008,6 +1008,32 @@ class IndexDocumentBundle implements CrawlConstants
                 "https://www.$cld/", "http://$cld/", "http://www.$cld/"])) {
                 $letter_code = chr(ord($letter_code) + 128);
             }
+            if (strpos($cld, "wikipedia") !== false) {
+                $letter_code = chr(ord($letter_code) + 4);
+            }
+            $num_slashes = substr_count(substr($site[self::URL], strlen($host)), '/');
+            /*
+             * Discount any trailing slashes in the URL.
+             */
+            if ($num_slashes > 0 && substr($site[self::URL], -1) == '/') {
+                $num_slashes--;
+            }
+            /**
+             * The first two bits hold the number of / values (for the
+             * NUM_SLASHES_BONUS). This value is mapped into buckets of {0-1, 2-4,
+             * 5-6, 7+}, wherein all the values in a bucket get the same bonus. These
+             * buckets were decided after experimentation; the fundamental idea is
+             * that URLs for root pages/singly-nested pages are usually more
+             * important than those nested doubly or quadruply, which are in turn
+             * more important than those nested quintuply, etc.
+             */
+            if ($num_slashes >= 2 && $num_slashes < 5) {
+                $letter_code = chr(ord($letter_code) + 1);
+            }  else if ($num_slashes >=5  && $num_slashes < 7){
+                $letter_code = chr(ord($letter_code) + 2);
+            } else if ($num_slashes >=7) {
+                $letter_code = chr(ord($letter_code) + 3);
+            }
             $doc_id = crawlHash($site_url, true) . $hash .
                 $letter_code . substr(crawlHash($host . "/", true), 1);
         }
@@ -1145,6 +1171,23 @@ class IndexDocumentBundle implements CrawlConstants
     {
         return (ord($key[self::DOCID_PART_LEN << 1] ?? '\0') & 128) > 0;
     }
+    /**
+     * Checks if a doc_id $key is that of a Wikipedia page.
+     * @param string $key to check if Wikipedia page or not
+     */
+    public static function isAWikipediaPage($key)
+    {
+        return (ord($key[self::DOCID_PART_LEN << 1] ?? '\0') & 4) > 0;
+    }
+    /**
+     * Finds number of '/' in the url after the hostname represented by doc_id $key.
+     * @param string $key to find '/' count
+     */
+    public static function findNumSlashes($key)
+    {
+        return (ord($key[self::DOCID_PART_LEN << 1] ?? '\0') & 3);
+    }
+
     /**
      * Checks if a doc_id corresponds to a particular large scale type among
      * external_link, internal_link, link (union of previous two),
@@ -1158,15 +1201,15 @@ class IndexDocumentBundle implements CrawlConstants
     public static function isType($key, $types)
     {
         $type_map = [
-            "b" => "binary",
-            "d" => "old_doc",
-            "e" => "external_link",
-            "f" => "feed",
-            "i" => "internal_link",
-            "l" => "old_link",
-            "p" => "image",
-            "t" => "text",
-            "v" => "video",
+            0 => "binary",
+            8 => "old_doc",
+            16 => "external_link",
+            24 => "feed",
+            32 => "internal_link",
+            40 => "old_link",
+            48 => "image",
+            56 => "text",
+            64 => "video",
         ];
         if (is_string($types)) {
             $types = [$types];
@@ -1178,7 +1221,7 @@ class IndexDocumentBundle implements CrawlConstants
             $types = array_merge($types, ["binary", "feed", "image",
                 "old_doc", "text", "video"]);
         }
-        $key_type = chr(ord($key[self::DOCID_PART_LEN << 1] ?? 0) & 127);
+        $key_type = ord($key[self::DOCID_PART_LEN << 1] ?? 0) & 120;
         return in_array($type_map[$key_type] ?? "old_link", $types);
     }
     /**
diff --git a/src/library/index_bundle_iterators/NetworkIterator.php b/src/library/index_bundle_iterators/NetworkIterator.php
index 842114639..640cd1fa4 100644
--- a/src/library/index_bundle_iterators/NetworkIterator.php
+++ b/src/library/index_bundle_iterators/NetworkIterator.php
@@ -150,6 +150,8 @@ class NetworkIterator extends IndexBundleIterator
             "proximity_bonus" => C\PROXIMITY_BONUS,
             "title_bonus" => C\TITLE_BONUS,
             "user_rank_bonus" => C\USER_RANK_BONUS,
+            "wiki_bonus" => C\WIKI_BONUS,
+            "num_slashes_bonus" => C\NUM_SLASHES_BONUS,
             ] as $factor => $default) {
             $this->base_query .= "&$factor=" . ($ranking_factors[$factor] ??
                 $default);
diff --git a/src/library/index_bundle_iterators/WordIterator.php b/src/library/index_bundle_iterators/WordIterator.php
index f3bee8444..79eace8a0 100644
--- a/src/library/index_bundle_iterators/WordIterator.php
+++ b/src/library/index_bundle_iterators/WordIterator.php
@@ -249,6 +249,8 @@ class WordIterator extends IndexBundleIterator
             "HOST_KEYWORD_BONUS" => C\HOST_KEYWORD_BONUS,
             "PATH_KEYWORD_BONUS" => C\PATH_KEYWORD_BONUS,
             "TITLE_BONUS" => C\TITLE_BONUS,
+            "WIKI_BONUS" => C\WIKI_BONUS,
+            "NUM_SLASHES_BONUS" => C\NUM_SLASHES_BONUS,
             ] as $factor => $default) {
             $this->ranking_factors[$factor] = $ranking_factors[$factor] ??
                 $default;
@@ -551,6 +553,28 @@ class WordIterator extends IndexBundleIterator
                         $this->ranking_factors["CLD_URL_BONUS"] :
                         $this->ranking_factors["HOST_URL_BONUS"];
                 }
+                /**
+                 * For backward compatibility: new bonuses should only be added for
+                 * doc_ids following the new letter_code format.
+                 * Since all old formats use letters (eg. b, t, etc) to denote the
+                 * doc type, the ascii values for these letters are all > 96 (i.e.
+                 * bits 6 and 7 of the doc_id's 9th byte are both true).
+                 * Since all new letter_code formats use bits 4, 5, 6, 7 to represent
+                 * the doc type as int values mapped between 0-8, there is no value
+                 * in a doc_id's 9th byte that can have both bits 6 and 7
+                 * set to true.
+                 * This difference can be used to check whether $doc_key follows the
+                 * old or new letter_code format.
+                 */
+                $doc_id_format = ord($doc_key[8 << 1] ?? 0) & 96;
+                if ($doc_id_format != 96) {
+                    if(L\IndexDocumentBundle::isAWikipediaPage($doc_key)) {
+                        $posting[self::DOC_RANK] += $this->ranking_factors["WIKI_BONUS"];
+                    }
+                    $posting[self::DOC_RANK] +=
+                        $this->ranking_factors["NUM_SLASHES_BONUS"] /
+                        (L\IndexDocumentBundle::findNumSlashes($doc_key) + 1);
+                }
             }
             list($preface_positions, $num_description_scores) =
                 array_values(array_shift($doc_info));
diff --git a/src/library/media_jobs/FeedsUpdateJob.php b/src/library/media_jobs/FeedsUpdateJob.php
index 58a15a7d7..b9703c130 100644
--- a/src/library/media_jobs/FeedsUpdateJob.php
+++ b/src/library/media_jobs/FeedsUpdateJob.php
@@ -738,8 +738,9 @@ class FeedsUpdateJob extends MediaJob
             }
             $source_counts[$source_name]++;
             $raw_guid = L\unbase64Hash($item["GUID"]);
+            // chr(24) refers to 'feed' doc type
             $doc_id = L\crawlHash($item['LINK'], true) . $raw_guid .
-                "f" . substr(L\crawlHash(UrlParser::getHost($item['LINK']) .
+                chr(24) . substr(L\crawlHash(UrlParser::getHost($item['LINK']) .
                 "/", true), 1);
             $seen_url_count += 1;
             $summary = [];
diff --git a/src/locale/ar/configure.ini b/src/locale/ar/configure.ini
index 96aacbd9f..87cffdadf 100755
--- a/src/locale/ar/configure.ini
+++ b/src/locale/ar/configure.ini
@@ -1460,6 +1460,8 @@ pageoptions_element_proximity_bonus = "مكافأة القرب :"
 pageoptions_element_cld_url_bonus = "مكافأة رابط نطاق الشركة :"
 pageoptions_element_host_url_bonus = "مكافأة عنوان المضيف :"
 pageoptions_element_user_rank_bonus = "مكافأة رتبة المستخدم:"
+pageoptions_element_num_slashes_bonus = "مكافأة لعدد الخطوط المائلة للأمام :"
+pageoptions_element_wiki_bonus = "مكافأة ويكيبيديا :"
 pageoptions_element_results_grouping_options = "تجميع نتائج البحث"
 pageoptions_element_min_results_to_group = "نتائج الحد الأدنى للمجموعة:"
 pageoptions_element_test_page = "صفحة اختبار"
diff --git a/src/locale/bn/configure.ini b/src/locale/bn/configure.ini
index 860efca36..f12f4aeaf 100755
--- a/src/locale/bn/configure.ini
+++ b/src/locale/bn/configure.ini
@@ -1460,6 +1460,8 @@ pageoptions_element_proximity_bonus = "প্রক্সিমিটি বো
 pageoptions_element_cld_url_bonus = "কোম্পানির ডোমেন ইউআরএল বোনাস:"
 pageoptions_element_host_url_bonus = "হোস্ট ইউআরএল বোনাস:"
 pageoptions_element_user_rank_bonus = "ব্যবহারকারী র্যাঙ্ক বোনাস:"
+pageoptions_element_num_slashes_bonus = "স্ল্যাশ বোনাসের সংখ্যা:"
+pageoptions_element_wiki_bonus = "উইকি বোনাস:"
 pageoptions_element_results_grouping_options = "অনুসন্ধান ফলাফল জোট"
 pageoptions_element_min_results_to_group = "সর্বনিম্ন ফলাফল গ্রুপ:"
 pageoptions_element_test_page = "পরীক্ষা পৃষ্ঠা"
diff --git a/src/locale/de/configure.ini b/src/locale/de/configure.ini
index 78b9bb385..f8a06d9fe 100755
--- a/src/locale/de/configure.ini
+++ b/src/locale/de/configure.ini
@@ -1460,6 +1460,8 @@ pageoptions_element_proximity_bonus = "Proximity-Bonus:"
 pageoptions_element_cld_url_bonus = "Firmen-Domain-URL-Bonus:"
 pageoptions_element_host_url_bonus = "Host-URL-Prämie:"
 pageoptions_element_user_rank_bonus = "Benutzerrangbonus :"
+pageoptions_element_num_slashes_bonus = "Anzahl der Schrägstriche Bonus:"
+pageoptions_element_wiki_bonus = "Wiki-Bonus:"
 pageoptions_element_results_grouping_options = "Suchergebnisse Gruppierung"
 pageoptions_element_min_results_to_group = "Minimale Ergebnisse Gruppe:"
 pageoptions_element_test_page = "Test Seite"
diff --git a/src/locale/el_GR/configure.ini b/src/locale/el_GR/configure.ini
index f5f145232..5b8ffd2a0 100644
--- a/src/locale/el_GR/configure.ini
+++ b/src/locale/el_GR/configure.ini
@@ -1460,6 +1460,8 @@ pageoptions_element_proximity_bonus = "Μπόνους Εγγύτητας :"
 pageoptions_element_cld_url_bonus = "Μπόνους Διεύθυνσης URL Τομέα Εταιρείας :"
 pageoptions_element_host_url_bonus = "Μπόνους URL Υποδοχής :"
 pageoptions_element_user_rank_bonus = "Μπόνους Κατάταξης Χρήστη :"
+pageoptions_element_num_slashes_bonus = "Μπόνους αριθμός κάθετου:"
+pageoptions_element_wiki_bonus = "Μπόνους Wiki:"
 pageoptions_element_results_grouping_options = "Ομαδοποίηση αποτελεσμάτων αναζήτησης"
 pageoptions_element_min_results_to_group = "Ελάχιστα αποτελέσματα στην ομάδα:"
 pageoptions_element_test_page = "Δοκιμαστική σελίδα"
diff --git a/src/locale/en_US/configure.ini b/src/locale/en_US/configure.ini
index d36c23f0e..53e6ca064 100644
--- a/src/locale/en_US/configure.ini
+++ b/src/locale/en_US/configure.ini
@@ -1460,6 +1460,8 @@ pageoptions_element_proximity_bonus = "Proximity Bonus:"
 pageoptions_element_cld_url_bonus = "Company Domain Url Bonus:"
 pageoptions_element_host_url_bonus = "Host Url Bonus:"
 pageoptions_element_user_rank_bonus = "User Rank Bonus:"
+pageoptions_element_num_slashes_bonus = "Num Slashes Bonus:"
+pageoptions_element_wiki_bonus = "Wiki Bonus:"
 pageoptions_element_results_grouping_options = "Search Results Grouping"
 pageoptions_element_min_results_to_group = "Minimum Results to Group:"
 pageoptions_element_test_page = "Test Page"
diff --git a/src/locale/es/configure.ini b/src/locale/es/configure.ini
index e4268d63a..42805b0c2 100755
--- a/src/locale/es/configure.ini
+++ b/src/locale/es/configure.ini
@@ -1460,6 +1460,8 @@ pageoptions_element_proximity_bonus = "Bonificación de proximidad:"
 pageoptions_element_cld_url_bonus = "Bonificación de Url de Dominio de Empresa:"
 pageoptions_element_host_url_bonus = "Bonificación de URL de Host:"
 pageoptions_element_user_rank_bonus = "Bonificación de Rango de Usuario :"
+pageoptions_element_num_slashes_bonus = "Bonificación por número de barras diagonales:"
+pageoptions_element_wiki_bonus = "Bonificación para Wiki:"
 pageoptions_element_results_grouping_options = "Resultados De La B&uacute;squeda De La Agrupaci&oacute;n"
 pageoptions_element_min_results_to_group = "Resultados m&iacute;nimos para el Grupo:"
 pageoptions_element_test_page = "P&aacute;gina De Prueba"
diff --git a/src/locale/fa/configure.ini b/src/locale/fa/configure.ini
index e43d216cc..f4b80e443 100755
--- a/src/locale/fa/configure.ini
+++ b/src/locale/fa/configure.ini
@@ -1460,6 +1460,8 @@ pageoptions_element_proximity_bonus = "پاداش نزدیکی:"
 pageoptions_element_cld_url_bonus = "پاداش دامنه شرکت :"
 pageoptions_element_host_url_bonus = "پاداش نشانی وب میزبان :"
 pageoptions_element_user_rank_bonus = "پاداش رتبه کاربر:"
+pageoptions_element_num_slashes_bonus = "پاداش تعداد اسلش :"
+pageoptions_element_wiki_bonus = "پاداش ویکی :"
 pageoptions_element_results_grouping_options = "دسته&zwnj;بندی نتایج جستجو"
 pageoptions_element_min_results_to_group = "حداقل تعداد هر دسته:"
 pageoptions_element_test_page = "تست صفحه"
diff --git a/src/locale/fr_FR/configure.ini b/src/locale/fr_FR/configure.ini
index b2318a5e0..8dc5d68ce 100755
--- a/src/locale/fr_FR/configure.ini
+++ b/src/locale/fr_FR/configure.ini
@@ -1460,6 +1460,8 @@ pageoptions_element_proximity_bonus = "Bonus de proximité:"
 pageoptions_element_cld_url_bonus = "Bonus d&#039;URL de domaine d&#039;entreprise:"
 pageoptions_element_host_url_bonus = "Bonus d&#039;URL d&#039;hôte:"
 pageoptions_element_user_rank_bonus = "Bonus de classement utilisateur:"
+pageoptions_element_num_slashes_bonus = "Bonus de nombre de barres obliques:"
+pageoptions_element_wiki_bonus = "Bonus Wiki:"
 pageoptions_element_results_grouping_options = "R&eacute;sultats de la recherche groupement"
 pageoptions_element_min_results_to_group = "Minimum de r&eacute;sultats &agrave; un groupe:"
 pageoptions_element_test_page = "Page de test"
diff --git a/src/locale/he/configure.ini b/src/locale/he/configure.ini
index 70460c234..3f93d99ef 100755
--- a/src/locale/he/configure.ini
+++ b/src/locale/he/configure.ini
@@ -1460,6 +1460,8 @@ pageoptions_element_proximity_bonus = "בונוס קרבה:"
 pageoptions_element_cld_url_bonus = "בונוס כתובת אתר של תחום החברה :"
 pageoptions_element_host_url_bonus = "בונוס כתובת אתר מארח :"
 pageoptions_element_user_rank_bonus = "בונוס דירוג משתמש:"
+pageoptions_element_num_slashes_bonus = "מספר / בונוס :"
+pageoptions_element_wiki_bonus = "בונוס ויקי :"
 pageoptions_element_results_grouping_options = "תוצאות חיפוש קיבוץ"
 pageoptions_element_min_results_to_group = "מינימום תוצאות הקבוצה:"
 pageoptions_element_test_page = "דף בדיקה"
diff --git a/src/locale/hi/configure.ini b/src/locale/hi/configure.ini
index 9eab4ea77..9f3ad3a35 100755
--- a/src/locale/hi/configure.ini
+++ b/src/locale/hi/configure.ini
@@ -1460,6 +1460,8 @@ pageoptions_element_proximity_bonus = "निकटता बोनस:"
 pageoptions_element_cld_url_bonus = "कंपनी डोमेन यूआरएल बोनस:"
 pageoptions_element_host_url_bonus = "होस्ट यूआरएल बोनस:"
 pageoptions_element_user_rank_bonus = "उपयोगकर्ता रैंक बोनस:"
+pageoptions_element_num_slashes_bonus = "स्लैश की संख्या बोनस:"
+pageoptions_element_wiki_bonus = "विकी बोनस:"
 pageoptions_element_results_grouping_options = "खोज परिणाम समूहीकरण"
 pageoptions_element_min_results_to_group = "न्यूनतम परिणाम समूह के लिए:"
 pageoptions_element_test_page = "परीक्षण पृष्ठ"
diff --git a/src/locale/id/configure.ini b/src/locale/id/configure.ini
index ef6e2c1c1..619dbba0e 100755
--- a/src/locale/id/configure.ini
+++ b/src/locale/id/configure.ini
@@ -1460,6 +1460,8 @@ pageoptions_element_proximity_bonus = "Bonus Kedekatan:"
 pageoptions_element_cld_url_bonus = "Bonus Url Domain Perusahaan:"
 pageoptions_element_host_url_bonus = "Bonus URL Tuan Rumah:"
 pageoptions_element_user_rank_bonus = "Bonus Peringkat Pengguna :"
+pageoptions_element_num_slashes_bonus = "Bonus untuk Bilangan Slash:"
+pageoptions_element_wiki_bonus = "Bonus untuk Wiki:"
 pageoptions_element_results_grouping_options = "Hasil Pencarian Pengelompokan"
 pageoptions_element_min_results_to_group = "Minimal Hasil untuk Kelompok:"
 pageoptions_element_test_page = "Uji Halaman"
diff --git a/src/locale/it/configure.ini b/src/locale/it/configure.ini
index f1b5e03fe..093144e6e 100755
--- a/src/locale/it/configure.ini
+++ b/src/locale/it/configure.ini
@@ -1460,6 +1460,8 @@ pageoptions_element_proximity_bonus = "Bonus di prossimità:"
 pageoptions_element_cld_url_bonus = "Bonus Url dominio azienda:"
 pageoptions_element_host_url_bonus = "Bonus Url host:"
 pageoptions_element_user_rank_bonus = "Bonus classifica utente:"
+pageoptions_element_num_slashes_bonus = "Bonus per numero di /:"
+pageoptions_element_wiki_bonus = "Bonus per Wiki:"
 pageoptions_element_results_grouping_options = "Raggruppa risultati di ricerca"
 pageoptions_element_min_results_to_group = "Minimo risultati da raggruppare:"
 pageoptions_element_test_page = "Pagina Di Prova"
diff --git a/src/locale/ja/configure.ini b/src/locale/ja/configure.ini
index 6a86257c0..e0159a109 100755
--- a/src/locale/ja/configure.ini
+++ b/src/locale/ja/configure.ini
@@ -1460,6 +1460,8 @@ pageoptions_element_proximity_bonus = "近接ボーナス:"
 pageoptions_element_cld_url_bonus = "企業ドメインUrlボーナス:"
 pageoptions_element_host_url_bonus = "ホストUrlボーナス:"
 pageoptions_element_user_rank_bonus = "ユーザーランクボーナス:"
+pageoptions_element_num_slashes_bonus = "スラッシュボーナスの数:"
+pageoptions_element_wiki_bonus = "Wiki のボーナス:"
 pageoptions_element_results_grouping_options = "検索結果の分類"
 pageoptions_element_min_results_to_group = "最低限の結果をグループ"
 pageoptions_element_test_page = "テストページ"
diff --git a/src/locale/kn/configure.ini b/src/locale/kn/configure.ini
index 0903bf0b6..cc6acb14d 100755
--- a/src/locale/kn/configure.ini
+++ b/src/locale/kn/configure.ini
@@ -1460,6 +1460,8 @@ pageoptions_element_proximity_bonus = "ಸಾಮೀಪ್ಯ ಬೋನಸ್:"
 pageoptions_element_cld_url_bonus = "ಕಂಪನಿ ಡೊಮೇನ್ ಯುಆರ್ಎಲ್ ಬೋನಸ್:"
 pageoptions_element_host_url_bonus = "ಹೋಸ್ಟ್ ಯುಆರ್ಎಲ್ ಬೋನಸ್:"
 pageoptions_element_user_rank_bonus = "ಬಳಕೆದಾರ ಶ್ರೇಣಿಯ ಬೋನಸ್:"
+pageoptions_element_num_slashes_bonus = "ಸ್ಲಾಶ್‌ಗಳ ಬೋನಸ್‌ಗಳ ಸಂಖ್ಯೆ:"
+pageoptions_element_wiki_bonus = "ವಿಕಿ ಬೋನಸ್:"
 pageoptions_element_results_grouping_options = "ಹುಡುಕಾಟ ಫಲಿತಾಂಶಗಳು ಗುಂಪು"
 pageoptions_element_min_results_to_group = "ಕನಿಷ್ಠ ಫಲಿತಾಂಶಗಳು ಗುಂಪು:"
 pageoptions_element_test_page = "ಟೆಸ್ಟ್ ಪುಟ"
diff --git a/src/locale/ko/configure.ini b/src/locale/ko/configure.ini
index 224a5f2eb..9310d680c 100755
--- a/src/locale/ko/configure.ini
+++ b/src/locale/ko/configure.ini
@@ -1460,6 +1460,8 @@ pageoptions_element_proximity_bonus = "근접 보너스:"
 pageoptions_element_cld_url_bonus = "회사 도메인 주소 보너스:"
 pageoptions_element_host_url_bonus = "호스트 주소 보너스:"
 pageoptions_element_user_rank_bonus = "사용자 순위 보너스:"
+pageoptions_element_num_slashes_bonus = "슬래시 보너스 수:"
+pageoptions_element_wiki_bonus = "위키 보너스:"
 pageoptions_element_results_grouping_options = "검색 결과 그룹"
 pageoptions_element_min_results_to_group = "최소 결과하는 그룹:"
 pageoptions_element_test_page = "테스트 페이지"
diff --git a/src/locale/nl/configure.ini b/src/locale/nl/configure.ini
index 726cf70d6..d16b4ec5e 100644
--- a/src/locale/nl/configure.ini
+++ b/src/locale/nl/configure.ini
@@ -1460,6 +1460,8 @@ pageoptions_element_proximity_bonus = "Proximity Bonus :"
 pageoptions_element_cld_url_bonus = "Bedrijfsdomein Url-Bonus :"
 pageoptions_element_host_url_bonus = "Host Url Bonus :"
 pageoptions_element_user_rank_bonus = "User Rank Bonus :"
+pageoptions_element_num_slashes_bonus = "Num Slashes Bonus:"
+pageoptions_element_wiki_bonus = "Wiki Bonus:"
 pageoptions_element_results_grouping_options = "Zoekresultaten Groepering"
 pageoptions_element_min_results_to_group = "Minimum Resultaten Groep:"
 pageoptions_element_test_page = "testpagina"
diff --git a/src/locale/pl/configure.ini b/src/locale/pl/configure.ini
index 03030925c..507e5652f 100755
--- a/src/locale/pl/configure.ini
+++ b/src/locale/pl/configure.ini
@@ -1460,6 +1460,8 @@ pageoptions_element_proximity_bonus = "Premia Zbliżeniowa :"
 pageoptions_element_cld_url_bonus = "Bonus URL Domeny Firmowej :"
 pageoptions_element_host_url_bonus = "Bonus URL Hosta:"
 pageoptions_element_user_rank_bonus = "Bonus Rangi Użytkownika:"
+pageoptions_element_num_slashes_bonus = "Premia za liczbę /:"
+pageoptions_element_wiki_bonus = "Bonus dla Wiki:"
 pageoptions_element_results_grouping_options = "Wyniki Wyszukiwania Grupowanie"
 pageoptions_element_min_results_to_group = "Minimalne wyniki w grupie:"
 pageoptions_element_test_page = "Strona Testowa "
diff --git a/src/locale/pt/configure.ini b/src/locale/pt/configure.ini
index ff1b81560..61f27f235 100755
--- a/src/locale/pt/configure.ini
+++ b/src/locale/pt/configure.ini
@@ -1460,6 +1460,8 @@ pageoptions_element_proximity_bonus = "Bônus De Proximidade :"
 pageoptions_element_cld_url_bonus = "Bônus De Url De Domínio Da Empresa:"
 pageoptions_element_host_url_bonus = "Bônus De URL Do Host :"
 pageoptions_element_user_rank_bonus = "Bônus De Classificação Do Usuário :"
+pageoptions_element_num_slashes_bonus = "Bônus para o número de /:"
+pageoptions_element_wiki_bonus = "Bônus para Wiki:"
 pageoptions_element_results_grouping_options = "Resultados Da Pesquisa De Agrupamento"
 pageoptions_element_min_results_to_group = "Resultados m&iacute;nimos para o Grupo:"
 pageoptions_element_test_page = "P&aacute;gina De Teste"
diff --git a/src/locale/ru/configure.ini b/src/locale/ru/configure.ini
index 66d4415b5..8443d8a68 100755
--- a/src/locale/ru/configure.ini
+++ b/src/locale/ru/configure.ini
@@ -1460,6 +1460,8 @@ pageoptions_element_proximity_bonus = "Бонус за близость:"
 pageoptions_element_cld_url_bonus = "Бонусный URL-адрес домена компании:"
 pageoptions_element_host_url_bonus = "Бонусный URL-адрес хоста:"
 pageoptions_element_user_rank_bonus = "Бонус за ранг пользователя:"
+pageoptions_element_num_slashes_bonus = "Бонус за количество слэшей:"
+pageoptions_element_wiki_bonus = "Бонус для Вики:"
 pageoptions_element_results_grouping_options = "Результаты Поиска Группировка"
 pageoptions_element_min_results_to_group = "Минимальные результаты в группе:"
 pageoptions_element_test_page = "Тестовая Страница "
diff --git a/src/locale/te/configure.ini b/src/locale/te/configure.ini
index 86bb0f100..84953f35a 100644
--- a/src/locale/te/configure.ini
+++ b/src/locale/te/configure.ini
@@ -1460,6 +1460,8 @@ pageoptions_element_proximity_bonus = "సామీప్య బోనస్:"
 pageoptions_element_cld_url_bonus = "కంపెనీ డొమైన్ యూఆర్ఎల్ బోనస్:"
 pageoptions_element_host_url_bonus = "హోస్ట్ యూఆర్ఎల్ బోనస్:"
 pageoptions_element_user_rank_bonus = "వాడుకరి రాంక్ బోనస్:"
+pageoptions_element_num_slashes_bonus = "ఫార్వర్డ్ స్లాష్‌ల బోనస్ సంఖ్య:"
+pageoptions_element_wiki_bonus = "బోనస్ వికీ:"
 pageoptions_element_results_grouping_options = "శోధన ఫలితాలు చోట"
 pageoptions_element_min_results_to_group = "కనీస ఫలితాలు గుంపు:"
 pageoptions_element_test_page = "టెస్ట్ పేజీ"
diff --git a/src/locale/th/configure.ini b/src/locale/th/configure.ini
index e10073b77..24a9dc889 100755
--- a/src/locale/th/configure.ini
+++ b/src/locale/th/configure.ini
@@ -1460,6 +1460,8 @@ pageoptions_element_proximity_bonus = "โบนัสความใกล้
 pageoptions_element_cld_url_bonus = "โบนัสโดเมนบริษัท:"
 pageoptions_element_host_url_bonus = "โบนัสโฮสต์:"
 pageoptions_element_user_rank_bonus = "โบนัสอันดับผู้ใช้:"
+pageoptions_element_num_slashes_bonus = "โบนัสสำหรับจำนวนสแลช:"
+pageoptions_element_wiki_bonus = "โบนัสสำหรับวิกิ:"
 pageoptions_element_results_grouping_options = "ผลการค้นหาการจัดกลุ่ม"
 pageoptions_element_min_results_to_group = "อย่างน้อยผลให้กลุ่ม:"
 pageoptions_element_test_page = "ทดสอบหน้า"
diff --git a/src/locale/tl/configure.ini b/src/locale/tl/configure.ini
index 6d8a8f8f4..eb82752f3 100644
--- a/src/locale/tl/configure.ini
+++ b/src/locale/tl/configure.ini
@@ -1460,6 +1460,8 @@ pageoptions_element_proximity_bonus = "Malapit Na Bonus:"
 pageoptions_element_cld_url_bonus = "Bonus Ng Url Ng Domain Ng Kumpanya:"
 pageoptions_element_host_url_bonus = "Host Url Bonus:"
 pageoptions_element_user_rank_bonus = "Bonus Sa Ranggo Ng Gumagamit:"
+pageoptions_element_num_slashes_bonus = "Bonus para sa Bilang ng mga Slash:"
+pageoptions_element_wiki_bonus = "Bonus para sa Wiki:"
 pageoptions_element_results_grouping_options = "Mga Resulta Ng Paghahanap Ng Pagpapangkat"
 pageoptions_element_min_results_to_group = "Minimum na mga Resulta sa Grupo:"
 pageoptions_element_test_page = "Pahina Ng Pagsubok"
diff --git a/src/locale/tr/configure.ini b/src/locale/tr/configure.ini
index ab1599ced..05d47e490 100755
--- a/src/locale/tr/configure.ini
+++ b/src/locale/tr/configure.ini
@@ -1460,6 +1460,8 @@ pageoptions_element_proximity_bonus = "Yakınlık Bonusu :"
 pageoptions_element_cld_url_bonus = "Şirket Alan Adı Url Bonusu :"
 pageoptions_element_host_url_bonus = "Ana Bilgisayar Url Bonusu :"
 pageoptions_element_user_rank_bonus = "Kullanıcı Sıralaması Bonusu :"
+pageoptions_element_num_slashes_bonus = "Eğik Çizgi Sayısı için Bonus:"
+pageoptions_element_wiki_bonus = "Wiki için Bonus:"
 pageoptions_element_results_grouping_options = "Arama Sonu&ccedil;ları Gruplandırma"
 pageoptions_element_min_results_to_group = "Minimum Sonu&ccedil;lar Grup i&ccedil;in:"
 pageoptions_element_test_page = "Test Sayfası"
diff --git a/src/locale/vi_VN/configure.ini b/src/locale/vi_VN/configure.ini
index 15fd30696..59b5c5f17 100755
--- a/src/locale/vi_VN/configure.ini
+++ b/src/locale/vi_VN/configure.ini
@@ -1460,6 +1460,8 @@ pageoptions_element_proximity_bonus = "Gần Thưởng:"
 pageoptions_element_cld_url_bonus = "Công Ty Miền Url Thưởng:"
 pageoptions_element_host_url_bonus = "Chủ Url Thưởng:"
 pageoptions_element_user_rank_bonus = "Sử Dụng Cấp Bậc Tiền Thưởng:"
+pageoptions_element_num_slashes_bonus = "Phần thưởng cho số lần chém:"
+pageoptions_element_wiki_bonus = "Phần thưởng cho Wiki:"
 pageoptions_element_results_grouping_options = "Kết Quả Tìm Kiếm Nhóm"
 pageoptions_element_min_results_to_group = "Kết Quả tối thiểu để Nhóm:"
 pageoptions_element_test_page = "Kiểm Tra Trang"
diff --git a/src/locale/zh_CN/configure.ini b/src/locale/zh_CN/configure.ini
index 086a14d90..11540d466 100755
--- a/src/locale/zh_CN/configure.ini
+++ b/src/locale/zh_CN/configure.ini
@@ -1460,6 +1460,8 @@ pageoptions_element_proximity_bonus = "接近奖励:"
 pageoptions_element_cld_url_bonus = "公司域名Url奖金:"
 pageoptions_element_host_url_bonus = "主机Url奖金:"
 pageoptions_element_user_rank_bonus = "用户等级奖金:"
+pageoptions_element_num_slashes_bonus = "斜线奖励数量:"
+pageoptions_element_wiki_bonus = "维基奖励:"
 pageoptions_element_results_grouping_options = "搜索结果的分组"
 pageoptions_element_min_results_to_group = "最低结果，小组："
 pageoptions_element_test_page = "测试页"
diff --git a/src/models/ProfileModel.php b/src/models/ProfileModel.php
index 226c9b0ca..909bc9700 100755
--- a/src/models/ProfileModel.php
+++ b/src/models/ProfileModel.php
@@ -61,7 +61,7 @@ class ProfileModel extends Model
         'LOGO_LARGE', 'MAIL_PASSWORD',  'MAIL_SECURITY',
         'MAIL_SENDER', 'MAIL_SERVER', 'MAIL_SERVERPORT', 'MAIL_USERNAME',
         'MIN_RESULTS_TO_GROUP',  'MONETIZATION_TYPE', 'MORE_RESULT',
-        'MEDIA_MODE', 'NAME_SERVER', 'PATH_KEYWORD_BONUS',
+        'MEDIA_MODE', 'NAME_SERVER', 'NUM_SLASHES_BONUS', 'PATH_KEYWORD_BONUS',
         'PRIVATE_DB_NAME', 'PRIVATE_DB_HOST', 'PRIVATE_DBMS',
         'PRIVATE_DB_PASSWORD', 'PRIVATE_DB_USER', 'PROXY_SERVERS',
         'PROXIMITY_BONUS', 'RECOVERY_MODE', 'REGISTRATION_TYPE', 'RESULT_SCORE',
@@ -71,7 +71,7 @@ class ProfileModel extends Model
         'SIMILAR_LINK', 'SUBSEARCH_LINK', 'TITLE_BONUS', 'TIMEZONE',
         'TOPBAR_COLOR', 'TOP_ADSCRIPT','TOR_PROXY', 'USE_FILECACHE',
         'USE_MAIL_PHP', 'USE_PROXY', 'USER_AGENT_SHORT', 'USER_RANK_BONUS',
-        'WEB_URI', 'WEB_ACCESS', 'WORD_CLOUD', 'WORD_SUGGEST'
+        'WEB_URI', 'WEB_ACCESS', 'WIKI_BONUS',  'WORD_CLOUD', 'WORD_SUGGEST'
         ];
     /**
      * Profile fields which are stored in wiki or in a flat file
diff --git a/src/views/elements/PageoptionsElement.php b/src/views/elements/PageoptionsElement.php
index b7eb7a488..65d19c34f 100644
--- a/src/views/elements/PageoptionsElement.php
+++ b/src/views/elements/PageoptionsElement.php
@@ -562,6 +562,16 @@ class PageOptionsElement extends Element
             <input type="text" id="user-rank-bonus" class="very-narrow-field"
                 maxlength="<?= C\NUM_FIELD_LEN ?>" name="USER_RANK_BONUS"
                 value="<?= $data['USER_RANK_BONUS'] ?>" ></td></tr>
+        <tr><th><label for="wiki-bonus"><?=
+            tl('pageoptions_element_wiki_bonus')?></label></th><td>
+            <input type="text" id="wiki-bonus" class="very-narrow-field"
+                maxlength="<?= C\NUM_FIELD_LEN ?>" name="WIKI_BONUS"
+                value="<?= $data['WIKI_BONUS'] ?>" ></td></tr>
+        <tr><th><label for="num-slashes-bonus"><?=
+            tl('pageoptions_element_num_slashes_bonus')?></label></th><td>
+            <input type="text" id="num-slashes-bonus" class="very-narrow-field"
+                maxlength="<?= C\NUM_FIELD_LEN ?>" name="NUM_SLASHES_BONUS"
+                value="<?= $data['NUM_SLASHES_BONUS'] ?>" ></td></tr>
         </table>
         <h2><?= tl('pageoptions_element_results_grouping_options') ?>
         <?= $this->view->helper("helpbutton")->render(
-- 
2.42.0

