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.
This commit is contained in:
		 Carlos Garnacho
					Carlos Garnacho
				
			
				
					committed by
					
						 Jan Alexander Steffens (heftig)
						Jan Alexander Steffens (heftig)
					
				
			
			
				
	
			
			
			 Jan Alexander Steffens (heftig)
						Jan Alexander Steffens (heftig)
					
				
			
						parent
						
							4baa0b47e2
						
					
				
				
					commit
					b62a280e0c
				
			| @ -284,11 +284,15 @@ gtk_search_engine_tracker3_start (GtkSearchEngine *engine) | ||||
|       return; | ||||
|     } | ||||
|  | ||||
|   tracker->query_pending = TRUE; | ||||
|   search_text = gtk_query_get_text (tracker->query); | ||||
|   location = gtk_query_get_location (tracker->query); | ||||
|   recursive = _gtk_search_engine_get_recursive (engine); | ||||
|  | ||||
|   if (strlen (search_text) <= 1) | ||||
|     return; | ||||
|  | ||||
|   tracker->query_pending = TRUE; | ||||
|  | ||||
|   if (location) | ||||
|     { | ||||
|       gchar *location_uri = g_file_get_uri (location); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user