Global Search for GNOME Builder

In previous post, Indexing multiple languages source code in GNOME Builder, I wrote about how indexing of source code in a project is done in GNOME Builder. Now that we have index of all symbols in the project, this index is used to implement global search of symbols using which we can search fuzzily all symbols in the project.

These are features Global search supports now:

  • Searching for symbols which matches fuzzily to given query.
  • Filters can be added while searching. Like if we want to search only functions we need to append function@ to query. Similarly we can also search only  structs, variables, macros, enums, constants and union. This is the syntax,

<any prefix of symbol type>@<query>

This is how global search is implemented. There is fuzzy index of symbols for each directory and in each index <symbol type+unit separator+symbol name, symbol kind, symbol flags, line, column> of each symbol is stored. When a query is given in search bar all indexes will be searched for fuzzy matches and top matches from all of the indexes will be displayed. When every symbol type filter is applied in search query, internally first character of that symbol type and unit separator are preprended to search query and that is used to search fuzzy index. This prepending will automatically removes all other types of symbols from results since when indexing every symbol name is prepended with its type name and unit separator. Current implementation if these features is here GitHub.

This is a demo of these features


2 thoughts on “Global Search for GNOME Builder”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s