Index: trunk/phase3/includes/specials/SpecialSearch.php |
— | — | @@ -177,9 +177,14 @@ |
178 | 178 | $this->powerSearchOptions() |
179 | 179 | ); |
180 | 180 | |
| 181 | + $suggestionSnippet = $textMatches->getSuggestionSnippet(); |
| 182 | + |
| 183 | + if( $suggestionSnippet == '' ) |
| 184 | + $suggestionSnippet = null; |
| 185 | + |
181 | 186 | $suggestLink = $sk->linkKnown( |
182 | 187 | $st, |
183 | | - $textMatches->getSuggestionSnippet(), |
| 188 | + $suggestionSnippet, |
184 | 189 | array(), |
185 | 190 | $stParams |
186 | 191 | ); |
— | — | @@ -413,9 +418,14 @@ |
414 | 419 | $sk = $wgUser->getSkin(); |
415 | 420 | $t = $result->getTitle(); |
416 | 421 | |
| 422 | + $titleSnippet = $result->getTitleSnippet($terms); |
| 423 | + |
| 424 | + if( $titleSnippet == '' ) |
| 425 | + $titleSnippet = null; |
| 426 | + |
417 | 427 | $link = $this->sk->linkKnown( |
418 | 428 | $t, |
419 | | - $result->getTitleSnippet($terms) |
| 429 | + $titleSnippet |
420 | 430 | ); |
421 | 431 | |
422 | 432 | //If page content is not readable, just return the title. |
— | — | @@ -441,7 +451,10 @@ |
442 | 452 | $sectionText = $result->getSectionSnippet($terms); |
443 | 453 | $redirect = ''; |
444 | 454 | |
445 | | - if( !is_null($redirectTitle) ) |
| 455 | + if( !is_null($redirectTitle) ) { |
| 456 | + if( $redirectText == '' ) |
| 457 | + $redirectText = null; |
| 458 | + |
446 | 459 | $redirect = "<span class='searchalttitle'>" . |
447 | 460 | wfMsg( |
448 | 461 | 'search-redirect', |
— | — | @@ -451,10 +464,15 @@ |
452 | 465 | ) |
453 | 466 | ) . |
454 | 467 | "</span>"; |
| 468 | + } |
455 | 469 | |
456 | 470 | $section = ''; |
457 | 471 | |
458 | | - if( !is_null($sectionTitle) ) |
| 472 | + |
| 473 | + if( !is_null($sectionTitle) ) { |
| 474 | + if( $sectionText == '' ) |
| 475 | + $sectionText = null; |
| 476 | + |
459 | 477 | $section = "<span class='searchalttitle'>" . |
460 | 478 | wfMsg( |
461 | 479 | 'search-section', $this->sk->linkKnown( |
— | — | @@ -463,6 +481,7 @@ |
464 | 482 | ) |
465 | 483 | ) . |
466 | 484 | "</span>"; |
| 485 | + } |
467 | 486 | |
468 | 487 | // format text extract |
469 | 488 | $extract = "<div class='searchresult'>".$result->getTextSnippet($terms)."</div>"; |
— | — | @@ -603,16 +622,24 @@ |
604 | 623 | |
605 | 624 | $t = $result->getTitle(); |
606 | 625 | |
| 626 | + $titleSnippet = $result->getTitleSnippet($terms); |
| 627 | + |
| 628 | + if( $titleSnippet == '' ) |
| 629 | + $titleSnippet = null; |
| 630 | + |
607 | 631 | $link = $this->sk->linkKnown( |
608 | 632 | $t, |
609 | | - $result->getTitleSnippet($terms) |
| 633 | + $titleSnippet |
610 | 634 | ); |
611 | 635 | |
612 | 636 | // format redirect if any |
613 | 637 | $redirectTitle = $result->getRedirectTitle(); |
614 | 638 | $redirectText = $result->getRedirectSnippet($terms); |
615 | 639 | $redirect = ''; |
616 | | - if( !is_null($redirectTitle) ) |
| 640 | + if( !is_null($redirectTitle) ) { |
| 641 | + if( $redirectText == '' ) |
| 642 | + $redirectText = null; |
| 643 | + |
617 | 644 | $redirect = "<span class='searchalttitle'>" . |
618 | 645 | wfMsg( |
619 | 646 | 'search-redirect', |
— | — | @@ -622,6 +649,7 @@ |
623 | 650 | ) |
624 | 651 | ) . |
625 | 652 | "</span>"; |
| 653 | + } |
626 | 654 | |
627 | 655 | $out = ""; |
628 | 656 | // display project name |
— | — | @@ -1041,9 +1069,14 @@ |
1042 | 1070 | $this->powerSearchOptions() |
1043 | 1071 | ); |
1044 | 1072 | |
| 1073 | + $suggestionSnippet = $textMatches->getSuggestionSnippet(); |
| 1074 | + |
| 1075 | + if( $suggestionSnippet ) |
| 1076 | + $suggestionSnippet = null; |
| 1077 | + |
1045 | 1078 | $suggestLink = $sk->linkKnown( |
1046 | 1079 | $st, |
1047 | | - $textMatches->getSuggestionSnippet(), |
| 1080 | + $suggestionSnippet, |
1048 | 1081 | array(), |
1049 | 1082 | $stParams |
1050 | 1083 | ); |
— | — | @@ -1273,9 +1306,14 @@ |
1274 | 1307 | $t = $result->getTitle(); |
1275 | 1308 | $sk = $wgUser->getSkin(); |
1276 | 1309 | |
| 1310 | + $titleSnippet = $result->getTitleSnippet($terms); |
| 1311 | + |
| 1312 | + if( $titleSnippet == '' ) |
| 1313 | + $titleSnippet = null; |
| 1314 | + |
1277 | 1315 | $link = $sk->linkKnown( |
1278 | 1316 | $t, |
1279 | | - $result->getTitleSnippet($terms) |
| 1317 | + $titleSnippet |
1280 | 1318 | ); |
1281 | 1319 | |
1282 | 1320 | //If page content is not readable, just return the title. |
— | — | @@ -1301,7 +1339,10 @@ |
1302 | 1340 | $sectionTitle = $result->getSectionTitle(); |
1303 | 1341 | $sectionText = $result->getSectionSnippet($terms); |
1304 | 1342 | $redirect = ''; |
1305 | | - if( !is_null($redirectTitle) ) |
| 1343 | + if( !is_null($redirectTitle) ) { |
| 1344 | + if( $redirectText == '' ) |
| 1345 | + $redirectText = null; |
| 1346 | + |
1306 | 1347 | $redirect = "<span class='searchalttitle'>" . |
1307 | 1348 | wfMsg( |
1308 | 1349 | 'search-redirect', |
— | — | @@ -1311,8 +1352,14 @@ |
1312 | 1353 | ) |
1313 | 1354 | ) . |
1314 | 1355 | "</span>"; |
| 1356 | + } |
| 1357 | + |
1315 | 1358 | $section = ''; |
1316 | | - if( !is_null($sectionTitle) ) |
| 1359 | + |
| 1360 | + if( !is_null($sectionTitle) ) { |
| 1361 | + if( $sectionText == '' ) |
| 1362 | + $sectionText = null; |
| 1363 | + |
1317 | 1364 | $section = "<span class='searchalttitle'>" . |
1318 | 1365 | wfMsg( |
1319 | 1366 | 'search-section', |
— | — | @@ -1322,6 +1369,7 @@ |
1323 | 1370 | ) |
1324 | 1371 | ) . |
1325 | 1372 | "</span>"; |
| 1373 | + } |
1326 | 1374 | |
1327 | 1375 | // format text extract |
1328 | 1376 | $extract = "<div class='searchresult'>".$result->getTextSnippet($terms)."</div>"; |
— | — | @@ -1463,16 +1511,24 @@ |
1464 | 1512 | $t = $result->getTitle(); |
1465 | 1513 | $sk = $wgUser->getSkin(); |
1466 | 1514 | |
| 1515 | + $titleSnippet = $result->getTitleSnippet($terms); |
| 1516 | + |
| 1517 | + if( $titleSnippet == '' ) |
| 1518 | + $titleSnippet = null; |
| 1519 | + |
1467 | 1520 | $link = $sk->linkKnown( |
1468 | 1521 | $t, |
1469 | | - $result->getTitleSnippet( $terms ) |
| 1522 | + $titleSnippet |
1470 | 1523 | ); |
1471 | 1524 | |
1472 | 1525 | // format redirect if any |
1473 | 1526 | $redirectTitle = $result->getRedirectTitle(); |
1474 | 1527 | $redirectText = $result->getRedirectSnippet($terms); |
1475 | 1528 | $redirect = ''; |
1476 | | - if( !is_null($redirectTitle) ) |
| 1529 | + if( !is_null($redirectTitle) ) { |
| 1530 | + if( $redirectText == '' ) |
| 1531 | + $redirectText = null; |
| 1532 | + |
1477 | 1533 | $redirect = "<span class='searchalttitle'>" . |
1478 | 1534 | wfMsg( |
1479 | 1535 | 'search-redirect', |
— | — | @@ -1482,6 +1538,7 @@ |
1483 | 1539 | ) |
1484 | 1540 | ) . |
1485 | 1541 | "</span>"; |
| 1542 | + } |
1486 | 1543 | |
1487 | 1544 | $out = ""; |
1488 | 1545 | // display project name |