镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Search: Path:"…*" prefix restriction returns 0 results when the quoted prefix contains "(" or ")" #11034

Open

Description

@Andrewsimmans

Summary

A Path-restricted KQL query of the form Path:"<literal prefix>*" (trailing-wildcard prefix match — the standard way to scope a search to one document library folder) returns zero results whenever the literal prefix contains a ( or ) character anywhere, even though the prefix is a verified-correct literal prefix of the real indexed Path value. Other punctuation in the same prefix (commas, hyphens) causes no problem. Backslash-escaping the parentheses makes no difference. This does not appear to be documented anywhere we could find.

Environment

  • SharePoint Online (Microsoft 365, tested against a live production tenant, September 2026)
  • Query executed via CSOM (Microsoft.SharePoint.Client.Search.Query.KeywordQuery / SearchExecutor), package Microsoft.SharePointOnline.CSOM 16.1.27011.12008
  • The same pattern (failing on (/), working once truncated before it) was also observed earlier via the tenant's own web search box, pasting the equivalent query text directly — a separate, less controlled round of testing than the CSOM results below, but consistent with them

Repro

Real folder path (redacted tenant, structure preserved):

https://<tenant>.sharepoint.com/sites/<site>/<library>/<client folder>/<matter folder> (Decd)

Confirmed via the Search REST API (_api/search/query?...&selectproperties='Path') that the indexed Path value for an item under this folder is exactly, character-for-character, the string above (compared programmatically, ordinal character codes, plain ASCII — no hidden/smart-quote characters).

Queries that fail (0 results, including with no free-text search term at all)

Path:"https://<tenant>.sharepoint.com/sites/<site>/<library>/<client folder>/<matter folder> (Decd)*"
<searchterm> Path:"https://<tenant>.sharepoint.com/sites/<site>/<library>/<client folder>/<matter folder> (Decd)*"

Also fails identically with the parentheses preceded by a backslash (KQL defines no escape mechanism for quoted phrases, so this was tried only for completeness — still 0 results):

<searchterm> Path:"https://<tenant>.sharepoint.com/sites/<site>/<library>/<client folder>/<matter folder> \(Decd\)*"

Also fails with only the trailing ) trimmed, so the wildcard now immediately follows a letter rather than punctuation (ruling out "the wildcard specifically must follow a word character" as the explanation):

<searchterm> Path:"https://<tenant>.sharepoint.com/sites/<site>/<library>/<client folder>/<matter folder> (Decd*"

Query that succeeds (128 results)

Truncating the prefix to end before the parenthesis entirely:

<searchterm> Path:"https://<tenant>.sharepoint.com/sites/<site>/<library>/<client folder>/<matter folder>*"

Server-reported total match count (ResultTable.TotalRows) equals the 128 rows actually returned (RowLimit was 1000, so this isn't a row-limit artifact), and the results include items whose full Path is under the parenthesised folder itself (e.g. .../<matter folder> (Decd)/Documents/...) — i.e. the content that the failing, more specific query above should have found, and didn't.

Control: other punctuation in the same prefix is unaffected

The succeeding query's prefix contains a comma and multiple hyphens (<client folder> contains , and the matter folder contains multiple - separators plus a numeric ID with an embedded hyphen), and matches correctly. So this isn't a general punctuation/reserved-character problem — it's specific to (/).

Reproduced on 4 independent real folders

Folder Parenthesis position Result
Control (no parenthesis anywhere in path) — Works normally
Folder A at the very end 0 results (fixed by truncating before it)
Folder B at the end, preceded by a double space 0 results (fixed by truncating before it)
Folder C mid-path, with substantial real text after it 0 results (fixed by truncating before it)

In every failing case, truncating the Path:"...*" prefix to end immediately before the first ( restores correct, complete results.

Expected behavior

Per the formal KQL protocol grammar, [MS-KQL] §2 Structures and §2.3.1 String Tokens:

quoted-string-value = DQUOTE 1*(%x00-21 / DQUOTE DQUOTE / %x23-ffffffff) DQUOTE

[A double quotation mark within the quoted string MUST be represented by two double quotation marks.] Any Unicode character is allowed [inside a quoted-string-value]... An unquoted-string-value ... cannot contain white space characters, double quotes, or parentheses.

Parentheses are explicitly reserved only in the unquoted form; the quoted form explicitly permits any character. Our Path value is quoted. §2.3.1.2 String Token Prefix also confirms wildcard evaluation is supported for quoted-string-value, and the public KQL syntax reference gives the documented form title:"Advanced Sear*" for exactly this trailing-wildcard-on-a-quoted-phrase pattern. So a trailing-wildcard match against a verified-correct literal prefix of the indexed data should match.

(Separately: the parentheses here are inside the quoted value, not the documented Property:(<expression>) grouping syntax, so that isn't a relevant distinction either.)

Unverified hypothesis, not asserted as fact: Path may use "Complete Matching" (NoWordBreaker) rather than being word-broken like a typical text property, which would make this a literal whole-string prefix match rather than a token match. We have not confirmed this via the tenant's Search Schema configuration, and could not find Microsoft documentation stating it either way — flagging only as our leading theory for why the property might behave differently from ordinary text search, not as an established fact.

Actual behavior

Zero results, specifically and only when the prefix (up to the wildcard) contains ( or ), regardless of:

  • whether the parenthesis is at the end, mid-string, or preceded/followed by other characters
  • whether it's preceded by a backslash
  • whether a free-text search term is combined with the Path: restriction or the Path: restriction is used alone

Workaround in use

Truncate the query prefix at the first ( before appending the trailing wildcard. This broadens the search scope beyond the exact intended folder, but in every case tested it stayed correctly scoped, since the part of the path that makes it unique always appeared before the first parenthesis.

Question for Microsoft

Is this documented behavior of the Path managed property that we've been unable to find documentation for? Or is this a bug in how the search index or query engine handles (/) for this property? A pointer to relevant documentation, or confirmation this is a bug, would be appreciated.

Activity

  1. m365-agent-toolkit-assistant commented on Sep 24, 2026

    @m365-agent-toolkit-assistant

    👋 Hi Andrewsimmans,

    Thank you for reporting this issue! We want to let you know that:

    ⏱️ Our team will personally review your issue
    🎯 You can expect a response within 1 business day

    ✨ This is an AI-generated initial response
    🤖 AI-Generated Preliminary Analysis:

    Classification: Bug — the reported supported KQL syntax appears to violate the documented behavior for quoted property values with trailing-wildcard prefix matching.

    • Microsoft documents property:"phrase*" as supported; no parenthesis exception is documented.
    • Reproduction through CSOM and SharePoint web search suggests this is not CSOM-package-specific, though Microsoft has not confirmed the root cause.
    • No exact duplicate or maintainer acknowledgement was found. SharePoint Search: How to handle Dashes in URLs #10363 is only a related SharePoint Search punctuation/encoding defect.

    Upgrade check: No verified CSOM or service release fixes this behavior.

    What to do now:

    1. Continue truncating immediately before (, then post-filter results by the exact Path.
    2. Open a Microsoft 365 support case with the minimal query, UTC timestamp, tenant/site details, and correlation/request ID.
    3. Avoid backslash escaping; KQL does not document it for quoted values.

    Useful links:


    Note: This is an automated first response generated by AI. A human team member will review your issue and provide a more detailed response soon. We appreciate your patience!

  2. Ashlesha-MSFT commented on Sep 25, 2026

    @Ashlesha-MSFT
    Contributor

    Thanks for reporting this issue. We were able to reproduce the reported behavior on our end. We’ll raise this with the engineering team for further investigation and will share an update here once we have more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions