Searching file contents
By default, a query searches both the file path and the content. You can
restrict your search to just the contents of a file by using the
content
filter. For example, the following query looks
for the term main
in the contents of all Java files. It does not search for
instances where a path contains the term main
.
lang:java content:main
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-03 UTC.
[null,null,["Last updated 2023-10-03 UTC."],[[["The default search includes both file paths and file content."],["For content-only searches, use the `content` filter, like `content:main` to find \"main\" within Java files."],["This approach avoids irrelevant results from file paths containing the search term."]]],[]]