cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Use full text search and Personalized PageRank combined

admin3
Node Clone

Hi,

I am trying to combine all these options in one query but I can't find a way to work it out

MATCH (actor:Actor {uuid:...)-[:PLAYED_IN]->(movie)<-[:PLAYED_IN]-(coactor)-[:PLAYED_IN]->(movie2)<-[:PLAYED_IN]-(cocoactor)
WHERE movie<movie2 AND coactor<>actor AND cocoactor<>coactor
WITH COLLECT(coactor) + COLLECT(cocoactor) AS sourceNodes

CALL gds.pageRank.stream(
  'CALL db.index.fulltext.queryNodes("names",  "*~") YIELD node, score
   RETURN id(node) as id',
   {sourceNodes: sourceNodes})
YIELD nodeId, score
WITH gds.util.asNode(nodeId) AS n, score
RETURN n

The error I am getting is

Failed to invoke procedure 'gds.pageRank.stream': Caused by: java.util.NoSuchElementException: Cannot find graph with name 'CALL db.index.fulltext .................. RETURN id(node) as id'.

I am using GDS 1.3, neo4j 4.1 and apoc 4.1.0.1

Any ideas how to include fulltext in pageRank?
Thanks

1 REPLY 1

What kind of results are you expecting?

gds.pageRank.stream expects a graph (nodes and rels) from the Labels and Rels specified, but all you feeding it is the internal node id. I can't make much sense of what you're looking for from this, so I'm not surprised the computer is getting confused.

gds.pageRank.stream("LabelName", "REL-NAME")

Alt

You could mutate the graph, but that wouldn't be ideal with multiple concurrent users:

CALL db.index.fulltext.queryNodes("names",  "*~") YIELD node, score
SET node.tempIndexScore=score
SET node :TempStreamLabel
WITH node
MATCH (node)-[r]-(node)
SET r :TempRelLabel;

CALL gds.pageRank.stream("TempStreamLabel", "TempRelLabel") YIELD nodeId, score
WITH gds.util.asNode(nodeId) AS n, score
RETURN n, score, n.tempIndexScore as indexScore, (score + n.tempIndexScore) as combinedScore
ORDER BY combinedScore DESC;
Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online