On Wed, Aug 13, 2008 at 8:51 AM, Nils Kaiser <[EMAIL PROTECTED]> wrote:

> Comments inline.
>
> Johan Svensson schrieb:
> >> A part I am struggeling with in the design of the app, is that the UI
> >> should support viewing of very large collections, for example all email
> >> messages in "work" collection. These will have to be sortable by
> >> different fields, in case of a mail message even sorting by the name of
> >> the contact (which needs to follow a relationship). I don't really know
> >> how to use Neo4j (or another persistence mechanism, or another layer on
> >> top of Neo4j) to implement such functionality.
> >>
> >>
> >
> > This can either be solved by reading in the full collection (using a
> > traverser) then sort it or keep the items sorted in the node space
> > (using linked lists like Timeline utility in index-util component).
> >
> Are there some examples of this somewhere? Or maybe something I might
> use to leverage the task?
>
> With a relational DB, I wouldn't have to care as the sorting could be
> made by the database. I could then use a cursor to implement some kind
> of lazy loading in my UI.


Yeah, and it does it in the same way, either you define that you want the DB
to store a sorted index, or it does the sorting by reading all data and sort
it when you request it. And defining that you want something to be sorted in
Neo is by using the index-utils to define sorted datastructures. Using for
example the timeline is as simple as:

import org.neo4j.util.timeline.TimelineIndex;
import org.neo4j.util.timeline.Timeline;

...

NeoService neo = ...
Node timelineStartNode = ...
TimelineIndex timeline = new Timeline("Timeline name", timeline, neo);
...
timeline.addNode(someNode, getSortKeyFromNode(someNode));
...

private long getSortKeyFromNode(Node node) {
    ....
}

For information on how to include index-util in your project, see this
previous thread:
http://lists.neo4j.org/pipermail/user/2008-August/000666.html


> I guess the solution to sort the objects as a
> linked list has the disadvantage not to be able to sort on multiple fields.


Well, the same object could be contained in more than one list...

>
>
> Would lucene help here?
> _______________________________________________
> Neo mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>


A note to my fellow Neo developers:
It could be a good idea to create some sorted structure that keeps nodes
sorted based on a String, since this is quite a common use case.

-- 
Tobias Ivarsson <[EMAIL PROTECTED]>
Hacker, Neo Technology
www.neotechnology.com
Cellphone: +46 706 534857
_______________________________________________
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to