How to set up custom search?
You can set a search for specific columns within layers through Map Editor for all your apps that have a Search tool enabled (for example, your Map Portal). Custom Search will override the GIS Cloud standard search. It works for both private or public maps and portals.
Note: To be able to set a custom search for specific columns, it is necessary to import the layer into the Database and add the layer from the Database datasource into a map.
After importing layer into the Database, follow instructions below:
1. Open map in Map Editor.
2. Find the Layer ID in Layer Properties.
3. Click More info button and copy Layer ID.
4. Under the Map tab click Map Properties and click Map Options tab.
5. In the Name box write SEARCH_FIELDS. This option instructs the search engine to search inside specific layers and attributes.
6. In the Value box open braces ({).
7. Open quotes ("
) and write Layer ID. Note: make sure to use the correct quote symbols "
value"
.
8. Close quotes ("
) and write colon after quotes (:). Line should look like this now: {"
311482"
:
9. Open square brackets ([).
10. Open quotes ("
) and write the name of the column you want to search.
Note: Make sure that you write the Name of the column and not column alias. You can find the column name under the Layer Properties in the Attributes tab.
- Close quotes (
"
) and square brackets (]).
Note: if you want to add more columns within one layer write comma (,) and repeat steps 10-11 i.e. {"
311482"
: ["
city"
,"
country"
,"
pop1955"
]}
- Close braces (}).
- Click the Add button.
- In the next Name box write RESULT_FIELDS. This option shows which attributes will be shown inside search results.
- Copy and paste values from the SEARCH_FIELDS. Click the Add button and Save.
Note: Characters are case sensitive so make sure that you type the exact option and column name.
Map options should look like this:
Refresh your Map Editor or Map Portal and search for an object (GIS Cloud Search). Only columns set in the Map options should be visible.
Setting Search for more layers
It is also possible to set search for more layers in one map. To set search for more layers:
- Open map in Map Editor and open Map Properties – Map options.
- In the Value box after square brackets (]) and add comma (,).
- Copy Layer ID from the Layer properties.
- Repeat steps 7-11.
- Copy and paste new values both in the SEARCH_FIELDS and RESULT_FIELDS.
- Click Save.
- Refresh your map.