tetherless-world / mcs-apps

DARPA Machine Common Sense (MCS) applications for exploring knowledge graphs of common sense, benchmark questions, and question-answering processes
MIT License
4 stars 1 forks source link

Search results page: showing same result at end of every page #256

Open gordom6 opened 4 years ago

gordom6 commented 4 years ago

Search for sheep (no quotes). The node label sheep polypore is at the end of every results page.

gordom6 commented 4 years ago

This happens irrespective of the search term (or the empty / match-all search), and only with the neo4j store. I've stepped through the search method and confirmed that the record is actually being returned from neoj. For reference, this is the query:

Query{text='CALL db.index.fulltext.queryNodes("node", $text) YIELD node, score
RETURN labels(node)[0] as type, node.label, node.id, node.inDegree, node.labels, node.outDegree, node.pos, node.sources, node.pageRank, node.wordNetSenseNumber
ORDER BY score desc
SKIP 20
LIMIT 10
', parameters={text: "id:*"}}
gordom6 commented 4 years ago

It appears that neo4j's queryNodes procedure interacts oddly with ORDER BY. Taking out ORDER BY fixes the problem (because queryNodes returns nodes in order of descending score), but leaves us without sorting on other fields.

I've also seen documentation that says that queryNodes takes optional skip and limit parameters in a map, rather than having SKIP and LIMIT in the Cypher, but I can't get that to work.

We need to migrate away from neo4j, it's causing too many problems. I've filed another issue to replace the out-of-core store with Postgres.

gordom6 commented 4 years ago

I'm leaving this bug in pending the switch to Postgres.

gordom6 commented 4 years ago

@123joshuawu I will prioritize #257 so that demo-type searches for single words don't reach the search results page at all.