Quick Search Configuration

Adding Search Definitions to Separate Maps

Controlling how many results are returned

PostGIS Database Indexing

Adding Search Definitions to Separate Maps

Once the search is defined the administrator needs to add a search to each map where it is required. This can be defined under General Settings – mapname Settings dialog.

Searches

Select the required search or searches. At installation the searches OSGB 50k Gazetteer and WorldSearch are available. Other searches may be available if they have been added using the Add Search option. For example, if MyNewSearch has been added the following will be shown:

Multiple searches can be selected for inclusion in the map.

Controlling how many results are returned

The number of results returned by the Quick Search can be controlled in the map.aspx page (which is located within your installed WebMapLayers8 folder).

This feature is not supported if your Quick Search data is stored in an access database.

Open the map.aspx file in a text editor and locate the section:

<Cadcorp:QuickSearch runat=”server”

Within this section there are four parameters that can be edited:

Delay="500"

MinimumCharactersBeforeSearch="3"

ExtraResultsToFetch=”10”

InitialAmountOfResultsToFetch=”4”

The numbers shown are the default values, simply edit the numbers for these parameters and save map.aspx to save the changes.

PostGIS Database Indexing

To aid the speed at which results are returned from the quick search it is advantageous to create an index on the column you wish to search on, this is done in your database manager. Having an index present on a column allows data to be retrieved without having to check every row in the table.

If you are adding a search using data stored in a PostGIS table, the column has to be converted to a vector column before the index is created. Web Map Layers 8.0 uses a like clause to perform the database search, and there are certain restrictions with using the index of a standard PostGIS column when a like clause is used.

To create a vector column and an index of a column you will need to run a SQL statement in your database manager, this statement will be dependent on your table structure, and syntax can differ depending on the database being used, the following example is for PostGIS:

Alter table <table> add column {vectorcolumn} TSVECTOR
Update <table> set {vectorcolumn} = to_tsvector ({sourcecolumn})
Create index {vectorcolumn}_gin on <table> using GIN({vectorcolumn})

After replacing the placeholders, contained in {} including the {}, the above will add a vector column, populate it and then index it.

For example, if you wish to run a search on a postcode column stored in a PostGIS database you would need to run the following SQL statements:

ALTER TABLE <table> ADD COLUMN postcodevector TSVECTOR

UPDATE <table> SET postcodevector = to_tsvector (postcode)

CREATE index postcodevector_gin ON <table> USING GIN(postcodevector)

To create an index on a column in another database, just run the final SQL statement.


Send comments on this topic.