searchengine: Bail out on the first character
authorCarlos Garnacho <carlosg@gnome.org>
Tue, 7 Mar 2023 23:03:28 +0000 (00:03 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Wed, 8 Mar 2023 10:33:10 +0000 (11:33 +0100)
commitd12bea03d2baf1dbd21ad2e8a2f104c6507a7ffe
treefdcfb91a4a451897cd371ce80d1f9ac43f2a999d
parentdeacc63d54e522f51b6f36d8c6b3067c8bd834b1
searchengine: Bail out on the first character

Again on massive filesystems, the very first character
is likely to bring a likewise massive amount of search
results that we need to maybe query info for, then create
icons and widgets for. While it's impressive we can do
that, it's also expensive and likely pointless, for the
first character.

Typing a second character is however very likely to
considerably reduce the amount of items to categorize and
show. So start actually searching from there.

Testing on a filesystem with 1434099 files indexed, trying 5
semi-random 1 character searches (n, h, t, i, o) returns on
average 168K items (min. 78771, max. 331471), trying 5
semi-random 2 character searches (no, he, th, in, on)
returns on average 34K items (min. 11133, max. 94961),
which is a more approachable set.

Doing this is enough that typing on a filechooser search
entry feels completely fluid.
gtk/gtksearchenginetracker3.c