import { FulltextInput } from '../model'; import { FulltextIndex, NodeDefinition, SchemaMetadata } from '../schema/types'; export interface FulltextResult { cypher: string; params: Record; scoreThreshold?: number; } /** * Compiles fulltext search input into Cypher CALL clauses using * db.index.fulltext.queryNodes and db.index.fulltext.queryRelationships. * * Supports logical operators: * - **Leaf (node index)**: `{ IndexName: { phrase, score? } }` → `queryNodes` * - **Leaf (relationship index)**: `{ relField: { IndexName: { phrase, score? } } }` → `queryRelationships` * - **OR**: `CALL { ... UNION ... }` combining multiple branches * - **AND**: Sequential correlated subqueries with node identity matching * - **NOT**: `WHERE NOT EXISTS { ... }` exclusion pattern (Neo4j 5+) */ export declare class FulltextCompiler { private schema; constructor(schema: SchemaMetadata); /** * Compile fulltext input to Cypher CALL clause(s). * Handles flat leaves AND recursive OR/AND/NOT expressions. */ compile(fulltext: FulltextInput, nodeDef: NodeDefinition, nodeVar?: string): FulltextResult; /** * Compile fulltext input for a relationship index into a Cypher CALL clause. * Uses db.index.fulltext.queryRelationships. */ compileRelationship(fulltext: Record, relIndex: FulltextIndex, relVar?: string): FulltextResult; private compileNode; /** * Compile a leaf entry. Two shapes: * - Node index: `{ IndexName: { phrase, score? } }` — value has `phrase` * - Relationship index: `{ relField: { IndexName: { phrase, score? } } }` — value is nested */ private compileLeaf; /** Compile a node-level fulltext index: `{ IndexName: { phrase, score? } }` */ private compileNodeIndex; /** * Compile a relationship fulltext index: * `{ relFieldName: { IndexName: { phrase, score? } } }` * * Validates that the relationship field exists on the node and that the * index belongs to its @relationshipProperties type. */ private compileRelationshipIndex; /** * OR: wrap branches in `CALL { ... UNION ... }` with max(score) deduplication. */ private compileOr; /** * AND: sequential correlated subqueries. * First branch yields nodes, subsequent branches filter to matching nodes. */ private compileAnd; /** * NOT: produces a WHERE NOT EXISTS { ... } clause. * When used standalone, wraps in a MATCH-all then filters out. */ private compileNot; } //# sourceMappingURL=fulltext.compiler.d.ts.map