@neo4j/cypher-builder
Version:
A programmatic API for building Cypher queries for Neo4j
34 lines (33 loc) • 1.72 kB
JavaScript
;
/*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.queryNodes = queryNodes;
exports.queryRelationships = queryRelationships;
const CypherProcedure_1 = require("../../../procedures/CypherProcedure");
const normalize_expr_1 = require("../../../utils/normalize-expr");
const VECTOR_NAMESPACE = "db.index.vector";
/** Returns all labels in the database
* @see [Neo4j Documentation](https://neo4j.com/docs/operations-manual/current/reference/procedures/#procedure_db_index_vector_queryNodes)
* @group Procedures
*/
function queryNodes(indexName, numberOfNearestNeighbours, query) {
const procedureArgs = getVectorArguments(indexName, numberOfNearestNeighbours, query);
return new CypherProcedure_1.CypherProcedure("queryNodes", procedureArgs, VECTOR_NAMESPACE);
}
/** Returns all labels in the database
* @see [Neo4j Documentation](https://neo4j.com/docs/operations-manual/current/reference/procedures/#procedure_db.index.vector.queryRelationships)
* @group Procedures
*/
function queryRelationships(indexName, numberOfNearestNeighbours, query) {
const procedureArgs = getVectorArguments(indexName, numberOfNearestNeighbours, query);
return new CypherProcedure_1.CypherProcedure("queryRelationships", procedureArgs, VECTOR_NAMESPACE);
}
function getVectorArguments(indexName, numberOfNearestNeighbours, query) {
const indexNameVar = (0, normalize_expr_1.normalizeExpr)(indexName);
const numberOfNearestNeighboursVar = (0, normalize_expr_1.normalizeExpr)(numberOfNearestNeighbours);
const procedureArgs = [indexNameVar, numberOfNearestNeighboursVar, query];
return procedureArgs;
}