Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable search providers from config #5145

Merged
merged 77 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from 74 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
1beeec0
convert search providers to utilise the new model architecture
zoran995 Jan 19, 2021
f73539e
add SearchProvider folder in ModelMixins
zoran995 Jan 19, 2021
6673ab7
Merge remote-tracking branch 'terriajs/next' into configurable-search…
zoran995 Jan 19, 2021
26494d9
set default traits
zoran995 Jan 19, 2021
55f3c42
update useTranslationIfExists to request translation# at start of the…
zoran995 Jan 21, 2021
c752538
restore default return for useTranslationIfExists until final decissi…
zoran995 Jan 21, 2021
4778f07
remove id from list of traits
zoran995 Jan 21, 2021
c2608bf
make translation of names work correctly
zoran995 Jan 21, 2021
1bea56a
Merge branch 'tsify-loader' into configurable-search-bar
zoran995 Feb 15, 2021
d8616bd
Continue work on connecting search providers to UI
zoran995 Feb 16, 2021
030b913
restore australian-gazetteer-search-provider as example
zoran995 Feb 16, 2021
801e927
Merge remote-tracking branch 'terriajs/next' into configurable-search…
zoran995 Feb 16, 2021
e826dd6
move shoudRunSearch to search function so we don't have to implement …
zoran995 Feb 16, 2021
e388d1e
remove autocomplete and sortByName for later implementation if needed
zoran995 Feb 16, 2021
34570f3
make searchBar optional in config
zoran995 Feb 17, 2021
53c4210
resolve issues with optional searchBar
zoran995 Feb 17, 2021
5a580a3
correct name of translation string
zoran995 Feb 17, 2021
894237b
copy deprecationWarning from cesium, move default search providers ar…
zoran995 Feb 17, 2021
4fba7f8
add tests
zoran995 Feb 17, 2021
e104c34
use propper translation strings
zoran995 Feb 17, 2021
91630c4
tests
zoran995 Feb 18, 2021
d0fd1f6
Merge remote-tracking branch 'terriajs/next' into configurable-search…
zoran995 Feb 24, 2021
c49f3f9
Merge remote-tracking branch 'terriajs/next' into configurable-search…
zoran995 Feb 25, 2021
d470db2
Merge remote-tracking branch 'terriajs/next' into configurable-search…
zoran995 Jul 8, 2021
907b4cc
fix bad merge
zoran995 Jul 8, 2021
7ec3b1f
connect search providers with analytics and resolve merge conflicts
zoran995 Jul 8, 2021
22cd854
Merge remote-tracking branch 'terriajs/next' into configurable-search…
zoran995 Jul 8, 2021
7bef63d
resolve conflict trait location
zoran995 Jul 8, 2021
ea96188
fix lint
zoran995 Jul 8, 2021
da980b9
rename directory to searchproviders
zoran995 Sep 2, 2021
fe18655
Merge remote-tracking branch 'origin/main' into configurable-search-bar
zoran995 Sep 2, 2021
69b9522
add default value to zoomTo
zoran995 Sep 2, 2021
819c7ab
fix bad merge
zoran995 Sep 2, 2021
28702c8
don't update name in updateModelFromJson but when rendering
zoran995 Sep 2, 2021
2463af8
use new error handling
zoran995 Sep 2, 2021
8e15054
properly handle translations, and fix issue with catalog search provi…
zoran995 Sep 2, 2021
c91a240
fix data catalog not showing search result messages
zoran995 Sep 2, 2021
bc6a492
fix search in data catalogue button
zoran995 Sep 2, 2021
4b6221a
update translation file
zoran995 Sep 2, 2021
4ffb0d2
Merge remote-tracking branch 'terriajs/main' into configurable-search…
zoran995 Oct 17, 2021
cc6ec14
update bingMapsSearchProvider warning when there is no key
zoran995 Oct 17, 2021
ce884cd
use mixTraits of directly extending Traits
zoran995 Oct 17, 2021
9713ded
remove deprecationWarning function as it's not needed anymore
zoran995 Oct 17, 2021
b95cf47
add search bar model and make it use traits
zoran995 Oct 17, 2021
5bb733e
update docs
zoran995 Oct 17, 2021
1523c81
update trait description
zoran995 Oct 17, 2021
f424f70
fix import from terriajs-cesium
zoran995 Oct 17, 2021
cc7fabd
add docs
zoran995 Oct 17, 2021
32789d1
Merge remote-tracking branch 'terriajs/main' into configurable-search…
zoran995 Oct 25, 2021
3103d2c
Merge tag 'pre-prettier-v2' into configurable-search-bar
zoran995 Nov 2, 2023
dc961e3
Merge tag 'post-prettier-v2' into configurable-search-bar
zoran995 Nov 2, 2023
80b2e52
Merge tag 'pre-ts4-mobx6' into configurable-search-bar
zoran995 Nov 2, 2023
c1fcb60
Merge remote-tracking branch 'upstream/main' into configurable-search…
zoran995 Nov 3, 2023
7214e69
fix: white screen
zoran995 Nov 3, 2023
44236d0
fix: remove unused property
zoran995 Nov 3, 2023
5ded654
fix: rename ADR
zoran995 Nov 3, 2023
97920ce
tests: reorganize tests and test search provider mixin
zoran995 Nov 4, 2023
6263bb5
fix: ADR title number
zoran995 Nov 4, 2023
07057ab
feat: add CatalogSearchProviderMixin and small types refactor
zoran995 Nov 4, 2023
1e841bc
fix: organise imports
zoran995 Nov 4, 2023
7a529e3
fix: replace deprecated substr method
zoran995 Nov 4, 2023
8013f54
fix: search model type definition
zoran995 Nov 4, 2023
64e2f89
fix: remove duplicate code
zoran995 Nov 4, 2023
34d2dfc
fix: search result styling
zoran995 Nov 4, 2023
53eaf78
fix: translation
zoran995 Nov 4, 2023
c08b84d
change initialization of search state
zoran995 Nov 4, 2023
7d67dc2
test: fix search box result test
zoran995 Nov 4, 2023
d75446e
feat: enforce stronger types for search providers
zoran995 Nov 4, 2023
67b585b
fix: catalog search provider no results translation
zoran995 Nov 4, 2023
5543250
test: write more tests for bing maps search provider
zoran995 Nov 4, 2023
1283540
Merge remote-tracking branch 'upstream/main' into configurable-search…
zoran995 Nov 15, 2023
0058106
feat: migrate cesium ion search provider to model system
zoran995 Nov 15, 2023
6dc4128
feat: move searchBarModel from configParametes to terria property
zoran995 Nov 19, 2023
8d1ad63
fix: replace terriajs-plugin-api imports with proper ones
zoran995 Nov 19, 2023
04785d4
fix: rename traits class
zoran995 Nov 20, 2023
d3fe2f4
doc: add cesium search provider to docs
zoran995 Nov 20, 2023
e985376
fix: show warning
zoran995 Nov 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions architecture/0011-configurable-search-providers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 11. Configuration of search providers

Date: 2021-01-19

## Status

Proposed

## Context

Ticket.
https://github.com/TerriaJS/terriajs/issues/5141.

### Intro

The existing approach to the definition of SearchProviders requires the development team's involvement and rebuild of the application, which can be undesired behavior in highly dynamic environments.
It's much better to enable the administrators to maintain the search providers.

## Proposal

- SearchProviders could greatly use the benefits of the new model system used for Catalog.
- Create a simple base Mixin (`SearchProviderMixin`) to attach SearchProviders to the Model system and enable easier creation of new search providers.
- Make SearchProviders configurable from `config.json`.
- Provide sensible defaults for everything.
- Typescript everything.
- Make everything translateable (administrator can specify i18next keys for all names)

## Benefits

- Much easier to implement new search providers.
- Much easier to update existing search providers, `urls` and `keys`.
- Offer administrators an option to decide wheter they want to load group members using `CatalogSearchProvider`.

## Consequences

This is quite a large change and should be thoroughly tested to avoid the possible bugs in the search providers migration.
39 changes: 13 additions & 26 deletions doc/customizing/client-side-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Specifies various options for configuring TerriaJS:
| `defaultMaximumShownFeatureInfos` | no | **number** | `100` | The maximum number of "feature info" boxes that can be displayed when clicking a point. |
| `regionMappingDefinitionsUrl` | no | **string** | | **Deprecated** please use `regionMappingDefinitionsUrls` array instead. If this is defined, it will override `regionMappingDefinitionsUrls` |
| `regionMappingDefinitionsUrls` | no | **string[]** | `["build/TerriaJS/data/regionMapping.json"]` | URLs of JSON files that define region mapping for Tabular data (eg CSV). This option only needs to be changed in unusual deployments. It has to be changed if deploying as static site, for instance. It multiple URLs are provided then the first matching region will be used (in order of URLs) |
| `catalogIndexUrl` | no | **string** | | URL of the JSON file that contains index of catalog. See [CatalogIndex](#catalogindex) |
| `catalogIndexUrl` | no | **string** | | URL of the JSON file that contains index of catalog. See [CatalogIndex](search-providers.md#catalogindex) |
| `proj4ServiceBaseUrl` | no | **string** | `"proj4def/"` | URL of Proj4 projection lookup service (part of TerriaJS-Server). This option only needs to be changed in unusual deployments. It has to be changed if deploying as static site, for instance. |
| `corsProxyBaseUrl` | no | **string** | `"proxy/"` | URL of CORS proxy service (part of TerriaJS-Server). This option only needs to be changed in unusual deployments. It has to be changed if deploying as static site, for instance. |
| `proxyableDomainsUrl` | no | **string** | `"proxyabledomains/"` | Deprecated, will be determined from serverconfig. |
Expand Down Expand Up @@ -115,6 +115,8 @@ Specifies various options for configuring TerriaJS:
| `storyVideo.videoUrl` | no | **string** | https://www.youtube-nocookie.com/embed/fbiQawV8IYY | Video to show in Story Editor panel under Getting Started. |
| `relatedMaps` | no | **[RelatedMap](#relatedmap)[]** | See [`lib/Models/RelatedMaps.ts`](../../lib/Models/RelatedMaps.ts) | Maps to show in "Related Maps" menu panel |
| `aboutButtonHrefUrl` | no | **string** | `"about.html"` | About button URL. If set to `null`, then the About button will not be shown |
| `searchBar` | no | **[SearchBar](#searchbar)** | `new SearchBar()` | Search bar configuration |
| `searchProviders` | no | \*\*[SearchProviders](search-providers.md) | `[]` | Search providers that will be used for search |

### MagdaReferenceHeaders

Expand Down Expand Up @@ -249,30 +251,15 @@ Credits/Attribution shown at the bottom of the map. Supports internationalizatio

---

### CatalogIndex
### SearchBar

If your TerriaMap has many (>50) dynamic groups (groups which need to be loaded - for example CKAN, WMS-group...) it may be worth generating a static catalog index JSON file. This file will contain ID, name and description fields of all catalog items, which can be used to search through the catalog very quickly without needing to load dynamic references/groups (for example `MagdaReference` -> `WebMapServiceCatalogGroup` -> `WebMapServiceCatalogItem`).
Configuration for the search bar. Some of the values will be used as default for
search provider values.

The https://github.com/nextapps-de/flexsearch library is used to index and search the catalog index file.

To generate the catalog index:

- `yarn build-tools`
- `node .\build\generateCatalogIndex.js config-url base-url` where

- `config-url` is URL to client-side-config file
- `base-url` is URL to terriajs-server (this is used to load `server-config` and to proxy requests)
- For example `node .\build\generateCatalogIndex.js http://localhost:3001/config.json http://localhost:3001`

- This will output three files
- `catalog-index.json`
- `catalog-index-errors.json` with any error messages which occurred while loading catalog members
- `catalog-index-errors-stack.json` with errors stack
- Set `catalogIndexUrl` config parameter to URL to `catalog-index.json`

This file will have to be re-generated manually every time the catalog structure changes - for example:

- if items are renamed, or moved
- dynamic groups are updated (for example, WMS server publishes new layers)

For more details see [/buildprocess/generateCatalogIndex.ts](/buildprocess/generateCatalogIndex.ts)
| Name | Required | Type | Default | Description |
| --------------------- | -------- | ------------- | ------------------------------ | ------------------------------------------------------------------------------------------------- |
| placeholder | no | **string** | `translate#search.placeholder` | Input text field placeholder shown when no input has been given yet. The string is translateable. |
| recommendedListLength | no | **number** | `5` | Maximum amount of entries in the suggestion list. |
| flightDurationSeconds | no | **number** | `1.5` | The duration of the camera flight to an entered location, in seconds. |
| minCharacters | no | **number** | 3 | Minimum number of characters required for search to start |
| boundingBoxLimit | no | **Rectangle** | `Cesium.Rectangle.MAX_VALUE` | Bounding box limits for the search results {west, south, east, north} |
Loading
Loading