Commit 557433d5 authored by Thomas Löffler's avatar Thomas Löffler
Browse files

Beautify the search results for news and pages

parent 9fe9da06
Pipeline #4041 passed with stages
in 3 minutes and 33 seconds
plugin.tx_solr { plugin.tx_solr {
templateFiles { view {
results = EXT:t3olayout/Resources/Private/Templates/Solr/Results.html templateRootPaths {
pagebrowser = EXT:t3org_layout/Resources/Private/Templates/Solr/Pagebrowser.html 10 = EXT:t3org_layout/Resources/Private/Templates/Solr
}
partialRootPaths {
10 = EXT:t3org_layout/Resources/Private/Partials/Solr
}
layoutRootPaths {
10 = EXT:t3org_layout/Resources/Private/Layouts/Solr
}
} }
cssFiles { cssFiles {
results = results =
...@@ -11,4 +18,23 @@ plugin.tx_solr { ...@@ -11,4 +18,23 @@ plugin.tx_solr {
allowedSites = __all allowedSites = __all
} }
} }
index {
queue {
news {
fields {
datetime_intS = TEXT
datetime_intS {
field = datetime
}
published_dateS = TEXT
published_dateS {
field = datetime
date = Y-m-d\TH:i:s\Z
}
}
}
}
}
} }
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
xmlns:s="http://typo3.org/ns/ApacheSolrForTypo3/Solr/ViewHelpers">
<f:section name="Document">
<f:render partial="Result/Item/{document.type}" arguments="{_all}" />
</f:section>
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<li class="results-entry{f:if(condition:document.isElevated, then: ' results-elevated')}"
data-document-score="{document.score}"
data-document-id="{document.id}"
data-document-url="{document.url}"
>
<f:if condition="{document.isElevated}">
<div class="results-elevated-label">
<s:translate key="sponsored" />
</div>
</f:if>
<h5 class="results-topic">
<a href="{s:uri.result.addSearchWordList(url:document.url, searchWords:resultSet.usedQuery.keywords)}">{document.title}</a>
</h5>
<div class="results-teaser">
<p class="result-content">{document.content -> f:format.crop(maxCharacters:'250')}</p>
</div>
</li>
</html>
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<li class="results-entry{f:if(condition:document.isElevated, then: ' results-elevated')}"
data-document-score="{document.score}"
data-document-id="{document.id}"
data-document-url="{document.url}"
>
<h5 class="results-topic mb-0">
<a href="{s:uri.result.addSearchWordList(url:document.url, searchWords:resultSet.usedQuery.keywords)}"><i class="fa fa-newspaper-o"></i> {document.title}</a><br>
</h5>
<div class="news-single__categories d-inline-block small">
Published: {document.datetime_intS -> f:format.date(format:'jS F Y')}
</div>
<div class="results-teaser">
<p class="result-content">{document.content -> f:format.crop(maxCharacters:'250')}</p>
</div>
</li>
</html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
xmlns:s="http://typo3.org/ns/ApacheSolrForTypo3/Solr/ViewHelpers/">
<f:layout name="Main"/>
<f:section name="main">
<div id="tx-solr-search">
<f:render partial="Search/Form" section="Form" arguments="{search:search, additionalFilters:additionalFilters, pluginNamespace: pluginNamespace, resultSet: resultSet}" />
<f:if condition="{resultSet.isAutoCorrected}">
<f:then>
<span class="searched-for">
<s:translate key="no_results_nothing_found" arguments="{0: resultSet.initialQueryString}">Nothing found for "%s".</s:translate>
<s:translate key="no_results_search_for_original" arguments="{0: resultSet.correctedQueryString}">Search instead for "%s".</s:translate>
</span>
</f:then>
<f:else>
<f:if condition="{resultSet.usedQuery.keywordsCleaned}">
<span class="searched-for">
<s:translate key="results_searched_for" arguments="{0: resultSet.usedQuery.keywordsCleaned}">Searched for "%s"</s:translate>
</span>
</f:if>
</f:else>
</f:if>
<f:if condition="{resultSet.hasSpellCheckingSuggestions}">
<f:then>
<s:translate key="didYouMean">Did you mean</s:translate>
<f:for each="{resultSet.spellCheckingSuggestions}" as="suggestion">
<f:link.page additionalParams="{q:suggestion.suggestion}" noCacheHash="1">{suggestion.suggestion}</f:link.page>
</f:for> ?
</f:then>
</f:if>
<f:if condition="{resultSet.usedSearch.numberOfResults}">
<span class="result-found">
<s:translate key="results_found" arguments="{0:resultSet.usedSearch.numberOfResults, 1: resultSet.usedSearch.queryTime}">Found %d results in %d seconds</s:translate>
</span>
<span class="result-range">
<s:pageBrowserRange>
<s:translate key="results_range" arguments="{0:from, 1: to, 2: total}">Results %d until %d of %d</s:translate>
</s:pageBrowserRange>
</span>
</f:if>
<f:if condition="{hasSearched}">
<s:widget.resultPaginate resultSet="{resultSet}">
<ol start="{pagination.displayRangeStart}" class="results-list">
<f:for each="{documents}" as="document">
<f:render partial="Result/Document" section="Document" arguments="{resultSet:resultSet, document:document}" />
</f:for>
</ol>
</s:widget.resultPaginate>
</f:if>
</div>
<div id="tx-solr-search-functions">
<f:if condition="{hasSearched}">
<f:if condition="{resultSet.usedSearchRequest.contextTypoScriptConfiguration.searchSorting}">
<f:render partial="Result/Sorting" section="Sorting" arguments="{resultSet:resultSet}" />
</f:if>
<f:if condition="{resultSet.usedSearchRequest.contextTypoScriptConfiguration.searchFaceting}">
<f:render partial="Result/Facets" section="Facets" arguments="{resultSet:resultSet}" />
</f:if>
</f:if>
<f:if condition="{resultSet.usedSearchRequest.contextTypoScriptConfiguration.searchLastSearches}">
<f:render partial="Search/LastSearches" section="LastSearches" arguments="{resultSet:resultSet}" />
</f:if>
<f:if condition="{resultSet.usedSearchRequest.contextTypoScriptConfiguration.searchFrequentSearches}">
<f:render partial="Search/FrequentlySearched" section="FrequentlySearched" />
</f:if>
</div>
</f:section>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment