Erst einmal ein Hallo an die Typo3 Community!
Folgendes Problem:
Die Scuhergebnisse werden ja auf meherere Seiten aufgeteilt jedoch gehen bei mir die Page-links nicht. Wenn man zb. auf "Page 2" klickt landet man auf der Startseite.
Ich verwende auch realurl, evtl. hat es damit etwas zu tun? Ist da ein Problem bekannt? Ich hab mir die Links schonmal genauer angesehn jedoch keine ordentliche Lösung bis jetzt gefunden.
So sehen die Links aus:
<a href="#" onclick="document.tx_indexedsearch['tx_indexedsearch[pointer]'].value='1';document.tx_indexedsearch['tx_indexedsearch[_freeIndexUid]'].value='-1';document.tx_indexedsearch.submit();return false;">Page 2</a>
Ich verwende indexed_search 2.9
Mfg, xjk
Also ich hab es geschafft das die links nun gehen, jetzt taucht aber ein neuen Problem auf:
Ich suche zb. nach "test" und bekomme 63 Ergebnisse = 4 Seiten (20/Seite).
Klick ich auf Seite 2, sind es aufeinmal nurnoch 55 Ergebnisse und 3 Seiten.
Klick ich auf Seite 3, sind es nurnoch 52 usw.
Was könnte hier das Problem sein?
Ich hab schonmal den kompletten Index gelöscht und neu erstellt aber das hat nicht geholfen.
Das Problem muss irgentwo in dieser Methode liegen (tx_indexedsearch::getResultRows).
<?php
/**
* Get search result rows / data from database. Returned as data in array.
*
* @param array Search word array
* @param integer Pointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content.
* @return array False if no result, otherwise an array with keys for first row, result rows and total number of results found.
*/
function getResultRows($sWArr,$freeIndexUid=-1) {
// Getting SQL result pointer:
$GLOBALS['TT']->push('Searching result');
$res = $this->getResultRows_SQLpointer($sWArr,$freeIndexUid);
$GLOBALS['TT']->pull();
// Organize and process result:
if ($res) {
$count = $GLOBALS['TYPO3_DB']->sql_num_rows($res); // Total search-result count
$pointer = t3lib_div::intInRange($this->piVars['pointer'], 0, floor($count/$this->piVars['results'])); // The pointer is set to the result page that is currently being viewed
// Initialize result accumulation variables:
$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.
// 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)
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
// Set first row:
if (!$c) {
$firstRow = $row;
}
$row['show_resume'] = $this->checkResume($row); // Tells whether we can link directly to a document or not (depends on possible right problems)
$phashGr = !in_array($row['phash_grouping'], $grouping_phashes);
$chashGr = !in_array($row['contentHash'].'.'.$row['data_page_id'], $grouping_chashes);
if ($phashGr && $chashGr) {
if ($row['show_resume'] || $this->conf['show.']['forbiddenRecords']) { // Only if the resume may be shown are we going to filter out duplicates...
if (!$this->multiplePagesType($row['item_type'])) { // Only on documents which are not multiple pages documents
$grouping_phashes[] = $row['phash_grouping'];
}
$grouping_chashes[] = $row['contentHash'].'.'.$row['data_page_id'];
$c++; // Increase the result pointer
// All rows for display is put into resultRows[]
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;
}
} else {
$count--; // Skip this row if the user cannot view it (missing permission)
}
} else {
$count--; // For each time a phash_grouping document is found (which is thus not displayed) the search-result count is reduced, so that it matches the number of rows displayed.
}
}
return array(
'resultRows' => $resultRows,
'firstRow' => $firstRow,
'count' => $count
);
} else { // No results found:
return FALSE;
}
}
?>
Das $count (anzahl der Ergebnisse) ist am ende der Methode ('count' => $count) mal 63, mal 55 usw. jenachdem auf welcher Seite man ist, was ja eigentlich nicht sein darf.
Hat jemand dieses problem schonmal gehabt oder eine Idee wie man es lösen könnte?
Das ganze passiert auf einer mehrsprachigen Website, evtl. hat es ja damit etwas zu tun.
Mfg, xjk
Und wiedermal ist ein einziges Zeichen an der richtigen Position die Lösung:
Hab die Zeile "if (($c+1) > ($pointer+1)*$this->piVars['results']) break;" auskommentiert und nun stimmt es.