Changes for page Context Search
Last modified by bougault on 2023/02/20 16:29
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,5 +1,5 @@ 1 - {{html clean="false"}}2 -<!-- 1 + 2 +{{html clean="false"}}<!-- 3 3 !!! POC. Code must be reviewed / optimized and packaged for use in production !!! 4 4 !!! Many optimisations can be done !!! 5 5 --> ... ... @@ -27,16 +27,6 @@ 27 27 a { 28 28 color: var(--color-brand-primary, blue); 29 29 } 30 - .rawResults { 31 - width: 100%; 32 - display: flex; 33 - font-size: 12px; 34 - margin-top: 2em; 35 - } 36 - .rawResults ul { 37 - list-style-type: none; 38 - padding: 0; 39 - } 40 40 `; 41 41 constructor() { 42 42 super(); ... ... @@ -49,7 +49,6 @@ 49 49 this.filterUrl = new URL(`${document.location.origin}/rest/v1/collabs?search=&offset=0&orderField=title&order=asc&limit=10000&favorite=false&roles=`); 50 50 this.results = []; 51 51 this.resultsCache = []; 52 - this.collabFiltersResults = []; 53 53 } 54 54 firstUpdated() { 55 55 this.renderRoot.getElementById('searchInput').focus(); ... ... @@ -104,10 +104,7 @@ 104 104 fetchFilterSearch() { 105 105 return new Promise((resolve) => { 106 106 if(this.hasActiveFilters()) { 107 - fetch(this.filterUrl).then(res => res.json()).then((res) => { 108 - this.collabFiltersResults = res; 109 - resolve(res); 110 - }); 96 + fetch(this.filterUrl).then(res => res.json()).then((res) => resolve(res)); 111 111 } else { 112 112 resolve([]); 113 113 } ... ... @@ -150,17 +150,6 @@ 150 150 </div> 151 151 `)} 152 152 </div> 153 - <div class="rawResults"> 154 - <div> 155 - <strong>XWiki Search Results</strong> 156 - <ul>${this.resultsCache.map((res) => html`<li>${res.space}</li>`)}</ul> 157 - </div> 158 - <div> 159 - <strong>Collab Search Results (Filters)</strong> 160 - <ul>${this.collabFiltersResults.map((res) => html`<li>${res.name}</li>`)}</ul> 161 - </div> 162 - </div> 163 -</div> 164 164 ` 165 165 } 166 166 } ... ... @@ -171,9 +171,11 @@ 171 171 require(['jquery'], function($) { 172 172 const solrServiceURL = new XWiki.Document('SuggestSolrService', 'XWiki').getURL('get'); 173 173 //contextSearchButton.addEventListener('click', function() { 174 - $. post(solrServiceURL, {149 + $.get(solrServiceURL, { 175 175 outputSyntax: 'plain', 176 176 media: 'json', 152 + nb:100, 153 + offset:10, 177 177 query: [ 178 178 'q="__INPUT__"~100', 179 179 'fq=type:DOCUMENT', ... ... @@ -187,5 +187,4 @@ 187 187 } 188 188 }); 189 189 </script> 190 -<clb-unified-search></clb-unified-search> 191 -{{/html}} 167 +<clb-unified-search></clb-unified-search>{{/html}}