Chapter 11. ? The Search Library

The search library provides functions useful for building search interfaces where selection of an area from an image (for instance a map) is combine with information entered on a form to select results which are displayed on the image.

?ii_search

search_map_data_scale = number

A scale factor by which coordinates which come from the database should be multiplied to give coordianes suitable for ploting on the image. Useful, for instance, if a set of maps uses 6 figure grid coordiantes but the database only holds 4 figure coordinates.

search_marker_class = name

The class used fro marers created for search results. By default result.

search_form_is_showing(url)

You should call this when your search form is in place. It records the URL so that the system can step back to that form at any time.

search_show_form()

Show the form if it has been replacd by another page.

search_do_search()

This is the main search call which you would use on a button or link.

search_start_results()

Call at the start of your result list.

search_add_marker(name), cx, cy, type, size, width)

This should be called to put a resrult onto the image. The arguments are as for markers_add except that the class is allways search_marker_class and the coordinates will be scaled according to the search_map_data_scale.

search_highlight(name)

Highlights the result named name.

You can define the following callback functions to customise how the search system works:

search_highlight_entry(marker)

Called when a result is highlighted.

search_record_map(mapset, level, cx, cy)

Called just before a search so you can take note of which image is being shown to the user.

search_record_area(rectangle)

Called just before a search so you can take note of whether a rectangle is selected. Rect is not null only if the user has selected a region.

search_form_frame_is()

You must define this function, which should return the window where the search form is loaded.