Hello everyone!
I have a database with users, books and user catalogs with books. Users can follow each others.
I want to create a recommendation algorithm that shows the top books added to another catalogs
So.. here are the two queries. The only one difference is that I am returning "bkIds". I am receiving totally different results.
Any ideas why?
Thanks!
Here are the queries:
match (b:Book)-[r:BOOK_ADDED_TO_CATALOG]->(c:Catalog)
where r.userId = 9
with collect(b.id) as booksIds
match (bk:Book)-[r:BOOK_ADDED_TO_CATALOG]->(c:Catalog)
where not (ID(bk) in booksIds) and bk.title <> "" and bk.title <> ""
with bk.title as BookTitle, collect(c.name) as BookCategories, count(r) as relCount, booksIds as bids
UNWIND BookCategories as Categories
return BookTitle, count(Categories) as CategoriesCount, bids
order by CategoriesCount desc
limit 20
match (b:Book)-[r:BOOK_ADDED_TO_CATALOG]->(c:Catalog)
where r.userId = 9
with collect(b.id) as booksIds
match (bk:Book)-[r:BOOK_ADDED_TO_CATALOG]->(c:Catalog)
where not (ID(bk) in booksIds) and bk.title <> "" and bk.title <> ""
with bk.title as BookTitle, bk.id as bkIds, collect(c.name) as BookCategories, count(r) as relCount, booksIds as bids
UNWIND BookCategories as Categories
return BookTitle, bkIds, count(Categories) as CategoriesCount, bids
order by CategoriesCount desc
limit 20