Search syntax issue #175782
Replies: 4 comments 3 replies
This comment was marked as off-topic.
This comment was marked as off-topic.
-
|
Parentheses are not supported in GitHub’s search syntax (both in the web UI and the API). The query parser already groups operators by precedence: AND (or just a space) is evaluated first. OR is evaluated last. That’s why wrapping terms in parentheses causes the query to fail. Examples: ✅ "a" OR "b" OR "c" → works ❌ ("a" OR "b" OR "c") → invalid If you want more complex queries, you’ll need to: Chain multiple OR conditions directly (without parentheses). Narrow results using other filters like repo:, in:, or language:. For true grouped logic, split queries into multiple API calls and combine results on your side. 👉 In short: Parentheses aren’t supported — you must flatten OR conditions or use multiple queries. |
Beta Was this translation helpful? Give feedback.
-
|
Understood, another problem is the number of keywords, I got inconsistent search results given different number of keywords provided. I didn't actually use "a" or "b" in here, just providing an example:
I had to group the keywords and query multiple times, is that expected behavior? |
Beta Was this translation helpful? Give feedback.
-
|
Hey! When you try something like: ("a" OR "b" OR "c") You can just write it without them, like this: "a" OR "b" OR "c" That’s the correct and only supported way to combine multiple keywords using OR. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Body
I'm trying to use API to search keywords, I found this works:
But this fails
So was parenthesis supported or not?
Beta Was this translation helpful? Give feedback.
All reactions