Skip to content

Commit 67fd844

Browse files
committed
Don't convert graph Ids to string.
1 parent fddcf53 commit 67fd844

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

redisinsight/ui/src/packages/redisgraph/src/parser.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function responseParser(data: any): IResponseParser {
7171
if (Array.isArray(item)) {
7272
if (item[0][0] === 'id' && item[1][0] === 'labels') {
7373
const node: INode = {
74-
id: item[0][1].toString(),
74+
id: item[0][1],
7575
labels: item[1][1],
7676
properties: {}
7777
}
@@ -81,15 +81,15 @@ function responseParser(data: any): IResponseParser {
8181
const v = resolveProps(x)
8282
node['properties'][v.key] = v.value
8383
})
84-
if (nodes.findIndex((e: INode) => e.id === item[0][1].toString()) === -1) {
84+
if (nodes.findIndex((e: INode) => e.id === item[0][1]) === -1) {
8585
nodes.push(node)
8686
}
8787
} else if (item[0][0] === 'id' && item[1][0] === 'type') {
8888
const edge: IEdge = {
89-
id: item[0][1].toString(),
89+
id: item[0][1],
9090
type: item[1][1],
91-
source: item[2][1].toString(),
92-
target: item[3][1].toString(),
91+
source: item[2][1],
92+
target: item[3][1],
9393
properties: {}
9494
}
9595
types[item[1][1]] = (types[item[1][1]] + 1) || 1
@@ -155,7 +155,7 @@ function ResultsParser(data: any[][]) : {headers: any[], results: any[] }{
155155
if (Array.isArray(entity)) {
156156
if (entity[0][0] === 'id') {
157157
const item: any = {
158-
id: entity[0][1].toString(),
158+
id: entity[0][1],
159159
properties: {}
160160
}
161161
let propValues = []
@@ -164,8 +164,8 @@ function ResultsParser(data: any[][]) : {headers: any[], results: any[] }{
164164
propValues = entity[2][1]
165165
} else if (entity[1][0] === 'type') {
166166
item.type = entity[1][1]
167-
item.source = entity[2][1].toString()
168-
item.target = entity[3][1].toString()
167+
item.source = entity[2][1]
168+
item.target = entity[3][1]
169169
propValues = entity[4][1]
170170
}
171171
propValues.map((x: any) => {

redisinsight/ui/src/packages/redisgraph/src/utils.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,23 +189,23 @@ export function commandIsSuccess(resp: [{ response: any, status: string }]) {
189189
}
190190

191191

192-
export function getFetchNodesByIdQuery(graphKey: string, nodeIds: string[]): string {
192+
export function getFetchNodesByIdQuery(graphKey: string, nodeIds: number[]): string {
193193
return `graph.ro_query ${graphKey} "MATCH (n) WHERE id(n) IN [${nodeIds}] RETURN DISTINCT n"`
194194
}
195195

196-
export function getFetchNodesByEdgeIdQuery(graphKey: string, edgeIds: string[], existingNodeIds: string[]): string {
196+
export function getFetchNodesByEdgeIdQuery(graphKey: string, edgeIds: number[], existingNodeIds: number[]): string {
197197
return `graph.ro_query ${graphKey} "MATCH (n)-[t]->(m) WHERE id(t) IN [${edgeIds}] AND NOT id(n) IN [${existingNodeIds}] AND NOT id(m) IN [${existingNodeIds}] RETURN n, m"`
198198
}
199199

200-
export function getFetchEdgesByIdQuery(graphKey: string, edgeIds: string[]): string {
200+
export function getFetchEdgesByIdQuery(graphKey: string, edgeIds: number[]): string {
201201
return `graph.ro_query ${graphKey} "MATCH ()-[t]->() WHERE id(t) IN [${edgeIds}] RETURN DISTINCT t"`
202202
}
203203

204-
export function getFetchDirectNeighboursOfNodeQuery(graphKey: string, nodeId: string): string {
204+
export function getFetchDirectNeighboursOfNodeQuery(graphKey: string, nodeId: number): string {
205205
return `graph.ro_query "${graphKey}" "MATCH (n)-[t]-(m) WHERE id(n)=${nodeId} RETURN t, m"`
206206
}
207207

208208

209-
export function getFetchNodeRelationshipsQuery(graphKey: string, sourceNodeIds: string[], destNodeIds: string[], existingEdgeIds: string[]): string {
209+
export function getFetchNodeRelationshipsQuery(graphKey: string, sourceNodeIds: number[], destNodeIds: number[], existingEdgeIds: number[]): string {
210210
return `graph.ro_query ${graphKey} "MATCH (n)-[t]->(m) WHERE (ID(n) IN [${sourceNodeIds}] OR ID(m) IN [${destNodeIds}]) AND NOT ID(t) IN [${existingEdgeIds}] RETURN DISTINCT t"`
211211
}

0 commit comments

Comments
 (0)