-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Improve output to something useful
- Adds summary from the fulltext using highlighting - Adds pagination of results - Adds breadcrumb for each result - Wraps output in container for styling This change has originally been based upon mocdk@c326730.
- Loading branch information
1 parent
7167c20
commit 8c832c4
Showing
7 changed files
with
87 additions
and
28 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
Classes/Flowpack/SearchPlugin/EelHelper/SearchArrayHelper.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
namespace Flowpack\SearchPlugin\EelHelper; | ||
|
||
/* * | ||
* This script belongs to the TYPO3 Flow package "Flowpack.SearchPlugin". * | ||
* * | ||
* It is free software; you can redistribute it and/or modify it under * | ||
* the terms of the GNU Lesser General Public License, either version 3 * | ||
* of the License, or (at your option) any later version. * | ||
* * | ||
* The TYPO3 project - inspiring people to share! * | ||
* */ | ||
use TYPO3\Flow\Annotations as Flow; | ||
use TYPO3\Eel\ProtectedContextAwareInterface; | ||
|
||
/** | ||
* Additional Array Helpers which might once | ||
* | ||
* @Flow\Proxy(false) | ||
*/ | ||
class SearchArrayHelper implements ProtectedContextAwareInterface { | ||
|
||
/** | ||
* Concatenate arrays or values to a new array | ||
* | ||
* @param array|mixed $array1 First array or value | ||
* @param array|mixed $array2 Second array or value | ||
* @param array|mixed $array_ Optional variable list of additional arrays / values | ||
* @return array The array with concatenated arrays or values | ||
*/ | ||
public function flatten($arrays) { | ||
$return = array(); | ||
array_walk_recursive($arrays, function($a) use (&$return) { $return[] = $a; }); | ||
return $return; | ||
} | ||
|
||
/** | ||
* All methods are considered safe | ||
* | ||
* @param string $methodName | ||
* @return boolean | ||
*/ | ||
public function allowsCallOfMethod($methodName) { | ||
return TRUE; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
{namespace neos=TYPO3\Neos\ViewHelpers} | ||
{namespace ts=TYPO3\TypoScript\ViewHelpers} | ||
{namespace search=TYPO3\TYPO3CR\Search\ViewHelpers} | ||
<div{attributes -> f:format.raw()}> | ||
{searchForm -> f:format.raw()} | ||
|
||
{searchForm -> f:format.raw()} | ||
|
||
Showing {searchResults -> f:count()} of {totalSearchResults} results | ||
|
||
{searchResultRenderer -> f:format.raw()} | ||
<f:if condition="{searchQuery}"> | ||
<search:widget.paginate query="{searchQuery}" as="results"> | ||
Showing {results.accessibleCount} of {totalSearchResults} results | ||
<ts:render path="searchResultRenderer" context="{searchResults: results}" /> | ||
</search:widget.paginate> | ||
</f:if> | ||
</div> |
19 changes: 14 additions & 5 deletions
19
Resources/Private/Templates/SearchResult/DocumentSearchResult.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
{namespace neos=TYPO3\Neos\ViewHelpers} | ||
<neos:link.node node="{node}">{title}</neos:link.node> | ||
|
||
<b><neos:link.node node="{node}"> | ||
{title} | ||
</neos:link.node></b><br /> | ||
<f:if condition="{highlight}"> | ||
<p> | ||
<f:for each="{highlight}" as="fragment" iteration="fragmentIterator"> | ||
{fragment -> f:format.raw()}{f:if(condition: fragmentIterator.isLast, else: '...')} | ||
</f:for> | ||
</p> | ||
|
||
<f:if condition="{description}"> | ||
{description} | ||
<div class="breadcrumb"> | ||
<span>Path:</span> | ||
<f:for each="{parents}" as="parent"> | ||
<neos:link.node node="{parent}" /> | ||
</f:for> | ||
<neos:link.node node="{node}" /> | ||
</div> | ||
</f:if> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters