Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 6 Next »

The following describe the Weave configurations required to enable index search UI tools in standard Weave client.


Adding the index search input box to the client involves adding a new item to the UI, and that new item is called 'weave.indexcombo'. If we assume that we have a toolbar configured for our client and wish to add the index search box to that toolbar then we'd update the client configuration to something like:

<toolbar>
  <item component="weave.indexcombo"/>
</toolbar>

Once we reload the client then the index combo will appear in our user interface and the user could start typing within the input box and will receive a list of the matching entities from the server. Since we have not setup any indexes on the server as yet nothing will be found. We will look at how to setup the indexes later in this document.

By default the index combo will only search for entities that match the currently active entity. To have the index search over all entities we can set a flag in the item to tell the client to ask for all matches, and if the user chooses an item that is not the same type as the currently active entity, then the active entity will be changed when the user chooses that entity. To do this we add a 'all' flag to the item tag and set its value to true, so we would then have:

<toolbar>
  <item component="weave.indexcombo" all="true"/>
</toolbar>

There are other flags that can be added to the item to alter the way the index combo works:

Name

Type

Description

width

string

Sets the width of the input box. This should be a standard HTML width setting, for example "100%" would fill the whole toolbar, "250px" would be 250 pixels wide.

minScale

number

When the user chooses an result from the list the map will be zoomed to the extent of the chosen entity, this setting ensures that the map won't be zoomed in beyond the given scale.

pageSize

number

This value changes the number of items that will be presented to the user as the results of the search, for example "8" will tell the client to display the top 8 results for the search.

doSelect

boolean

The Weave client can be instructed to not update the current selection when the user chooses a result from the list, this allows the index input box to be used as a simple find tool without actually interacting with the active selection. The default for this is true so selecting a result from the list will alter the current selection.

clearOthers

boolean

If doSelect is set not to false then when this flag is set to true it tells the Weave client that it should clear the selection for every other entity when the user chooses a result, if it is set to false (or not set) then the client won't clear the selection for the other entities.

doMarker

boolean

If set to true (the default) this flag tells the Weave client to display a marker at the center of the chosen entity, if set to false then the client will not display a marker.

doGeometry

boolean

If set to false (the default) this flag tells the Weave client not to display the geometry of the selected feature that the user chooses, if true then the Weave client will display the geometry of the entity chosen. This is more useful if the drawing of selections is disabled in the ToC, otherwise the geometry will be drawn twice.

doMarkers

boolean

If set to true (the default) this flag tells the client to display a marker for each item in the list once it completes the search, but before the user chooses a particular entity. If set to false then no markers will be displayed (until the user chooses a particular entity if doMarker is set to true).

doShowIconsbooleanDisplay icons next to the search results, default is false.
doTurnOnLayerbooleanShould the layer associated with the entity, via the ToC model, be turned on when a result is selected? Default is false. Available from release 2.5.26.

type

'wildcard', 'fuzzy' or 'exact'

Change the type of search that's performed, default is 'wildcard'. 'exact' performs the search using the search term, 'wildcard' appends an * to the end of the search term and 'fuzzy' appends a ~ to the end of the search term.

allbooleanDefault is false, when set to true indicates that all indexes should be searched, not just the indexes associated with the active entity, or indexes listed in the index attribute.
indexstring

A comma separated list of index names that should be searched. When this value is set only the indexes listed will be searched, rather than all indexes (if all is set to true) or indexes associated with the active entity (if all isn't set to true).

Note, this can also be a list of entities, rather than indexes, in which case all indexes associated with the listed entities will be searched.

highlightbooleanShould the results list highlight the part of the text that was matched in the search? Default is false.
emptyTextstringThe text to show in the field when nothing has been entered. i18n resource name is "indexcombo.emptyText", and default value "Quick search".
loadingTextstringThe text to show in the field when the content is being loaded. i18n resource name is "indexcombo.loading", and default value "Searching...".
autoFocusbooleanShould the index field get focus when the client starts up, default is true.

Beyond these settings it is also possible to change the stroke and fill of the geometry (if doGeometry is true) by adding a 'geometryStyle' tag to the configuration. The geometryStyle tag can set the fill and/or stroke used to draw the entity geometry when it is drawn on the client, but it will not change the style when drawing the selection.

<toolbar>
  <item component="weave.indexcombo" all="true">
    <geometryStyle>
      <strokeOpacity>0.75</strokeOpacity>
      <strokeColor>#0000ff</strokeColor>
      <strokeWidth>2</strokeWidth>
      <fillOpacity>0</fillOpacity>
    </geometryStyle>
  </item>
</toolbar>

In addition, you can alter the tooltips that are displayed when the user enters the input area, and when they hover over the search button.

<toolbar>
  <item component="weave.indexcombo" all="true">
    <geometryStyle>
      <strokeOpacity>0.75</strokeOpacity>
      <strokeColor>#0000ff</strokeColor>
      <strokeWidth>2</strokeWidth>
      <fillOpacity>0</fillOpacity>
    </geometryStyle>
    <tooltip>
      <title>Quick Search</title>
      <text>Type here to search</text>
    </tooltip>
    <tooltip2>
      <title>Quick Search</title>
      <text>Redisplay the last search results</text>
    </tooltip2>
  </item>
</toolbar>
  • No labels