Changes for page Solr Search Macros
Last modified by Administrator on 2025/09/06 09:59
From version
4.1


edited by Administrator
on 2024/02/03 10:14
on 2024/02/03 10:14
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-search-solr-ui/15.10.5]
To version 1.1

edited by Administrator
on 2018/07/24 00:25
on 2018/07/24 00:25
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-search-solr-ui/9.11.7]
Summary
Details
- Page properties
-
- Content
-
... ... @@ -29,10 +29,7 @@ 29 29 </div> 30 30 <div class="col-xs-12 col-sm-6"> 31 31 <div class="input-group"> 32 - <label class='sr-only' for='search-page-bar-input'> 33 - $services.localization.render('search.page.bar.query.title') 34 - </label> 35 - <input id='search-page-bar-input' type='search' name='text' class='form-control withTip useTitleAsTip' 32 + <input type="search" name="text" class="form-control withTip useTitleAsTip" 36 36 title="$services.localization.render('search.page.bar.query.title')" value="$escapetool.xml($text)"/> 37 37 <span class="input-group-btn"> 38 38 <button type="submit" class="btn btn-primary"> ... ... @@ -181,18 +181,11 @@ 181 181 #else 182 182 #set ($facetPrettyName = $facetField.name) 183 183 #end 184 - <div class="search-facet-header"> 185 - <span id="$escapetool.xml($facetField.name)-toggler-hint">$escapetool.xml($facetPrettyName)</span> 186 - <button class="btn btn-xs facet-toggler" 187 - aria-controls="$escapetool.xml($facetField.name)-dropdown" 188 - aria-labelledby="$escapetool.xml($facetField.name)-toggler-hint"> 189 - $services.icon.renderHTML('caret-down') 190 - </button> 191 - </div> 181 + <div class="search-facet-header">$escapetool.xml($facetPrettyName)</div> 192 192 #end 193 193 194 194 #macro (displaySearchFacetBody $facetField) 195 - <div id="$escapetool.xml($facetField.name)-dropdown" class="search-facet-body">185 + <div class="search-facet-body"> 196 196 #set ($facetDisplayer = $solrConfig.facetDisplayers.get($facetField.name)) 197 197 #if (!$facetDisplayer && $facetField.name.startsWith('property.')) 198 198 ## Choose a facet displayer based on the property type. ... ... @@ -224,7 +224,7 @@ 224 224 225 225 #macro (displaySearchFacetValuesLimited $facetValues $customQueryStringParameters $customValueDisplayer) 226 226 #set ($limitRequestParameter = "l_$facetField.name") 227 - #set ($limit = $ numbertool.toNumber($request.getParameter($limitRequestParameter)).intValue())217 + #set ($limit = $mathtool.toInteger($request.getParameter($limitRequestParameter))) 228 228 #if ("$!limit" == '') 229 229 #set ($limit = $solrConfig.facetPaginationStep) 230 230 #end ... ... @@ -242,10 +242,6 @@ 242 242 #end 243 243 244 244 #macro (displaySearchFacetValue $facetValue $customQueryStringParameters $customValueDisplayer) 245 - #displaySearchFacetValue($facetValue $customQueryStringParameters $customValueDisplayer false) 246 -#end 247 - 248 -#macro (displaySearchFacetValue $facetValue $customQueryStringParameters $customValueDisplayer $displayToggler) 249 249 #set ($selectedValues = []) 250 250 #if ($facetRequestValues) 251 251 #set ($discard = $selectedValues.addAll($facetRequestValues.subList(0, $facetRequestValues.size()))) ... ... @@ -260,6 +260,7 @@ 260 260 #set ($discard = $queryStringParameters.putAll($customQueryStringParameters)) 261 261 #end 262 262 #extendQueryString($url $queryStringParameters) 249 + <div class="itemCount">$facetValue.count</div> 263 263 <a href="$url" class="itemName#if ($selected) selected#end#if ($facetValue.name == '') empty#end"> 264 264 #if ($facetValue.name == '') 265 265 #set ($facetPrettyValueKey = "solr.field.${facetField.name}.emptyValue") ... ... @@ -276,13 +276,7 @@ 276 276 $escapetool.xml($facetPrettyValue) 277 277 #end 278 278 </a> 279 - <div class="itemCount">$facetValue.count</div> 280 - #if ($displayToggler) 281 - <button class="btn btn-xs facet-value-toggler"> 282 - <span class='sr-only'>$escapetool.xml($facetPrettyValue)</span> 283 - $services.icon.renderHTML('caret-down') 284 - </button> 285 - #end 266 + <div class="clearfloats"></div> 286 286 #end 287 287 288 288 #** ... ... @@ -317,9 +317,9 @@ 317 317 (% class="search-options" %) 318 318 * {{translation key="solr.options"/}} 319 319 #if($highlightEnabled)#extendQueryString($url {'highlight': [false]})#else#extendQueryString($url {'highlight': [true]})#end 320 - * [[{{translation key="solr.options.highlight"/}}>>path:$ {url}||class="options-item#if($highlightEnabled) active#end" title="$services.localization.render('solr.options.highlight.title')"]]301 + * [[{{translation key="solr.options.highlight"/}}>>path:$url||class="options-item#if($highlightEnabled) active#end" title="$services.localization.render('solr.options.highlight.title')"]] 321 321 #if($facetEnabled)#extendQueryString($url {'facet': [false]})#else#extendQueryString($url {'facet': [true]})#end 322 - * [[{{translation key="solr.options.facet"/}}>>path:$ {url}||class="options-item#if($facetEnabled) active#end" title="$services.localization.render('solr.options.facet.title')"]]303 + * [[{{translation key="solr.options.facet"/}}>>path:$url||class="options-item#if($facetEnabled) active#end" title="$services.localization.render('solr.options.facet.title')"]] 323 323 324 324 (% class="search-results-sort" %) 325 325 * {{translation key="solr.sortBy"/}} ... ... @@ -334,7 +334,7 @@ 334 334 #set ($targetSortOrder = "#if ($sortOrder == 'asc')desc#{else}asc#end") 335 335 #end 336 336 #extendQueryString($url {'sort': [$entry.key], 'sortOrder': [$targetSortOrder]}) 337 - * [[{{translation key="solr.sortBy.$entry.key"/}}$!sortOrderIndicator>>path:$ {url}||class="$class"]]318 + * [[{{translation key="solr.sortBy.$entry.key"/}}$!sortOrderIndicator>>path:$url||class="$class"]] 338 338 #end 339 339 #end 340 340 ... ... @@ -580,7 +580,7 @@ 580 580 'matches': $matches 581 581 })) 582 582 #end 583 - #set ($highlighting = $ collectiontool.sort($highlighting, 'priority:desc'))564 + #set ($highlighting = $sorttool.sort($highlighting, 'priority:desc')) 584 584 #set ($return = $NULL) 585 585 #setVariable("$return" $highlighting) 586 586 #end ... ... @@ -595,10 +595,7 @@ 595 595 #set ($discard = $query.setLimit($rows)) 596 596 #set ($discard = $query.setOffset($start)) 597 597 #set ($discard = $query.bindValue('sort', "${sort} ${sortOrder}")) 598 - #set ($discard = $query.bindValue('tie', $solrConfig.tieBreaker)) 599 - #set ($discard = $query.bindValue('mm', $solrConfig.minShouldMatch)) 600 600 #setQueryFields($query) 601 - #setPhraseFields($query) 602 602 #setFacetFields($query) 603 603 #setFilterQuery($query) 604 604 #setHighlightQuery($query) ... ... @@ -626,55 +626,6 @@ 626 626 #set ($discard = $query.bindValue('qf', $boost)) 627 627 #end 628 628 #end 629 - 630 -#macro (setPhraseFields $query) 631 - ## Set the main phrase field parameter boosts so that queries with all search terms 632 - ## in close proximity have high relevance 633 - #if ($solrConfig.phraseFields.substring(0, 0) == '') 634 - ## If the value of the 'phraseFields' parameter is a string then it means that the 635 - ## same query fields are used for all result types. 636 - #set ($phraseFieldsBoost = $solrConfig.phraseFields) 637 - #else 638 - ## There are different phrase fields for each result type. 639 - ## Including type = null, which will result from all facets being deselected 640 - #set ($phraseFieldsBoost = $solrConfig.phraseFields.get("$!type")) 641 - #end 642 - #if ("$!phraseFieldsBoost" != '') 643 - #set ($discard = $query.bindValue('pf', $phraseFieldsBoost)) 644 - #set ($discard = $query.bindValue('ps', $solrConfig.phraseFieldSlop)) 645 - #end 646 - ## Set the bigram phrase field parameter boosts so that queries with groups of two 647 - ## search terms in close proximity have high relevance 648 - #if ($solrConfig.bigramPhraseFields.substring(0, 0) == '') 649 - ## If the value of the 'bigramPhraseFields' parameter is a string then it means that the 650 - ## same query fields are used for all result types. 651 - #set ($bigramPhraseFieldsBoost = $solrConfig.bigramPhraseFields) 652 - #else 653 - ## There are different phrase fields for each result type. 654 - ## Including type = null, which will result from all facets being deselected 655 - #set ($bigramPhraseFieldsBoost = $solrConfig.bigramPhraseFields.get("$!type")) 656 - #end 657 - #if ("$!bigramPhraseFieldsBoost" != '') 658 - #set ($discard = $query.bindValue('pf2', $bigramPhraseFieldsBoost)) 659 - #set ($discard = $query.bindValue('ps2', $solrConfig.bigramPhraseFieldSlop)) 660 - #end 661 - ## Set the trigram phrase field parameter boosts so that queries with groups of three 662 - ## search terms in close proximity have high relevance. 663 - ## Generally (pf boost) > (pf3 boost) > (pf2 boost) 664 - #if ($solrConfig.trigramPhraseFields.substring(0, 0) == '') 665 - ## If the value of the 'trigramPhraseFields' parameter is a string then it means that the 666 - ## same query fields are used for all result types. 667 - #set ($trigramPhraseFieldsBoost = $solrConfig.trigramPhraseFields) 668 - #else 669 - ## There are different phrase fields for each result type. 670 - ## including type = null, which will result from all facets being deselected 671 - #set ($trigramPhraseFieldsBoost = $solrConfig.trigramPhraseFields.get("$!type")) 672 - #end 673 - #if ("$!trigramPhraseFieldsBoost" != '') 674 - #set ($discard = $query.bindValue('pf3', $trigramPhraseFieldsBoost)) 675 - #set ($discard = $query.bindValue('ps3', $solrConfig.trigramPhraseFieldSlop)) 676 - #end 677 -#end 678 678 679 679 #macro (setFacetFields $query) 680 680 #set ($discard = $query.bindValue('facet', $facetEnabled)) ... ... @@ -734,7 +734,7 @@ 734 734 #set ($discard = $filters.put($fieldName, $escapedValues)) 735 735 #if ($prefixFacets.contains($fieldName)) 736 736 #set ($parts = $parameter.value.get(0).split('/', 2)) 737 - #set ($length = $ numbertool.toNumber($parts.get(0)).intValue()+ 1)666 + #set ($length = $mathtool.toInteger($parts.get(0)) + 1) 738 738 #set ($prefix = "$length/$parts.get(1)") 739 739 #set ($discard = $query.bindValue("f.${fieldName}.facet.prefix", $prefix)) 740 740 #set ($discard = $prefixFacets.remove($fieldName)) ... ... @@ -798,11 +798,11 @@ 798 798 #end 799 799 ## 800 800 ## Pagination 801 - #set ($rows = $numbertool.t oNumber($request.rows).intValue())730 + #set ($rows = $numbertool.integer($request.rows)) 802 802 #if ("$!rows" == '') 803 803 #set ($rows = 10) 804 804 #end 805 - #set ($start = $numbertool.t oNumber($request.firstIndex).intValue())734 + #set ($start = $numbertool.integer($request.firstIndex)) 806 806 #if ("$!start" == '') 807 807 #set ($start = 0) 808 808 #end