0 Votes

Changes for page Solr Search

Last modified by Сергей Коршунов on 2025/01/12 00:53

From version 2.1
edited by Сергей Коршунов
on 2022/03/08 17:00
Change comment: Install extension [org.xwiki.platform:xwiki-platform-search-solr-ui/14.1]
To version 1.1
edited by admins admins
on 2021/12/11 17:12
Change comment: Install extension [org.xwiki.platform:xwiki-platform-search-solr-ui/13.10]

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.skorshunov
1 +XWiki.admins
XWiki.JavaScriptExtension[0]
Code
... ... @@ -26,8 +26,8 @@
26 26   };
27 27  
28 28   var updateExpandCollapseAllFacetsState = function(facetsContainer) {
29 - var facetCount = facetsContainer.find('.search-facet').length;
30 - var expandedFacetCount = facetsContainer.find('.search-facet.expanded').length;
29 + var facetCount = facetsContainer.find('.search-facet').size();
30 + var expandedFacetCount = facetsContainer.find('.search-facet.expanded').size();
31 31   if (expandedFacetCount > facetCount / 2) {
32 32   facetsContainer.find('.search-facets-action-collapseAll').show()
33 33   .parent().children('.search-facets-action-expandAll').hide();
... ... @@ -42,7 +42,7 @@
42 42   checkBox.prop('checked', $(this).hasClass('selected'));
43 43   // Add the 'checked' attribute so that it can be easily located with CSS.
44 44   checkBox.prop('checked') && checkBox.attr('checked', 'checked');
45 - checkBox.on('click', this.click.bind(this));
45 + checkBox.click($.proxy(this, 'click'));
46 46   // Remove the 'selected' class because the selected state is marked using the check box.
47 47   $(this).removeClass('selected').before(checkBox);
48 48   };
... ... @@ -51,17 +51,17 @@
51 51   var facetsContainer = $(this);
52 52  
53 53   // Add the ability to collapse the facets pane on extra small screens (phones).
54 - facetsContainer.find('.search-facets-header').on('click', function() {
54 + facetsContainer.find('.search-facets-header').click(function() {
55 55   facetsContainer.toggleClass('collapsed-xs');
56 56   });
57 57  
58 58   // Global Expand/Collapse toggle.
59 - facetsContainer.find('.search-facets-action-collapseAll').removeClass('hidden').on('click', collapseAllFacets);
60 - facetsContainer.find('.search-facets-action-expandAll').removeClass('hidden').on('click', expandAllFacets);
59 + facetsContainer.find('.search-facets-action-collapseAll').removeClass('hidden').click(collapseAllFacets);
60 + facetsContainer.find('.search-facets-action-expandAll').removeClass('hidden').click(expandAllFacets);
61 61   updateExpandCollapseAllFacetsState(facetsContainer);
62 62  
63 63   // Expand/Collapse toggle for each facet.
64 - facetsContainer.find('.search-facet-header').on('click', function(event) {
64 + facetsContainer.find('.search-facet-header').click(function(event) {
65 65   $(event.target).parent('.search-facet').toggleClass('expanded');
66 66   updateExpandCollapseAllFacetsState(facetsContainer);
67 67   });
... ... @@ -110,8 +110,7 @@
110 110   searchRequest && searchRequest.abort();
111 111   $('.search-ui').attr('aria-busy', true);
112 112   var getURL = XWiki.currentDocument.getURL('get', getQueryString(viewURL));
113 - searchRequest = $.get(getURL);
114 - searchRequest.then(html => {
113 + searchRequest = $.get(getURL).done(function(html) {
115 115   var state = getSearchUIState();
116 116   updateSearchUI(html);
117 117   setSearchUIState(state);
... ... @@ -124,7 +124,7 @@
124 124   var reloadSearchUI = function(event) {
125 125   event.preventDefault();
126 126   var anchor = $(event.target).closest('a');
127 - anchor.length && $(document).trigger('xwiki:search:update', anchor.attr('href'));
126 + anchor.size() > 0 && $(document).trigger('xwiki:search:update', anchor.attr('href'));
128 128   };
129 129  
130 130   // Others (e.g. a custom facet) can trigger a search UI update by firing this event.
... ... @@ -138,8 +138,7 @@
138 138   $('.search-ui').attr('aria-busy', true);
139 139   var state = event.originalEvent.state;
140 140   var getURL = XWiki.currentDocument.getURL('get', window.location.search.substr(1));
141 - searchRequest = $.get(getURL);
142 - searchRequest.then(html => {
140 + searchRequest = $.get(getURL).done(function(html) {
143 143   updateSearchUI(html);
144 144   setSearchUIState(state);
145 145   });
... ... @@ -180,7 +180,7 @@
180 180   '.search-facet a.itemName',
181 181   '.search-facet-body a.more',
182 182   '.search-facet-body .selectedLocation a'
183 - ].join(',')).on('click', reloadSearchUI);
181 + ].join(',')).click(reloadSearchUI);
184 184   };
185 185  
186 186   enhanceSearchUI();