.. _configure_search: .. role:: highlight How To Configure Search Capablility For A Layer ==================================================== GeoMoose includes a search service to search for features by attribute value and display the results for a specific layer. Configuring the search capability for a layer in GeoMoose 2 is a multistep proces. Step 1: Create the search results HTML file ------------------------------------------- The searh results HTML file will be used to format how information is displayed in the search results tab. The file follows standard HTML formats and references fields that exist for the serch layer. Below is an example of the HTML for parcels in the demo search_result.html file located in ..maps/demo/parcels/templates. :: [PIN]
[OWNER_NAME]

Please note that this HTML can be used to link to other sites or services using standard HTML like tags as illustrated in the example above. Step 2: Reference the HTML file in MapServer map file ------------------------------------------------------------------------------------------------- The search HTML files must then be referenced in the metadata section in the map file within the layer. The following is an example of how this is done from the parcels.map file in the demo located in ..maps/demo/parcels. :: LAYER NAME parcels DATA './parcels.shp' ... ... METADATA ... itemquery' 'templates/search_result.html' 'itemquery-filter' '/.*[qstring].*/i' 'qstring_validation_pattern' '.' ... END ... END The itemquery-filter and qstring_validataion_pattern must also be set for search to work. Remember when referencing the HTML's to make sure the correct relative paths are set. Step 3: Create a new search service in mapbook.xml -------------------------------------------------- The third step will be to create a new search service for a layer in the mapbook.xml. This is most easily done by copying the search service and pasting it in and then modifying it. The following is what the search service looks like for the parcel layer. :: <-- create a new service name php/query.php <--- source and layer name for your layer <--- fields you want to search on from your layer <--- comparitors for searching <--- value you will enter <--- additional value search Below are highlights of the marked code above: * :highlight:` <-- create a new service name` * :highlight:` <--- source and layer name for your layer` * :highlight:` <--- fields you want to search on` * :highlight:` <-- from your layer` * :highlight:` <--- comparitors for searching` * :highlight:` <--- value you will enter` * :highlight:` <--- additional value search` Additional information about the search service and adding services in the mapbook can be found in the mapbook reference. See also, :ref:`Mapbook services reference ` and :ref:`Query documentation in Services `. Step 4: Add the service to the toolbar -------------------------------------- Now that the service has been added the user must be able to select it as a tool. This is done by adding the new service to the toolbar section of the mapbook.xml file. The following is an example of what the search parcel service:: To add the new service copy this line and paste it below the existing search tool. Change the serivce name to match the new service. The following is a simple example that illustrates how this could be done for a new service to search for taxlots::