Closed w0pr closed 10 months ago
Can you post the full search provider code (in copyable text) and your themes.json?
There is no themes.json, I was under the impression that this would either be be generated by the themesConfig part of tenantConfig.json or not needed when using QGS projects from /scan folder. At the moment, I configured searchProvider in defaultSearchProviders part of tenentConfig.json.
The themes.json can be obtained via http://localhost:8088/themes.json
(resp. replace localhost:8088 with your viewer base address).
Ok got it and comment deleted.
While debugging into SearchBox.jsx, it seems that results are never shown, because this.state.searchSession is null (line 464).
While debugging into SearchBox.jsx, it seems that results are never shown, because this.state.searchSession is null (line 464).
thanks, @manisandro for https://github.com/qgis/qwc2/commit/3661d032596c0c60c776f626a3f3cb17204b9a8a I'll give it another try and report back...
There have been various fixes/improvements regarding custom search providers in the SearchBox, assuming fixed, please reopen if still relevant.
I am using the docker services from https://github.com/qwc-services/qwc-docker
I implemented a custom searchProvider according to https://qwc-services.github.io/setup/viewer/qwc_configuration/#search-providers by adding searchProvider.js to volumes/qwc2/assets/, and configured the searchProvider in tenantConfig.json (in the defaultSearchProviders, in addition to the "coordinates" search provider).
The onSearch function does get called and I return a result like below with hardcoded values (callback gets called with results), which I later in full implementation will extract from the results of a filtered WMS query to the OGC service (this already works, although I still have to figure out where to dynamically get the list of layers for LAYERS, QUERYLAYERS and FILTER parameters without just passing them as cfgParams to onSearch via the entry in tenantConfig.json).
The getResultGeometry function never gets called (I hardcoded values there as well).
I uncommented the "geometry"property in items array for now, it also does not work with it.
searchProviders.js.txt
But QWC2 client does not navigate/zoom to feature and the spinner in the search box just keeps spinning and shows no results.
Debugging into SearchBox.jsx shows that pendingSearches is never empty(line 470), and therefore single feature in result is never selected, there is an searchid entry "themes" that persists in pendingSearches, I guess this is from the selector provider from here "qwc2/selectors/searchproviders.js". I then set searchThemes = false in config.json, this will get rid of the "themes" provider, but still line 479 of SearchBox.jsx: this.selectProviderResult(uniqueResults[1][0].items[0], uniqueResult[0]);
will never be reached.
What am I doing wrong?