I had an answer for this also, but see that Andreas and Anders have both answered with the two mechanisms I had tried:
- lucene - custom index But I thought I'd add a little on the custom index idea, because I think that can also provide fast sorting, if you are usually requiring answers in the same order every time. Your index would be built as a simple chain of nodes, sorted in the order you want, and optionally done as a tree structure for fast selections on very large datasets. You can add to the index as you add data to your dataset, so there is no need for re-indexing. However, this assumes a fixed sort order. If you want to change the sort order between many different properties and directions, then this is not a good solution. Unfortunately I have not done performance and memory comparisons between this and the lucene approach. On Wed, Nov 18, 2009 at 8:44 AM, Andreas Ronge <andreas.ro...@jayway.se>wrote: > Hi > > There is also another alternative available in Neo4j.rb (the JRuby > Neo4j wrapper) by using lucene. > In Neo4j.rb you have access to the full lucene query language. > > Examples: > Person.find(:name => 'kalle').sort_by(:salary) > Person.find("name:kalle AND salary:[10000 TO > 30000]").sort_by(Desc[:salary, :country]) > > Cheers > /Andreas > > On Wed, Nov 18, 2009 at 1:07 AM, Anders Nawroth > <and...@neotechnology.com> wrote: > > Hi! > > > >> I want to use neo4j to build a prototype of a social network > >> application because of his graph structure and I have a problem when I > >> try to filter and sort the nodes resulted from traversal. > >> For example - I want to show a list with members of a group filtered > >> by some property and ordered by another; I don't find any optimization > >> for filter/sort operations in neo. > >> > > > > Regarding filtering, my first thought goes to using ReturnableEvaluator > > when using a Traverser to find nodes. The ReturnableEvaluator decides > > which nodes should go into the result. If you need to block traversal > > beyond specific nodes or at a specific depth, have a look at the > > StopEvalutor as well. You'll find some hints on searching in Neo4j here: > > http://wiki.neo4j.org/content/Design_Guide#Search > > The evaluators are described in the core APIdocs: > > http://api.neo4j.org/current/ > > > > The structure of the node space can also be used to implement your very > > own indexing/search stuff. You can find a practical example of that here: > > http://wiki.neo4j.org/content/IMDB_Search_Engine > > > > For sorting, the simplest option is to do it in your own code. > > > > HTH! > > > > > > /anders > >> Do you have some implementation suggestions? Do you think that neo4j > >> can be used for this kind of job? > >> > >> Thank you. > >> _______________________________________________ > >> Neo mailing list > >> User@lists.neo4j.org > >> https://lists.neo4j.org/mailman/listinfo/user > >> > > > > _______________________________________________ > > Neo mailing list > > User@lists.neo4j.org > > https://lists.neo4j.org/mailman/listinfo/user > > > _______________________________________________ > Neo mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user > _______________________________________________ Neo mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user