Summary
The browser rejects valid CREATE VECTOR INDEX statements with a client side Syntax error before the query is ever sent to the server. The same query succeeds against FalkorDB via redis-cli and via the Python client, so this is a browser grammar gap rather than a server limitation.
Reproduction
Run this in the browser query editor:
CREATE VECTOR INDEX FOR (u:User) ON (u.hdc_index_2048)
OPTIONS { dimension: 2048, similarityFunction: 'cosine' }
Result: Syntax error reported by the editor.
The identical query via redis-cli succeeds:
$ redis-cli GRAPH.QUERY vec_idx_test "CREATE VECTOR INDEX FOR (u:User) ON (u.hdc_index_2048) OPTIONS { dimension: 2048, similarityFunction: 'cosine' }"
Indices created: 1
Query internal execution time: 8.280917 milliseconds
Verified the index is fully functional afterwards: CALL db.indexes() reports OPERATIONAL, 2048 dimension vectors insert correctly with vecf32(), and db.idx.vector.queryNodes returns correctly ranked KNN results.
Tested against FalkorDB graph module 42003.
Root cause
lib/falkordb-cypher/generated/.grammar-src/Cypher.g4 lines 50 to 53:
oC_CreateIndex
: CREATE SP ( FULLTEXT SP )? INDEX SP?
( ( FOR SP? oC_IndexEntity SP? ON SP? oC_IndexProperties )
| ( ON SP? ':' SP? oC_LabelName SP? oC_IndexProperties ) ) ;
Two gaps:
- No
VECTOR keyword. The rule accepts an optional FULLTEXT qualifier only. There is no VECTOR token defined anywhere in the grammar (grep -c "^VECTOR" Cypher.g4 returns 0), so CREATE VECTOR INDEX cannot parse.
- No
OPTIONS { ... } clause. The rule ends after oC_IndexProperties, so even if VECTOR were accepted, the trailing options map would still fail to parse. OPTIONS is required for vector indexes since dimension and similarityFunction are mandatory.
oC_DropIndex at lines 55 to 58 has the identical shape, so DROP VECTOR INDEX is affected the same way.
Worth noting the spec file already knows about vector search at the procedure level. lib/falkordb-cypher/falkordbSpec.ts lists db.idx.vector.queryNodes and db.idx.vector.queryRelationships, so querying a vector index is supported while creating one is not.
Suggested fix
Add a VECTOR lexer token, allow it as an alternative to FULLTEXT in both oC_CreateIndex and oC_DropIndex, and add an optional OPTIONS map clause. Roughly:
oC_CreateIndex
: CREATE SP ( ( FULLTEXT | VECTOR ) SP )? INDEX SP?
( ( FOR SP? oC_IndexEntity SP? ON SP? oC_IndexProperties )
| ( ON SP? ':' SP? oC_LabelName SP? oC_IndexProperties ) )
( SP? OPTIONS SP? oC_MapLiteral )? ;
VECTOR and OPTIONS will also need adding to the non reserved keyword list around line 737, alongside the existing INDEX and FULLTEXT entries, so they remain usable as identifiers.
The parser is ANTLR generated, so generated/CypherParser.ts and generated/CypherLexer.ts need regenerating from the grammar source.
Impact
Vector indexes cannot be created from the browser at all. Users have to drop to redis-cli or a client library, which is a poor experience for anyone evaluating vector or GraphRAG capabilities in the UI.
Environment
- Repo branch:
staging
- FalkorDB graph module: 42003
- Browser: FalkorDB Browser on port 3000
Summary
The browser rejects valid
CREATE VECTOR INDEXstatements with a client side Syntax error before the query is ever sent to the server. The same query succeeds against FalkorDB viaredis-cliand via the Python client, so this is a browser grammar gap rather than a server limitation.Reproduction
Run this in the browser query editor:
Result:
Syntax errorreported by the editor.The identical query via
redis-clisucceeds:Verified the index is fully functional afterwards:
CALL db.indexes()reportsOPERATIONAL, 2048 dimension vectors insert correctly withvecf32(), anddb.idx.vector.queryNodesreturns correctly ranked KNN results.Tested against FalkorDB graph module 42003.
Root cause
lib/falkordb-cypher/generated/.grammar-src/Cypher.g4lines 50 to 53:Two gaps:
VECTORkeyword. The rule accepts an optionalFULLTEXTqualifier only. There is noVECTORtoken defined anywhere in the grammar (grep -c "^VECTOR" Cypher.g4returns 0), soCREATE VECTOR INDEXcannot parse.OPTIONS { ... }clause. The rule ends afteroC_IndexProperties, so even ifVECTORwere accepted, the trailing options map would still fail to parse.OPTIONSis required for vector indexes sincedimensionandsimilarityFunctionare mandatory.oC_DropIndexat lines 55 to 58 has the identical shape, soDROP VECTOR INDEXis affected the same way.Worth noting the spec file already knows about vector search at the procedure level.
lib/falkordb-cypher/falkordbSpec.tslistsdb.idx.vector.queryNodesanddb.idx.vector.queryRelationships, so querying a vector index is supported while creating one is not.Suggested fix
Add a
VECTORlexer token, allow it as an alternative toFULLTEXTin bothoC_CreateIndexandoC_DropIndex, and add an optionalOPTIONSmap clause. Roughly:VECTORandOPTIONSwill also need adding to the non reserved keyword list around line 737, alongside the existingINDEXandFULLTEXTentries, so they remain usable as identifiers.The parser is ANTLR generated, so
generated/CypherParser.tsandgenerated/CypherLexer.tsneed regenerating from the grammar source.Impact
Vector indexes cannot be created from the browser at all. Users have to drop to
redis-clior a client library, which is a poor experience for anyone evaluating vector or GraphRAG capabilities in the UI.Environment
staging