Changes for page Solr Search Macros

Last modified by Administrator on 2025/09/06 09:59

From version 3.1
edited by Administrator
on 2020/12/29 00:17
Change comment: Install extension [org.xwiki.platform:xwiki-platform-search-solr-ui/12.10.2]
To version 1.1
edited by Administrator
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
... ... @@ -214,7 +214,7 @@
214 214  
215 215  #macro (displaySearchFacetValuesLimited $facetValues $customQueryStringParameters $customValueDisplayer)
216 216   #set ($limitRequestParameter = "l_$facetField.name")
217 - #set ($limit = $numbertool.toNumber($request.getParameter($limitRequestParameter)).intValue())
217 + #set ($limit = $mathtool.toInteger($request.getParameter($limitRequestParameter)))
218 218   #if ("$!limit" == '')
219 219   #set ($limit = $solrConfig.facetPaginationStep)
220 220   #end
... ... @@ -298,9 +298,9 @@
298 298   (% class="search-options" %)
299 299   * {{translation key="solr.options"/}}
300 300   #if($highlightEnabled)#extendQueryString($url {'highlight': [false]})#else#extendQueryString($url {'highlight': [true]})#end
301 - * [[{{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')"]]
302 302   #if($facetEnabled)#extendQueryString($url {'facet': [false]})#else#extendQueryString($url {'facet': [true]})#end
303 - * [[{{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')"]]
304 304  
305 305   (% class="search-results-sort" %)
306 306   * {{translation key="solr.sortBy"/}}
... ... @@ -315,7 +315,7 @@
315 315   #set ($targetSortOrder = "#if ($sortOrder == 'asc')desc#{else}asc#end")
316 316   #end
317 317   #extendQueryString($url {'sort': [$entry.key], 'sortOrder': [$targetSortOrder]})
318 - * [[{{translation key="solr.sortBy.$entry.key"/}}$!sortOrderIndicator>>path:${url}||class="$class"]]
318 + * [[{{translation key="solr.sortBy.$entry.key"/}}$!sortOrderIndicator>>path:$url||class="$class"]]
319 319   #end
320 320  #end
321 321  
... ... @@ -561,7 +561,7 @@
561 561   'matches': $matches
562 562   }))
563 563   #end
564 - #set ($highlighting = $collectiontool.sort($highlighting, 'priority:desc'))
564 + #set ($highlighting = $sorttool.sort($highlighting, 'priority:desc'))
565 565   #set ($return = $NULL)
566 566   #setVariable("$return" $highlighting)
567 567  #end
... ... @@ -576,10 +576,7 @@
576 576   #set ($discard = $query.setLimit($rows))
577 577   #set ($discard = $query.setOffset($start))
578 578   #set ($discard = $query.bindValue('sort', "${sort} ${sortOrder}"))
579 - #set ($discard = $query.bindValue('tie', $solrConfig.tieBreaker))
580 - #set ($discard = $query.bindValue('mm', $solrConfig.minShouldMatch))
581 581   #setQueryFields($query)
582 - #setPhraseFields($query)
583 583   #setFacetFields($query)
584 584   #setFilterQuery($query)
585 585   #setHighlightQuery($query)
... ... @@ -607,55 +607,6 @@
607 607   #set ($discard = $query.bindValue('qf', $boost))
608 608   #end
609 609  #end
610 -
611 -#macro (setPhraseFields $query)
612 - ## Set the main phrase field parameter boosts so that queries with all search terms
613 - ## in close proximity have high relevance
614 - #if ($solrConfig.phraseFields.substring(0, 0) == '')
615 - ## If the value of the 'phraseFields' parameter is a string then it means that the
616 - ## same query fields are used for all result types.
617 - #set ($phraseFieldsBoost = $solrConfig.phraseFields)
618 - #else
619 - ## There are different phrase fields for each result type.
620 - ## Including type = null, which will result from all facets being deselected
621 - #set ($phraseFieldsBoost = $solrConfig.phraseFields.get("$!type"))
622 - #end
623 - #if ("$!phraseFieldsBoost" != '')
624 - #set ($discard = $query.bindValue('pf', $phraseFieldsBoost))
625 - #set ($discard = $query.bindValue('ps', $solrConfig.phraseFieldSlop))
626 - #end
627 - ## Set the bigram phrase field parameter boosts so that queries with groups of two
628 - ## search terms in close proximity have high relevance
629 - #if ($solrConfig.bigramPhraseFields.substring(0, 0) == '')
630 - ## If the value of the 'bigramPhraseFields' parameter is a string then it means that the
631 - ## same query fields are used for all result types.
632 - #set ($bigramPhraseFieldsBoost = $solrConfig.bigramPhraseFields)
633 - #else
634 - ## There are different phrase fields for each result type.
635 - ## Including type = null, which will result from all facets being deselected
636 - #set ($bigramPhraseFieldsBoost = $solrConfig.bigramPhraseFields.get("$!type"))
637 - #end
638 - #if ("$!bigramPhraseFieldsBoost" != '')
639 - #set ($discard = $query.bindValue('pf2', $bigramPhraseFieldsBoost))
640 - #set ($discard = $query.bindValue('ps2', $solrConfig.bigramPhraseFieldSlop))
641 - #end
642 - ## Set the trigram phrase field parameter boosts so that queries with groups of three
643 - ## search terms in close proximity have high relevance.
644 - ## Generally (pf boost) > (pf3 boost) > (pf2 boost)
645 - #if ($solrConfig.trigramPhraseFields.substring(0, 0) == '')
646 - ## If the value of the 'trigramPhraseFields' parameter is a string then it means that the
647 - ## same query fields are used for all result types.
648 - #set ($trigramPhraseFieldsBoost = $solrConfig.trigramPhraseFields)
649 - #else
650 - ## There are different phrase fields for each result type.
651 - ## including type = null, which will result from all facets being deselected
652 - #set ($trigramPhraseFieldsBoost = $solrConfig.trigramPhraseFields.get("$!type"))
653 - #end
654 - #if ("$!trigramPhraseFieldsBoost" != '')
655 - #set ($discard = $query.bindValue('pf3', $trigramPhraseFieldsBoost))
656 - #set ($discard = $query.bindValue('ps3', $solrConfig.trigramPhraseFieldSlop))
657 - #end
658 -#end
659 659  
660 660  #macro (setFacetFields $query)
661 661   #set ($discard = $query.bindValue('facet', $facetEnabled))
... ... @@ -715,7 +715,7 @@
715 715   #set ($discard = $filters.put($fieldName, $escapedValues))
716 716   #if ($prefixFacets.contains($fieldName))
717 717   #set ($parts = $parameter.value.get(0).split('/', 2))
718 - #set ($length = $numbertool.toNumber($parts.get(0)).intValue() + 1)
666 + #set ($length = $mathtool.toInteger($parts.get(0)) + 1)
719 719   #set ($prefix = "$length/$parts.get(1)")
720 720   #set ($discard = $query.bindValue("f.${fieldName}.facet.prefix", $prefix))
721 721   #set ($discard = $prefixFacets.remove($fieldName))
... ... @@ -779,11 +779,11 @@
779 779   #end
780 780   ##
781 781   ## Pagination
782 - #set ($rows = $numbertool.toNumber($request.rows).intValue())
730 + #set ($rows = $numbertool.integer($request.rows))
783 783   #if ("$!rows" == '')
784 784   #set ($rows = 10)
785 785   #end
786 - #set ($start = $numbertool.toNumber($request.firstIndex).intValue())
734 + #set ($start = $numbertool.integer($request.firstIndex))
787 787   #if ("$!start" == '')
788 788   #set ($start = 0)
789 789   #end