Hi,

I am currently playing around with neo4j for one of my pet projects and it
certainly looks like a interesting technology. I have a few questions
regarding traversers though.

Let's say I'm building a threaded discussion forum. Any node can be root of
a tree of 'reaction' relations with other nodes. Now usually, I would want
to display the reactions tree depth-first, with descending creation time
(newest reactions first), and of course paged. For the depth-first part, we
have the DepthFirstTraverser, which is fine. Descending creation time
(of the node or relation, doesn't really matter) can be approximated by the
'natural ordering' mentioned in AbstractTraverser.addEndNodesToList(), we
only have to reverse the order in which nodes are added to the positions
list - I didn't try this yet but shouldn't be a big issue. Of course I could
get all the relevant nodes and do the sorting later in the application
instead of having to modify the AbstractTraverser but this looks to be
far more effective. Now to paging: using StopEvaluator and
ReturnableEvaluator, I can get the first N nodes, next N nodes etc.. But if
the root node has 100k direct descendants in this relationship and I only
want first X of them by the aforementioned ordering, the ReturnableEvaluator
will still be called for all 100k traversal positions, which is not
effective at all, because I already know that I do not want the last 100k-X,
where X is not more than 100.

I do understand that StopEvaluator and ReturnableEvaluator are fine for many
cases like results filtering, but in the case I would need something
like a HardStopEvaluator, which will stop the traverser from adding new
positions and/or calling the evaluators after a node.

Of course, I can modify the current traverser to fit my needs, but maybe I
am missing something or there is a better, faster, more
effective way to accomplish this task. Thank you very much for any input.

Cheers,

Robert Hritz
_______________________________________________
Neo mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to