Re: [Neo4j] Pagination in Embedded

2011-07-30 Thread Mattias Persson
And there's a tiny test in
https://github.com/neo4j/community/blob/master/kernel/src/test/java/org/neo4j/helpers/collection/TestCommonIterators.java#L146

2011/7/30 Jim Webber j...@neotechnology.com

 There's JavaDoc here:


 http://api.neo4j.org/current/org/neo4j/helpers/collection/PagingIterator.html

 Jim
 ___
 Neo4j mailing list
 User@lists.neo4j.org
 https://lists.neo4j.org/mailman/listinfo/user




-- 
Mattias Persson, [matt...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Pagination in Embedded

2011-07-29 Thread Mattias Persson
The PagingIterator caches the results lazily going forward with the ability
to go back through the pages. Going forward again will return cached values
as far as possible and then go down to the real iterator again when the end
of the cache is reached. So it will not cache the entire result up front. It
will probably not impose any performance problems/differences.

2011/7/27 Jim Webber j...@neotechnology.com

 Hi John,

 OK, gotcha. I didn't realise there's a network hop in there too.

 Go ahead on use the PagingIterator.

 Jim
 ___
 Neo4j mailing list
 User@lists.neo4j.org
 https://lists.neo4j.org/mailman/listinfo/user




-- 
Mattias Persson, [matt...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Pagination in Embedded

2011-07-29 Thread rudi
This thread is very interesting for me because I have similar scenario. I’m
using neo4j in embedded mode in web application. Web application doesn’t
have an application session – it’s stateless (no way to store pointers to
iterators). And I need to find nodes and make paging for results (too many
results). I can’t make some more specific search pattern to find less
result, I really need all these results but I need them in pages.
If I understand correctly I can use *PagingIterator class* by this way: I’ll
seed to page N (method page(int newPage)) and iterate thru iterator for this
page (iterator returned by method newPage). 
*Question 1:* I can use PagingIterator for traditional paging system: give
me results for page N with no impact on performance because results for not
used pages are not cached – correct?
*Question 2: *There is only one impact on performance that I’m searching in
index for every page – correct?
*Question 3: *What about default sorting of search result? Result for every
search request will be returned in the same order? I don’t want to use any
sorting rule. I afraid that second query will return result in different
order and ma paging system will be incorrect. Yes I know I can test this but
I need to be sure if this will work every time not only for my few tests. My
question is how this result is sorted by default.

--
View this message in context: 
http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-Pagination-in-Embedded-tp3202018p3209605.html
Sent from the Neo4j Community Discussions mailing list archive at Nabble.com.
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Pagination in Embedded

2011-07-29 Thread Jim Webber
Now that is interesting - I hadn't considered this when writing the REST paging 
stuff.

When you say that the PagingIterator caches, what's the memory overhead 
involved, particularly when I want to page backwards through a potentially 
large result set?

Jim
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Pagination in Embedded

2011-07-29 Thread noppanit
Is there any example of using PagingIterator? Thanks

--
View this message in context: 
http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-Pagination-in-Embedded-tp3202018p3210956.html
Sent from the Neo4j Community Discussions mailing list archive at Nabble.com.
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Pagination in Embedded

2011-07-27 Thread Jim Webber
Hi John,

In an embedded scenario, pagination doesn't make as much sense. Since calls to 
the embedded APIs typically return a lazily-evaluatable iterableT you just 
call next() to efficiently advance through the results.

Jim
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Pagination in Embedded

2011-07-27 Thread noppanit
Hi, I'm using the embedded version as well and about to implement pagination.
Could I use
http://api.neo4j.org/current/org/neo4j/helpers/collection/PagingIterator.html
this helper to achieve that? but that also means it will return everything
and cache that to be called nextPage()? 

Also what implementation of neo4j would be better in this scenario?

Thanks. 
T

--
View this message in context: 
http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-Pagination-in-Embedded-tp3202018p3203156.html
Sent from the Neo4j Community Discussions mailing list archive at Nabble.com.
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Pagination in Embedded

2011-07-27 Thread John cyuczieekc
Looks like John H. means, how do you get all results for page N and only for
page N ? without the overhead of getting thru all other results; so far, as
I understand it (also from what Jim said), you'll have to parse all the
results for all pages prior to page N, to get to page N, but not the results
after page N.

On Wed, Jul 27, 2011 at 9:53 AM, Jim Webber j...@neotechnology.com wrote:

 Hi John,

 In an embedded scenario, pagination doesn't make as much sense. Since calls
 to the embedded APIs typically return a lazily-evaluatable iterableT you
 just call next() to efficiently advance through the results.

 Jim
 ___
 Neo4j mailing list
 User@lists.neo4j.org
 https://lists.neo4j.org/mailman/listinfo/user

___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Pagination in Embedded

2011-07-27 Thread John Howard
My scenario is: If there 1000 results from an index query, I would like to
send 100 at a time to the requesting client(ie, browser).
Which means browser will make 10 calls to get all the results by passing
either the page number or the next start result(ie, 11, 21, 31 etc) in each
call.

It looks like the PagingIterator seems to fit my scenario.
Does the neo4j team recommend using the PagingIterator for this purpose?

Appreciate all the responses.

John


On Wed, Jul 27, 2011 at 8:58 AM, John cyuczieekc cyuczie...@gmail.comwrote:

 Looks like John H. means, how do you get all results for page N and only
 for
 page N ? without the overhead of getting thru all other results; so far, as
 I understand it (also from what Jim said), you'll have to parse all the
 results for all pages prior to page N, to get to page N, but not the
 results
 after page N.

 On Wed, Jul 27, 2011 at 9:53 AM, Jim Webber j...@neotechnology.com wrote:

  Hi John,
 
  In an embedded scenario, pagination doesn't make as much sense. Since
 calls
  to the embedded APIs typically return a lazily-evaluatable iterableT
 you
  just call next() to efficiently advance through the results.
 
  Jim
  ___
  Neo4j mailing list
  User@lists.neo4j.org
  https://lists.neo4j.org/mailman/listinfo/user
 
 ___
 Neo4j mailing list
 User@lists.neo4j.org
 https://lists.neo4j.org/mailman/listinfo/user

___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Pagination in Embedded

2011-07-27 Thread Jim Webber
Hi John,

OK, gotcha. I didn't realise there's a network hop in there too.

Go ahead on use the PagingIterator.

Jim
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] Pagination in Embedded

2011-07-26 Thread John Howard
Hello,

Is there an example or documentation on how to achieve pagination when using
the embedded version?
Typically, if there are large search results from an index query we would
like to paginate these results across multiple browser requests.

TIA,

John
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user