Repository navigation
fix(mcp): document quoted field:"value" Lucene syntax for exact match #3561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@hyperdx/api': patch | ||
| --- | ||
|
|
||
| fix(mcp): document quoted `field:"value"` Lucene exact-match syntax in query tool schemas and dashboard query guide |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,8 @@ import { mcpUserError } from '@/mcp/utils/errors'; | |
| const WHERE_DESCRIPTION = | ||
| 'Row filter.\n\n' + | ||
| 'FIRST: pick a language (whereLanguage):\n' + | ||
| ' Lucene: Column:value e.g. level:error\n' + | ||
| ' Lucene (exact): Column:"value" e.g. ServiceName:"api"\n' + | ||
| ' Lucene (substr): Column:value e.g. Body:timeout\n' + | ||
| ' Lucene map attrs: Column.key:value e.g. SpanAttributes.http.method:GET\n' + | ||
| " SQL: Column = 'value' e.g. StatusCode = 500\n" + | ||
| " SQL map attrs: SpanAttributes['key'] = 'value'\n\n" + | ||
|
|
@@ -18,19 +19,20 @@ const WHERE_DESCRIPTION = | |
| " SQL uses BRACKET notation: SpanAttributes['http.method'] = 'GET'\n\n" + | ||
| "WRONG: SpanAttributes['key']:value (Lucene cannot parse bracket syntax)\n" + | ||
| 'WRONG: level = "error" (SQL syntax with whereLanguage:"lucene")\n\n' + | ||
| 'SUBSTRING TRAP: Lucene field:value matches ANY row containing "value" as a substring, not exact equality.\n' + | ||
| "SUBSTRING TRAP: Unquoted Lucene field:value compiles to ILIKE '%value%' (substring match that skips primary-key index on sort-key columns like ServiceName/SpanKind).\n" + | ||
| ' SpanKind:Server matches "Server", "ServerStreaming", "InternalServer", etc.\n' + | ||
| " For exact match, use SQL: SpanKind = 'Server'"; | ||
| ' For exact equality (=), quote the value in Lucene (SpanKind:"Server") or use SQL (SpanKind = \'Server\').'; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔵 minor — Docs never mention that quoted Lucene equality is case-sensitive, unlike the unquoted ilike they tell agents to replace Add a note next to the quoted-exact guidance in WHERE_DESCRIPTION, WHERE_LANGUAGE_DESCRIPTION and content.ts (Lucene section and mistake #15), e.g. 'quoted match is case-sensitive: SeverityText:"error" will not match "ERROR"'. Quoted terms go through Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond |
||
|
|
||
| const WHERE_LANGUAGE_DESCRIPTION = | ||
| 'Language of the "where" filter. The syntax in "where" MUST match this setting.\n' + | ||
| ' Lucene: Column:value, Column.mapKey:value, Column:>100\n' + | ||
| ' Lucene: Column:"value" (exact), Column:value (substring), Column.mapKey:value, Column:>100\n' + | ||
| " SQL: Column = 'value', SpanAttributes['key'] = 'value'\n\n" + | ||
| 'Lucene supports comparisons (>= > < <=), wildcards (field:val*), ranges ([1 TO 5]), ' + | ||
| 'and map attributes via dot notation. Use "sql" for IN(...) lists, complex expressions, or function calls.\n' + | ||
| 'IMPORTANT: Lucene field:value is a SUBSTRING match (ilike), not exact equality. ' + | ||
| 'IMPORTANT: Unquoted Lucene field:value is a SUBSTRING match (ilike), not exact equality. ' + | ||
| 'field:val* is prefix-within-substring, not a true prefix match. ' + | ||
| "For exact matching or reliable wildcards, use SQL: WHERE field = 'value' or WHERE field LIKE 'val%'.\n\n" + | ||
| 'For exact matching, quote the value in Lucene (field:"value") or use SQL (field = \'value\'). ' + | ||
| "For reliable prefix/wildcard matching, use SQL: WHERE field LIKE 'val%'.\n\n" + | ||
| 'Common mistake: writing Column:value (Lucene) but setting whereLanguage to "sql". ' + | ||
| 'If your filter uses colon syntax, use "lucene".'; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 minor — Edited AND example still uses dotted-path Lucene on a map attribute, which the same guide calls unreliable
Pick a top-level column for the second clause instead, e.g.
ServiceName:"api" AND Duration:>1000000000. The MAP-ATTRIBUTE GOTCHA section in this same file (around line 899-902) nameshttp.status_code:>=500as an unreliable Lucene filter that can return errors or zero rows, yet the example this PR rewrote keeps it as the model AND query.Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond