_binary From 3e1da00274e40ffbc089064d0a5e9b428f9b70aa Mon Sep 17 00:00:00 2001
From: Ravi Dhillon <ravi.dhillon@yahoo.com>
Date: Wed, 9 May 2012 18:46:19 -0700
Subject: [PATCH] Posting patch

---
 configs/config.php                            |    5 +++++
 controllers/admin_controller.php              |    3 ++-
 lib/index_bundle_iterators/group_iterator.php |    2 +-
 locale/en-US/configure.ini                    |   11 ++++++++++-
 models/phrase_model.php                       |    3 ++-
 models/profile_model.php                      |    3 ++-
 views/elements/pageoptions_element.php        |   13 +++++++++++++
 7 files changed, 35 insertions(+), 5 deletions(-)

diff --git a/configs/config.php b/configs/config.php
index 03ff9aa..8fbcbad 100755
--- a/configs/config.php
+++ b/configs/config.php
@@ -133,6 +133,11 @@ if(file_exists(WORK_DIRECTORY."/profile.php")) {
     define ('DESCRIPTION_WEIGHT', 1);
     /** BM25F weight for other text within links to a doc*/
     define ('LINK_WEIGHT', 2);
+    /** How far to go into posting list*/
+    define ('POSTING_INDEX', 200);
+    /** How to distribute number of results among
+        network of queue servers*/
+    define ('QSERVER_INDEX', 1.6);
     $INDEXING_PLUGINS = array();
 
 }
diff --git a/controllers/admin_controller.php b/controllers/admin_controller.php
index a208c2f..13ca27f 100755
--- a/controllers/admin_controller.php
+++ b/controllers/admin_controller.php
@@ -1351,7 +1351,8 @@ class AdminController extends Controller implements CrawlConstants
         $data['SCRIPT'] = "";
         $profile =  $this->profileModel->getProfile(WORK_DIRECTORY);
         $weights = array('TITLE_WEIGHT' => 4, 
-            'DESCRIPTION_WEIGHT' => 1, 'LINK_WEIGHT' => 2);
+            'DESCRIPTION_WEIGHT' => 1, 'LINK_WEIGHT' => 2,
+            'POSTING_INDEX' => 200, 'QSERVER_INDEX' => 1.6);
         $change = false;
         foreach($weights as $weight => $value) {
             if(isset($_REQUEST[$weight])) {
diff --git a/lib/index_bundle_iterators/group_iterator.php b/lib/index_bundle_iterators/group_iterator.php
index c4630f9..4d3d191 100644
--- a/lib/index_bundle_iterators/group_iterator.php
+++ b/lib/index_bundle_iterators/group_iterator.php
@@ -126,7 +126,7 @@ class GroupIterator extends IndexBundleIterator
      * the minimum number of pages to group from a block;
      * this trumps $this->index_bundle_iterator->results_per_block
      */
-    const MIN_FIND_RESULTS_PER_BLOCK = 200;
+    const MIN_FIND_RESULTS_PER_BLOCK = POSTING_INDEX;
 
     /**
      * the minimum length of a description before we stop appending
diff --git a/locale/en-US/configure.ini b/locale/en-US/configure.ini
index f3f9e49..93a9360 100755
--- a/locale/en-US/configure.ini
+++ b/locale/en-US/configure.ini
@@ -1043,6 +1043,15 @@ pageoptions_element_link_weight = "Link Weight:"
 ; pageoptions_element.php line: 123
 pageoptions_element_save_options = "Save"
 ;
+; pageoptions_element.php line: 124
+pageoptions_element_posting_options = "Posting Options"
+;
+; pageoptions_element.php line: 126
+pageoptions_element_posting_index = "Posting Index:"
+;
+; pageoptions_element.php line: 131
+pageoptions_element_qserver_index = "Queue Sever Index:"
+;
 ; resultseditor_element.php line: 58
 resultseditor_element_edit_page = "Edit Result Page"
 ;
@@ -1318,4 +1327,4 @@ statistics_view_pages = "Downloaded Pages"
 statistics_view_url = "Seen Urls"
 ;
 ; statistics_view.php line: 125
-statistics_view_number_hosts = "Hostnames Seen"
\ No newline at end of file
+statistics_view_number_hosts = "Hostnames Seen"
diff --git a/models/phrase_model.php b/models/phrase_model.php
index db147d7..7f08557 100755
--- a/models/phrase_model.php
+++ b/models/phrase_model.php
@@ -1036,9 +1036,10 @@ class PhraseModel extends Model
                 new GroupIterator($union_iterator, $total_iterators);
         }
 
+    
         if($network_flag) {
             $union_iterator->results_per_block = 
-                ceil(1.6* $group_iterator->results_per_block/$num_servers);
+                ceil(QSERVER_INDEX* $group_iterator->results_per_block/$num_servers);
         }
 
         return $group_iterator;
diff --git a/models/profile_model.php b/models/profile_model.php
index e87c7f4..8fd6653 100644
--- a/models/profile_model.php
+++ b/models/profile_model.php
@@ -57,7 +57,8 @@ class ProfileModel extends Model
             'WORD_SUGGEST', 'CACHE_LINK', 'SIMILAR_LINK', 
             'IN_LINK', 'IP_LINK', 'SIGNIN_LINK',
             'ROBOT_INSTANCE', "WEB_ACCESS", "RSS_ACCESS", "API_ACCESS",
-            'TITLE_WEIGHT','DESCRIPTION_WEIGHT','LINK_WEIGHT');
+            'TITLE_WEIGHT','DESCRIPTION_WEIGHT','LINK_WEIGHT',
+            'POSTING_INDEX','QSERVER_INDEX');
     /**
      *  {@inheritdoc}
      */
diff --git a/views/elements/pageoptions_element.php b/views/elements/pageoptions_element.php
index 29cc6fb..cc20c95 100644
--- a/views/elements/pageoptions_element.php
+++ b/views/elements/pageoptions_element.php
@@ -120,6 +120,19 @@ class PageOptionsElement extends Element
                 name="LINK_WEIGHT" 
                 value="<?php  e($data['LINK_WEIGHT']); ?>" /></td></tr>
         </table>
+        <h2><?php e(tl('pageoptions_element_posting_options'))?></h2>
+        <table class="weightstable" >
+        <tr><th><label for="posting-index"><?php 
+            e(tl('pageoptions_element_posting_index'))?></label></th><td>
+            <input type="text" id="posting-index" size="3" maxlength="6"
+                name="POSTING_INDEX" 
+                value="<?php  e($data['POSTING_INDEX']); ?>" /></td></tr>
+        <tr><th><label for="qserver-index"><?php 
+            e(tl('pageoptions_element_qserver_index'))?></label></th><td>
+            <input type="text" id="qserver-index" size="3" maxlength="6"
+                name="QSERVER_INDEX" 
+                value="<?php  e($data['QSERVER_INDEX']); ?>" /></td></tr>
+        </table>
         <div class="center slightpad"><button class="buttonbox" 
             type="submit"><?php e(tl('pageoptions_element_save_options')); 
             ?></button></div>
-- 
1.7.10.1

