Skip to content

feat(plugins): plugins trigger search (MIN-221)

mateusz-winiarczyk requested to merge MIN-221-plugins-trigger-search into development

Search can be done by query or coordinates. To search, plugins can use the triggerSearch method in window.minerva.map object available globally.

If we want to search using a query, we need to provide an object with the following properties as an argument:

- query: this should be the search string.
- perfectSearch: this property indicates whether results should be a perfect match or not. Its value should be a boolean type. This property is optional, and by default, its value is `false`.
- fitBounds: should the map be resized to the rectangle fitting all results. Its value should be a boolean type. This property is optional, and by default, its value is `false`.

Example: window.minerva.map.triggerSearch({ query: 'NR4A2;SNCA;aspirin', perfectSearch: true });

If we want to search using coordinates, we need to provide an object with the following properties as an argument:

- coordinates: this property should indicate the x and y coordinates on the map. Its value should be an object type with x and y properties
- modelId: this property should indicate submap identifier. Its value should be a number type
- zoom: this property should indicate zoom level at which we want to trigger search. Its value should be a number type
- fitBounds: should the map be resized to the rectangle fitting all results. Its value should be a boolean type. This property is optional, and by default, its value is `false`.

Example:

window.minerva.map.triggerSearch({
  coordinates: { x: 1947, y: 5203 },
  modelId: 52,
  fitBounds: true,
});

triggerSearch

Edited by mateusz-winiarczyk

Merge request reports

Loading