Subject RE: [firebird-support] incremental search ?
Author Svein Erling Tysvær
>Hello! probably this is a silly question, but I'd like to know other's
>experiences in this matter. I'd like to implement an incremental search
>facility in some forms. I think I've read somewhere that incremental
>search is not a good idea on client/server databases... so my first
>question: is that true?
>I'm using Firebird 2.1 with Delphi / IBX components and I'm testing with
>a very simple method: on the OnChange event of an Edit box I close the
>query (select * from my table where name containing :somename) pass
>Edit1.Text as parameter and open the query again. So far (and with a few
>thousand records) it seems to be ok. So the next question: Is that
>method OK? should I be aware of someting in the future? I didn't test it
>with A LOT of records yet so I'd like to hear any advice. Thank you very

I'd say there is a minor problem with your approach, CONTAINING cannot use an index (at least normally, maybe an expression index in Fb 2.5 could do it), so I'd consider changing to STARTING - albeit this could also make it case sensitive (depending on whether you use a case sensitive or insensitive collation).

Another thing I would consider, would be to not open the query for the first few letters you type - if I'm trying to type 'Sergio' in a field, I would normally not be interested in any list before I'd typed at least three letters.

Whether incremental search is a good idea on client/server databases or not, well, I would say that depends on your situation. If it is a system (close to) having performance problems or a multitude of users, well, then I'd say avoid incremental searching. Also, having to wait for something to pop up for each letter you type can be a nuisance, so even for simple systems, I'd at least put in a timer and not start the incremental search feature until, say, one second has passed since the last key press. For simple systems that has a (configurable) timer and a limited number of users, then I can perceive it to be useful in some circumstances. Though generally, try to encourage your users to type what they search for rather than to scroll down a list, it takes me under a second to type Sergio, whereas scrolling through 20 names that start with Ser will be more time consuming.