Writing /giga/dw/dng/dokuwiki/data/meta/dev/005bas/090quicksearch.meta failed
dev:005bas:090quicksearch

Quick search - how it is implemented

Overview

The implementation of the quick search is based on some TradeDesign features and a new structure of the xxxGET module.

The quick search is technically based on a new view type ComboGrid which is used to define a field where entered data will automatically launch a special event of event type tdEventStreamFetchFirst after a short delay when beginning to type in data.

This event is used to access the database and shows a selection list of matching entries, which is further filtered by the client when more characters are entered on the client side.

Whenever characters in that fields are deleted or changed another call to the event defined with the event type tdEventStreamFetchFirst is executed to reload the selection list from the database based on the newly changed search text.

Within the event executed with tdEventStreamFetchFirst the current content of the data field (which is not yet transferred to the server) can be read with a GetContext and used to access the database to load a special stream COMBOGRIDSTREAM with the data to be initially shown in the selection list.

The structure of the selection list is described like stream grids are described and loaded into the values of the ComboGrid field.

When further data is entered, the loaded stream is filtered within the client without another access to the database and shown with all matching entries.

When the <Enter> key is pressed, the timer which would launch the event for tdEventStreamFetchFirst is canceled and the standard event issued with <Enter> is launched (event type = tdEventSelChange). The same is valid, when the user tab’s out or uses the mouse to click into another field, just the event type corresponds to the type of leaving the field.

Additional Features

To control the behavior settings are available in Tdpara.ini

Parameter default value description
FilterDelay 200 Time in msec the system waits after the first keystroke to receive further character to initiate the search with more available data resulting in a smaller search result.
FilterThreshold 500 Maximum number of entries the system will load. To load all available data without limits set this parameter to 0. (This parameter is currently used by STGMOD of DOKA-NG)

Additional possibilities to signal too many or no match to the user, as the user interaction is primarily handled by the client localy.

  • SetContext( tdContextCOMBOGRIDSTREAMSTATE, tdCmbGrdStateTooMany )
  • SetContext( tdContextCOMBOGRIDSTREAMSTATE, tdCmbGrdStateNoMatch )

Clearing the special stream ComboGridStream acts like a semaphore to trigger a reload after typing in data into the respective field.

The ViewType ComboGrid activates the ComboGrid Features of the field.

Details of the application side GET implementation

Please find more information in The GET - Access Function

Details on the TD implementation

Entering characters into a field of view type ComboGrid without leaving the field and without pressing the <Enter> key will only launch the event flagged with tdEventStreamFetchFirst of that field. It will not launch any other event type of that field. Only an event flagged with tdEventStreamFetchFirst will be launched.

It is important to keep in mind, that in the event triggered by tdEventStreamFetchFirst the field content itself is not yet transfered to the server and in case of need the content has to be loaded with the new getcontext “FILTERTEXT”.

This getcontext “FILTERTEXT” will only provide a valid content when called within the event triggered by tdEventStreamFetchFirst.

To signal nothing found or too many results to the user the new set context should be used.

After finalizing the event execution of the relevant event the content of the special stream ComboGridStream is transmitted to the client for him to display the selection list and allow the user to select an entry or to reduce the shown list by further entered characters. This transmission takes place in case of tdEventStreamFetchFirst and in case of tdEventSelChange.

dev/005bas/090quicksearch.txt · Last modified: 2024/04/05 10:10 (external edit)