Repository navigation
Description
Description
SEARCH_INDEX('Index[field]', '<query>') fails to execute when <query> contains two or more . (dot) characters:
CommandSQLParsingException: Nested property access is not supported in this
context: search_index:doc[title]:node.js 3.5
A query with one dot works; two or more dots anywhere in the query string throw. The dots do not have to be related to each other or to boosts - the trigger is purely the count of . in the whole query string. Examples that fail: node.js react.js, version 3.5.1, a.b c.d, and two fractional caret boosts title:java^3.0 title:database^2.0. A single fractional caret (title:java^3.0) and a single dotted term (node.js) both work, which is why this can look caret-specific at first.
This matters because dotted tokens are common in real full-text corpora (node.js, asp.net, file names, package names, version strings, IP/host fragments), and Lucene/Elasticsearch accept fractional caret boosts (term^1.5), so users naturally write queries that hit this.
Environment
- ArcadeDB Server
26.7.1-SNAPSHOT(build661e52fce3b84f452f02cc131b9c5608674deb67/1782276736394/main) - Default database options
- Reproduces regardless of similarity (BM25 default or CLASSIC) - it is in the
SEARCH_INDEXfunction plumbing, not the scorer
Root cause
SQLFunctionSearchIndex caches its per-query result map under a context variable whose name embeds the raw query string:
engine/src/main/java/com/arcadedb/function/sql/text/SQLFunctionSearchIndex.java:87 (and :180)
final String cacheKey = "search_index:" + indexName + ":" + queryString;
...
Map<RID, Float> allResults = (Map<RID, Float>) iContext.getVariable(cacheKey); // :92 / :182
...
iContext.setVariable(cacheKey, allResults); // :99 / :186BasicCommandContext.getVariable(String) treats . in a variable name as nested property access ($var.field) and rejects more than one dot:
engine/src/main/java/com/arcadedb/query/sql/executor/BasicCommandContext.java:143
if (name.contains(".")) {
final String[] parts = name.split("\\.");
if (parts.length > 2)
throw new CommandSQLParsingException(
"Nested property access is not supported in this context: " + name);
name = parts[0];
if (parts.length > 1)
fieldName = parts[1];
}So the cache key search_index:doc[title]:node.js 3.5 (two dots -> parts.length == 3) trips the guard. With exactly one dot the guard does not throw, but it still silently splits the key into name/fieldName, so the cache lookup is keyed wrong (a latent correctness issue, masked today because the subsequent setVariable/getVariable use the same broken split symmetrically).
The query string is data and should never be interpreted as a variable path.
Steps to reproduce
curl -sS -u root:playwithdata http://localhost:2480/api/v1/command/test \
-H 'Content-Type: application/json' \
-d '{"language":"sql","command":"CREATE DOCUMENT TYPE doc"}'
curl -sS -u root:playwithdata http://localhost:2480/api/v1/command/test \
-H 'Content-Type: application/json' \
-d '{"language":"sql","command":"CREATE PROPERTY doc.title STRING"}'
curl -sS -u root:playwithdata http://localhost:2480/api/v1/command/test \
-H 'Content-Type: application/json' \
-d '{"language":"sql","command":"CREATE INDEX ON doc (title) FULL_TEXT"}'
curl -sS -u root:playwithdata http://localhost:2480/api/v1/command/test \
-H 'Content-Type: application/json' \
-d '{"language":"sql","command":"INSERT INTO doc SET title = '"'"'java database node.js version 3.5'"'"'"}'
# ONE dot - OK
curl -sS -u root:playwithdata http://localhost:2480/api/v1/query/test \
-H 'Content-Type: application/json' \
-d '{"language":"sql","command":"SELECT title FROM doc WHERE SEARCH_INDEX('"'"'doc[title]'"'"', '"'"'node.js'"'"') = true"}'
# -> matches
curl -sS -u root:playwithdata http://localhost:2480/api/v1/query/test \
-H 'Content-Type: application/json' \
-d '{"language":"sql","command":"SELECT title FROM doc WHERE SEARCH_INDEX('"'"'doc[title]'"'"', '"'"'title:java^3.0'"'"') = true"}'
# -> matches (single fractional caret = one dot)
# TWO dots - parse error
curl -sS -u root:playwithdata http://localhost:2480/api/v1/query/test \
-H 'Content-Type: application/json' \
-d '{"language":"sql","command":"SELECT title FROM doc WHERE SEARCH_INDEX('"'"'doc[title]'"'"', '"'"'node.js 3.5'"'"') = true"}'
# -> CommandSQLParsingException: Nested property access is not supported in this context:
# search_index:doc[title]:node.js 3.5
curl -sS -u root:playwithdata http://localhost:2480/api/v1/query/test \
-H 'Content-Type: application/json' \
-d '{"language":"sql","command":"SELECT title FROM doc WHERE SEARCH_INDEX('"'"'doc[title]'"'"', '"'"'title:java^3.0 title:database^2.0'"'"') = true"}'
# -> CommandSQLParsingException: Nested property access is not supported in this context:
# search_index:doc[title]:title:java^3.0 title:database^2.0
# integer carets (no dots) - OK
curl -sS -u root:playwithdata http://localhost:2480/api/v1/query/test \
-H 'Content-Type: application/json' \
-d '{"language":"sql","command":"SELECT title FROM doc WHERE SEARCH_INDEX('"'"'doc[title]'"'"', '"'"'title:java^3 title:database^2'"'"') = true"}'
# -> matchesObserved
SEARCH_INDEX(..., 'node.js 3.5')andSEARCH_INDEX(..., 'title:java^3.0 title:database^2.0')(two dots) throwCommandSQLParsingException: Nested property access is not supported in this context: search_index:<index>:<query>.- Single-dot queries (
node.js,title:java^3.0) and dot-free queries (title:java^3 title:database^2) succeed.
Expected
The SEARCH_INDEX query string is opaque text handed to the full-text/Lucene query parser. Its content (dots included) must not be parsed as SQL variable/property paths. node.js react.js, version 3.5.1, and fractional caret boosts (title:java^1.5 body:db^0.5) should all execute.
Suggested fix
The result cache should not live in the dotted getVariable/setVariable namespace keyed by the raw query. Options, high level:
- Use an opaque cache keyed by the raw string. Store the per-query result map in a dedicated
Map<String, Object>on the command context (or aputCachedValue/getCachedValueAPI) that treats the key as opaque and never applies the.-splitting thatgetVariabledoes. Cleanest fix; the cache is an internal concern and has no business in the user-facing variable namespace. - Encode the key. Build the cache key from a hash of
indexName + queryString(or escape.), guaranteeing it contains no.. Smaller change, but still abuses the variable namespace. - Scope the
getVariabledot-splitting. Only interpret.as nested access for names that did not come from internal caching. More invasive and risks the latent single-dot mis-keying noted above.
Activity
lvca commentedon Jun 24, 2026
Reproduced
fix: [#4734] SEARCH_INDEX query with two+ dots no longer treated as n…
lvca commentedon Jun 24, 2026
Fixed
fix: [#4734] SEARCH_INDEX query with two+ dots no longer treated as n…
fix(ArcadeData#9893, ArcadeData#9894, ArcadeData#9895): SEARCH_INDEX …
fix(#9893, #9894, #9895): SEARCH_INDEX and the index replay stop on c…