Grouping search terms
Stay organized with collections
Save and categorize content based on your preferences.
You can group multiple search terms together using parentheses ((
and )
).
For example:
(hello OR world) AND lang:java
You can also nest multiple groups. For example:
((Strings OR StringBuilder) AND lang:java) OR (std AND lang:cpp)
For more information see Additional syntax options
in the reference documentation.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-03 UTC."],[[["\u003cp\u003eSearch terms can be grouped together using parentheses for more complex queries.\u003c/p\u003e\n"],["\u003cp\u003eNested grouping with parentheses allows combining multiple search conditions.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eOR\u003c/code\u003e operator searches for either term within a group, while the \u003ccode\u003eAND\u003c/code\u003e operator requires both terms to be present.\u003c/p\u003e\n"],["\u003cp\u003eFor detailed syntax information, refer to the additional syntax options in the reference documentation.\u003c/p\u003e\n"]]],[],null,["# Grouping search terms\n\nYou can group multiple search terms together using parentheses (`(` and `)`).\nFor example: \n\n (hello OR world) AND lang:java\n\nYou can also nest multiple groups. For example: \n\n ((Strings OR StringBuilder) AND lang:java) OR (std AND lang:cpp)\n\nFor more information see [Additional syntax options](../reference#syntax-options)\nin the reference documentation."]]