Search in DataGrip
When working with a software tool, searching tends to be a very popular and frequently-used feature that is crucial to a good user experience. In DataGrip, you can look for things like:
Database objects: tables, views, procedures, columns, and other objects.
Data: full-text search and row filters.
Code: code usages in consoles, attached files, views, and routines.
Other things: files, settings, IDE actions, and other things.
The IDE also has a single entry point for looking for everything — Search Everywhere.
Database objects
Speed search
Any tree, list, or popup in DataGrip supports a speed search. For example, when you start typing in a tool window, a matching database object is highlighted.
Speed search supports abbreviations. For instance, ac
is enough to find additional_country
.
Start typing the database object name, for example, the name of a table. As you type, a field appears over the tool window showing the entered characters, and the selection moves to the first item that matches the specified string. The matching part of the string is highlighted.
For the Database Explorer, a Speed Search filter is also available.
(Only in Database Explorer) To toggle the Speed Search filter on and off, click the Speed Search filter button ().
If several items match the pattern, use the Up and Down keys to move between them. Press Enter to open the selected item. Press Escape to hide the search field.
Database objects in Search Everywhere
Search Everywhere is another useful feature that looks for any item in databases, files, actions, elements of the user interface, settings, and so on. To open the Search Everywhere window, press Shift twice. For more information about the feature, refer to Search Everywhere.
To define the scope of Search Everywhere, use the filter icon.
In the Search Everywhere window, if you select a table or a view and press Enter, you will see the table editor. If you select functions or procedures, you will see their source code.
If you want to see an object in the database tree, select the Autoscroll from Editor option in the Options menu in the Database Explorer header.
In case you want to search for columns in a result set or table, invoke the File Structure action Ctrl+F12 and start typing. Speed search filters columns automatically. Press Enter to navigate to the column that you need.
Data
You can search for text data in your database and filter rows without writing a query.
Full-text search
Search for data in databases, schemes, and separate tables
In the Database Explorer ( ) , select objects in which you want to perform your search. You can select a database or a group of databases, a scheme or schemes, or even separate tables.
Right-click the selection and select
. Alternatively, press Ctrl+Alt+Shift+F.In the search field of the Full-text Search dialog, type your search request and click Search.
In the Find tool window, review search results. To open a database object, double-click it. To return to the Find tool window ( ), press Alt+3.
For more information about the full-text search, refer to Full-text search in databases.
The Find action
To quickly find data inside a table without writing a statement, call up a text search with the Find action Ctrl+F. It is especially helpful if you do not know what column contains the data that you are looking for.
To automatically populate the search field with a search value from a certain cell, select the cell with it and press Ctrl+F.
Select the Filter rows checkbox to see only rows with found matches.
The Find action works only within the current page of the result set. To configure the page size of the result set, open settings by pressing Ctrl+Alt+S and navigate to . , and clear the Limit page size to checkbox.
Rows filter
You can enter a filtering SQL condition (like in the WHERE
clause) in the WHERE
field.
The Filter by action
To filter a table according to a cell value, click this cell and select Filter by from the context menu.
Code
The Find action
To search through the code, use the Find action Ctrl+F.
You can tune a search scope and, for example, exclude comments and string literals from the search.
You can select a part of code and search through this part only.
Find in selection
You can search for a text string inside a multi-line selection.
Press Ctrl+F, click the Filter Search Results button (), and select Search In Selection.
Select a multi-line fragment and type your search string. DataGrip will search for the target inside the selected fragment.
If you want to search for the multi-line fragment itself, select it and press Ctrl+F.
The Find in Files action
Find in Files Ctrl+Shift+F looks for code in other consoles, attached files and even in the source code of views and routines.
For more information about the action, refer to the Search and replace content in files topic.
In our example, if you select Directory, DataGrip looks for sakila
only in the postgres-sakila-db folder that is attached to the project. But if you select Scope with the All Places option, DataGrip will also look in other folders (finds the search string in Oracle and MySQL directories).
The Find Usages action
Find Usages Alt+F7 will show you where an object is used. It can be scripts or source codes of other projects. In our example, the actor_id
column is found in columns, database consoles with different queries, several objects, and in scratch files.
For more information about the action, refer to the Search for usages topic.
Other
Navigate to a file
To navigate to a file, press Ctrl+Shift+N and enter the name of a file.
Speed search in Settings dialog
Speed search works in settings as well. For example, open settings by pressing Ctrl+Alt+S, and type Limit page size to
into the search field.
Find Action
Find Action Ctrl+Shift+A helps you to find this or that action. It also searches in settings, so Limit page size to setting can be found here as well.
For example, if you forget how to open a new query console, press Ctrl+Shift+A, type new query
and press Enter.
Productivity tips
If you search for a table, you can also use the following actions:
- Open the DDL
Ctrl+B
- Open the table data
F4
- Navigate to the object in the Database Explorer
Alt+Shift+B
- Open the Modify Table dialog
Ctrl+F6
- Open the Select in popup
Alt+F1
- Open the Quick documentation popup
Ctrl+Q
- Open the SQL generator
Ctrl+Alt+G
Search Everywhere
You can find any item in the project or outside of it by its name. You can search for any item of the source code, databases, files, actions, symbols, settings, UI elements, and anything in Git from a single entry point.
The following video gives a short overview of search everywhere functionality in DataGrip.
Search everywhere
In the main menu, go to
or press Shift twice to open the search window. By default, DataGrip displays the list of recent files.Pressing double Shift again or Alt+N for mnemonics will select the Include non-project items checkbox and the list of search results will extend to external items.
If you switch to other tabs, select the All Places to extend the search results to non-project items.
Start typing your query. You can use synonyms in your search. For example, typing
toggle presentation mode
to search for the presentation mode action will displayEnter Presentation Mode
in results.DataGrip lists all of the found results where your query is found. Press Ctrl+Down to jump to the bottom of the list for
more...
items or Ctrl+Up to return to the top of the search results.Press Tab to switch the scope of your search to classes, files, symbols, actions, and so on.
You can use the following shortcuts to open the search window with the needed scope right from the start:
Ctrl+N: finds a class by name.
Ctrl+Shift+N: finds any file or directory by name (supports CamelCase and snake_case).
Ctrl+Alt+Shift+N: finds a symbol.
In this case, the search scope will include columns, indexes, and other objects.
Ctrl+Shift+A: finds an action by name. You can find any action even if it doesn't have a mapped shortcut or appear in the menu. For example, Emacs actions, such as kill rings, sticky selection, or hungry backspace.
To narrow down your search, click the Filter button () on the window toolbar and select the appropriate option.
For example, when you search for files, you can exclude some file types from your search. And if you are on the Database tab, you can select data sources that you want to include or exclude from the search.
To see the results of your search in the Find tool window, click the Open in Find Tool Window button () on the window toolbar. This button is disabled when you search in the Actions tab.
Search for settings and plugins
You can search for a list of settings, their options, and plugins that you can quickly access, enable, or disable.
Press Shift twice to open the search window and type
/
. DataGrip lists the available groups of settings.Select the one you need and press Enter.
As a result, DataGrip gives you quick access to the selected setting and its options.
You can also search for plugins and enable or disable them. Type "/plugins" in the search field, in the list of the search results use ON/OFF control keys to enable or disable the needed plugin.
Search for abbreviations
You can assign a short code for the action and use it to search for such action and quickly access it. For example, assign an abbreviation for Color Picker.
In the Settings dialog (Ctrl+Alt+S) , go to Keymap. From the options on the right, select .
From the context menu, select Add abbreviation.
In the dialog that opens, specify the abbreviation you are going to use, for example, cp and click OK.
Press Shift twice to open the search window.
When you type cp in the search field, DataGrip will display the item to which you have assigned your abbreviation. Press Enter to access the Color Picker dialog.
Evaluate mathematical expressions
You can quickly type and evaluate simple mathematical expressions. DataGrip also supports HEX, binary, and octal expressions.
Press Shift twice to open the search window.
Enter an expression you want to evaluate, DataGrip will display the answer in the search results.
You can use basic arithmetic operators —
+
,-
,*
,/
, as well as^
for power — and basic math functions:sqrt()
,sin()
,cos()
,tan()
.
Manage text search in Search Everywhere
The text search is available by default within the Text tab. Within this tab, you can search for text queries, matching words, including case-sensitive scopes, and regex.
The text search results are also available on the All tab at the bottom of the list. They are displayed when there are few or no other search results available for a given query. You can disable the text search at any time through Advanced Settings.
Press Ctrl+Alt+S to open settings and then select
.Scroll down to the Search Everywhere section and disable Show text search results in Search Everywhere.
Apply the changes and close the dialog.
Filter search results by a data source
In the Search Everywhere dialog, click the Database tab.
From the All Places list, select a scope that you want to use as a filter.
Filter search results by database object types
You can filter the search results by database object types. To do that, you can either use a tab filter, or the input field commands.
Using a tab filter:
Press Shift twice to open the search window and open the Database tab. Alternatively, press Ctrl+N.
Click Filter in the upper-right corner of the popup.
In the popup window that opens, select the database object type categories that you need in search results. Categories include the following objects:
Databases & Schemas
Tables
Scripting
Types
database
external-database
external-schema
schema
table
view
materialized-view
virtual table
foreign-table
and so on
function
stored procedure
aggregate
package
partition-function
and so on
alias-type
collection-type
object-type
table-type
Using the input field commands:
Press Shift twice to open the search window and open the Database tab. Alternatively, press Ctrl+N.
To find all database object of the same type, enter
/<database_object_type>
(in plural form). For example,/tables
.As a result, DataGrip gives you a list of all introspected database objects of the type you are looking for.
To find a certain database object of the type, add the database object name as follows:
/<database_object_type> <database_object_name>
. For example,/tables film
.Select the database object you need and press Enter.
Quick navigation from the Search Everywhere dialog
For a quick navigation from the Search Everywhere dialog, consider using the following shortcuts:
- Go to the table DDL
Select an object and press shortcut Ctrl+B.
- Jump to source
Select an object and press shortcut F4.
- Modify a table
Select a table and press shortcut Ctrl+F6.
- Select an object in the preferred view
Select an object and press shortcut Alt+F1.
- Open quick documentation
Select an object and press shortcut Ctrl+Q.
- Open the SQL generator
Select an object and press shortcut Ctrl+Alt+G.
Productivity tips
Search in context of a data source
To search for an object in context of the data source that you work with, select Context Data Sources from the All Places list. The filter is available for Database, Files, and Symbols tabs.
The context is defined according to the console that you use, the data editor, or a data source that you selected in the Database Explorer. If you select several data sources, the search is performed in all of them.