Commit 4e8f5d1d authored by Thomas Löffler's avatar Thomas Löffler

Redesigns solr result list

* Shows search input field
* Shows facets with tags and TYPO3 versions
* Full-width search
parent 2710539d
Pipeline #1978 passed with stages
in 1 minute and 28 seconds
......@@ -106,10 +106,25 @@ class TerIndexer extends \ApacheSolrForTypo3\Solr\IndexQueue\Indexer {
// does this extension supports different versions?
// @todo: use JSON with all versions to get them
$lastVersion = $extension->getLastVersion();
$document->setField('supports6_boolS', Version::doesExtensionVersionSupportTypo3Version($lastVersion, 6200000));
$document->setField('supports6_boolS', Version::doesExtensionVersionSupportTypo3Version($lastVersion, 6002000));
$document->setField('supports7_boolS', Version::doesExtensionVersionSupportTypo3Version($lastVersion, 7006000));
$document->setField('supports8_boolS', Version::doesExtensionVersionSupportTypo3Version($lastVersion, 8007000));
$document->setField('supports9_boolS', Version::doesExtensionVersionSupportTypo3Version($lastVersion, 9000000));
$typo3Support = [];
if (Version::doesExtensionVersionSupportTypo3Version($lastVersion, 6002000)) {
$typo3Support[] = '6.2 LTS';
}
if (Version::doesExtensionVersionSupportTypo3Version($lastVersion, 7006000)) {
$typo3Support[] = '7 LTS';
}
if (Version::doesExtensionVersionSupportTypo3Version($lastVersion, 8007000)) {
$typo3Support[] = '8 LTS';
}
if (Version::doesExtensionVersionSupportTypo3Version($lastVersion, 9000000)) {
$typo3Support[] = '9';
}
$document->setField('typo3support_stringM', $typo3Support);
// add documentation link
/** @var \T3o\TerFe2\Service\Documentation $documentationService */
......
......@@ -184,6 +184,12 @@ plugin {
localField = tags
multiValue = 1
}
keywords_stringM = SOLR_RELATION
keywords_stringM {
localField = tags
multiValue = 1
}
}
}
}
......
......@@ -47,7 +47,7 @@
<h3>Tags</h3>
<p class="tags">
<f:for each="{extension.tags}" as="tag">
<f:link.page class="btn btn-info mb-1" pageUid="{settings.pages.searchResultsPid}" additionalParams="{tx_solr: {filter: {0: 'keywords:{tag.title}'}}}">#{tag.title}</f:link.page>
<f:link.page class="btn btn-info mb-1" pageUid="{settings.pages.searchResultsPid}" additionalParams="{tx_solr: {filter: {0: 'tags:{tag.title}'}}}">#{tag.title}</f:link.page>
</f:for>
</p>
</f:if>
......
......@@ -15,37 +15,29 @@ plugin.tx_solr {
cssFiles.results =
}
lib.solr.format_number = TEXT
lib.solr.format_number {
field = argument_0
numberFormat = 1
numberFormat.thousands_sep = ,
}
lib.solr.extensionkeywithdashes = TEXT
lib.solr.extensionkeywithdashes {
field = argument_0
replacement {
10 {
search = _
replace = -
}
}
}
plugin.tx_solr.search.faceting = 1
plugin.tx_solr.search.faceting {
facets >
facets {
keywords {
label = Keywords
field = keywords
# we need the facet to be able to filter by keywords, but we don't want to show it in the filter
includeInAvailableFacets = 0
includeInUsedFacets = 0
includeInUsedFacets = 0
plugin.tx_solr.search {
query {
allowEmptyQuery = 1
}
faceting = 1
faceting {
facetLimit = 25
facets >
facets {
typo3 {
label = Works with TYPO3
field = typo3support_stringM
partialName = OptionsTypo3
itemClass = success
sortBy = alpha
}
tags {
label = Extension tags
field = keywords_stringM
partialName = OptionsTags
itemClass = info
prefix = #
}
}
}
}
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
data-namespace-typo3-fluid="true"
>
<div class="card-header">
<span class="facet-label">{facet.label}</span>
</div>
<div class="card-block">
<div class="facet-option-list facet-type-options fluidfacet" data-facet-name="{facet.name}" data-facet-label="{facet.label}">
<f:for each="{facet.options}" as="option" iteration="iteration">
<a class="btn btn-outline-{facet.configuration.itemClass} mb-1 mr-1 facet solr-ajaxified" href="{s:uri.facet.addFacetItem(facet: facet, facetItem: option)}">
<strong>
{facet.configuration.prefix}{option.label}
<span class="badge badge-{facet.configuration.itemClass}">{option.documentCount}</span>
</strong>
</a>
</f:for>
</div>
</div>
</html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
data-namespace-typo3-fluid="true"
>
<div class="card-header">
<span class="facet-label">{facet.label}</span>
</div>
<div class="card-block">
<div class="facet-option-list facet-type-options fluidfacet" data-facet-name="{facet.name}" data-facet-label="{facet.label}">
<f:for each="{facet.options}" as="option" iteration="iteration">
<a class="btn btn-outline-{facet.configuration.itemClass} mb-1 facet solr-ajaxified" href="{s:uri.facet.addFacetItem(facet: facet, facetItem: option)}">
<strong>
{option.label}
<span class="badge badge-{facet.configuration.itemClass}">{option.documentCount}</span>
</strong>
</a><br>
</f:for>
</div>
</div>
</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:section name="Facets">
<div id="tx-solr-faceting">
<f:if condition="{resultSet.facets.used -> f:count()}">
<div id="tx-solr-facets-in-use">
<h3><s:translate key="faceting_resultsNarrowedBy">Used facets</s:translate></h3>
<ul class="facets list-unstyled">
<f:for each="{resultSet.facets.used}" as="facet">
<f:for each="{facet.allFacetItems.selected}" as="item">
<li class="mb-1">
<a href="{s:uri.facet.removeFacetItem(facet: facet, facetItem: item)}" class="btn btn-{facet.configuration.itemClass} facet remove-facet-option solr-ajaxified">
<strong><i class="fa fa-times"></i> {facet.configuration.prefix}{item.label}</strong>
</a>
</li>
</f:for>
</f:for>
<li class="facets-remove-all mt-3">
<a href="{s:uri.facet.removeAllFacets()}" class="btn btn-primary solr-ajaxified">
<strong><i class="fa fa-times"></i> <s:translate key="faceting_removeAllFilters">Remove all filters</s:translate></strong>
</a>
</li>
</ul>
</div>
</f:if>
<s:facet.area.group groupName="main" facets="{resultSet.facets.available}">
<div class="facet-area-main">
<div class="solr-facets-available secondaryContentSection">
<div class="csc-header">
<h3 class="csc-firstHeader"><s:translate key="faceting_narrowSearch">Narrow Search</s:translate></h3>
</div>
<f:for each="{areaFacets}" as="facet">
<div class="card">
<f:render partial="Facets/{facet.partialName}" arguments="{resultSet:resultSet, facet:facet}"/>
</div>
</f:for>
</div>
</div>
</s:facet.area.group>
</div>
</f:section>
<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="Form">
<div class="tx-solr-search-form mt-5">
<s:searchForm id="tx-solr-search-form-pi-results" class="" additionalFilters="{additionalFilters}">
<input type="hidden" name="L" value="{languageUid}" />
<input type="hidden" name="id" value="{pageUid}" />
<div class="input-group input-group-lg">
<input type="text" class="form-control" placeholder="Search for extensions, tags, author..." name="q" value="{q}">
<span class="input-group-btn">
<button type="submit" class="btn btn-primary" type="button"><s:translate key="submit" default="Search" /></button>
</span>
</div>
</s:searchForm>
</div>
</f:section>
......@@ -6,55 +6,69 @@
<f:section name="main">
<div id="tx-solr-search">
<div class="container-fluid">
<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:render partial="Search/Form" section="Form" arguments="{search:search, additionalFilters:additionalFilters, pluginNamespace: pluginNamespace, resultSet: resultSet}" />
<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 condition="{resultSet.usedSearch.numberOfResults}">
<div class="mb-4">
<i class="result-found">
<s:translate key="results_found" arguments="{0:resultSet.usedSearch.numberOfResults, 1: resultSet.usedSearch.queryTime}">Found %d extensions in %d seconds</s:translate>
</i>
</div>
</f:if>
<f:if condition="{resultSet.hasSpellCheckingSuggestions}">
<f:if condition="{resultSet.usedSearch.numberOfResults}">
<f:else>
<div class="alert alert-danger mt-3">
<s:translate key="no_results_nothing_found" arguments="{0: resultSet.usedQuery.queryString}">Nothing found for "%s".</s:translate>
</div>
</f:else>
<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>
<div class="row">
<div class="col-lg-3">
<f:if condition="{resultSet.usedSearchRequest.contextTypoScriptConfiguration.searchFaceting}">
<f:render partial="Result/Facets" section="Facets" arguments="{resultSet:resultSet}" />
</f:if>
</div>
<div class="col-lg-9">
<div id="tx-solr-search">
<f:if condition="{resultSet.isAutoCorrected}">
<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: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 extensions in %d seconds</s:translate>
</span>
</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="{hasSearched}">
<s:widget.resultPaginate resultSet="{resultSet}" configuration="{templatePath:'EXT:ter_layout/Resources/Private/Templates/Solr/ViewHelpers/Widget/ResultPaginate/Index.html'}">
<ol start="{pagination.displayRangeStart}" class="results-list list-unstyled">
<f:for each="{documents}" as="document" iteration="iterator">
<f:if condition="{iterator.isOdd}">
<div class="card-deck">
</f:if>
<f:render partial="Result/Document" section="Document" arguments="{resultSet:resultSet, document:document}" />
<f:if condition="{iterator.isEven} || {iterator.isLast}">
</div>
</f:if>
</f:for>
</ol>
</s:widget.resultPaginate>
<f:if condition="{hasSearched}">
<s:widget.resultPaginate resultSet="{resultSet}" configuration="{templatePath:'EXT:ter_layout/Resources/Private/Templates/Solr/ViewHelpers/Widget/ResultPaginate/Index.html'}">
<ol start="{pagination.displayRangeStart}" class="results-list list-unstyled">
<f:for each="{documents}" as="document" iteration="iterator">
<f:if condition="{iterator.isOdd}">
<div class="card-deck">
</f:if>
<f:render partial="Result/Document" section="Document" arguments="{resultSet:resultSet, document:document}" />
<f:if condition="{iterator.isEven} || {iterator.isLast}">
</div>
</f:if>
</f:for>
</ol>
</s:widget.resultPaginate>
</f:if>
</div>
</div>
</div>
</f:then>
</f:if>
</div>
</f:section>
Markdown is supported
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