* Add new property "search.exactCount" to allow exact counting of matches. See docume...
authorMichael Stucki <michael.stucki@typo3.org>
Fri, 31 Aug 2007 12:34:38 +0000 (12:34 +0000)
committerMichael Stucki <michael.stucki@typo3.org>
Fri, 31 Aug 2007 12:34:38 +0000 (12:34 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@2477 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/indexed_search/ChangeLog
typo3/sysext/indexed_search/ext_typoscript_setup.txt
typo3/sysext/indexed_search/pi/class.tx_indexedsearch.php

index 8394f21..a1cff67 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2007-08-31  Michael Stucki  <michael@typo3.org>
 
        * (trivial) Cleanup of NEWS.txt
+       * Add feature #4470: Add new property "search.exactCount" to indexed_search
 
 2007-08-30  Ernesto Baschny  <ernst@cron-it.de>
 
index f5ff3fa..3e09e06 100755 (executable)
@@ -1,4 +1,8 @@
-2007-08-21 Andreas Otto <andreas.otto@dkd.de>
+2007-08-31  Michael Stucki  <michael@typo3.org>
+
+       * Add new property "search.exactCount" to allow exact counting of matches. See documentation for more information.
+
+2007-08-21  Andreas Otto  <andreas.otto@dkd.de>
 
        * Feature request #5748: Introduced a new TS option that makes indexing of metatags configurable. Adapted code to make use of the new TS option.
 
index 0928adb..70f83c6 100755 (executable)
@@ -42,6 +42,7 @@ plugin.tx_indexedsearch {
                page_links = 10
                detect_sys_domain_records = 0
                defaultFreeIndexUidList =
+               exactCount = 0
        }
 
        result_link_target =
index f45475c..b034020 100755 (executable)
@@ -577,8 +577,10 @@ class tx_indexedsearch extends tslib_pibase {
                        $c = 0; // Result pointer: Counts up the position in the current search-result
                        $grouping_phashes = array();    // Used to filter out duplicates.
                        $grouping_chashes = array();    // Used to filter out duplicates BASED ON cHash.
-                       $firstRow = Array();    // Will hold the first row in result - used to calculate relative hit-ratings.
-                       $resultRows = Array();  // Will hold the results rows for display.
+                       $firstRow = array();    // Will hold the first row in result - used to calculate relative hit-ratings.
+                       $resultRows = array();  // Will hold the results rows for display.
+
+                       $exactCount = $this->conf['search.']['exactCount'];     // Continue counting and checking of results even if we are sure they are not displayed in this request. This will slow down your page rendering, but it allows precise search result counters.
 
                                // Now, traverse result and put the rows to be displayed into an array
                                // Each row should contain the fields from 'ISEC.*, IP.*' combined + artificial fields "show_resume" (boolean) and "result_number" (counter)
@@ -606,8 +608,8 @@ class tx_indexedsearch extends tslib_pibase {
                                                if ($c > $pointer * $this->piVars['results'])   {
                                                        $row['result_number'] = $c;
                                                        $resultRows[] = $row;
-                                                               // This may lead to a problem: If the result check is not stopped here, the search will take longer. However the result counter will not filter out grouped cHashes/pHashes that were not processed yet.
-                                                       if (($c+1) > ($pointer+1)*$this->piVars['results'])     break;
+                                                               // This may lead to a problem: If the result check is not stopped here, the search will take longer. However the result counter will not filter out grouped cHashes/pHashes that were not processed yet. You can change this behavior using the "search.exactCount" property (see above).
+                                                       if (!$exactCount && (($c+1) > ($pointer+1)*$this->piVars['results']))   { break; }
                                                }
                                        } else {
                                                $count--;       // Skip this row if the user cannot view it (missing permission)