Finding page that contains comment/n

21 visualizações
Pular para a primeira mensagem não lida

Carlos Mendes

não lida,
14 de set. de 2014, 19:41:3014/09/2014
para rav...@googlegroups.com

I’m displaying a paged list of comments using an index.

I want to be able to link to a specific comment but the comment list is paged so I need to link to the right page number.

E.g.: I want to display the page that contains comment/45. Pagesize is 10. Some comments may have been deleted or marked as spam so I need to calculate the page number when querying.

Any recommendation on how to achieve this without streaming through all the pages until finding the comment?
Thanks in advance

Kijana Woodard

não lida,
14 de set. de 2014, 21:27:1914/09/2014
para rav...@googlegroups.com
I'm not sure I'm following.

You want someone to link directly to a particular comment?
Why only 10 per page? Comments are pretty small.

If not all at once, you might think about managing pages yourself using http://ayende.com/blog/96257/document-based-modeling-auctions-bids.

You mention that comments might be deleted. Generally for comments they might get collapsed or marked deleted, but usually some marker remains in the list.

--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Carlos Mendes

não lida,
14 de set. de 2014, 21:49:0714/09/2014
para rav...@googlegroups.com
Hi Kijana,

thank you you for your reply.

10 was just an example. Customers can configure how many comments to display per page. In any case we don't want them to show too many as this is a responsive app and loading 200 comments from the outset on mobile devices doesn't work so well.

Although I like the idea of keeping a marker in the list I'm not sure if that will work well for the end users...

Any ideas for my original problem statement?

Thanks again

Kijana Woodard

não lida,
14 de set. de 2014, 22:08:0614/09/2014
para rav...@googlegroups.com
So far, all I can think of is keeping your own index in some manner.

The auctions and bids format is essentially this, with the caveat that some "pages" may have less than a full amount with deletions (assuming you can't use markers).

Another choice is to keep a singe document with just the ids of the comments.
Another choice is to keep all the comments in one document _or_ use auctions and bids, but then have your paging logic go over the document(s) for display. 

In a bit more detail on that last option, instead of using the built in paging, have all comments in a single document (assuming there are not MBs of comments - then go auctions/bids). To page it, have the request for the desired page, load the entire document and find the relevant comments.

You could optimize that option further by using a transformer to return the relevant comments form the document.

If the comments are stable, old posts don't generally get new comments, I would lean toward the simpler approach of loading the comments document directly until there is some metric that tells me it's not working well enough.

Oren Eini (Ayende Rahien)

não lida,
15 de set. de 2014, 01:15:0015/09/2014
para ravendb
Assuming that you don't have LOTs of comments, page through the results until you find it.



Oren Eini

CEO


Mobile: + 972-52-548-6969

Office:  + 972-4-622-7811

Fax:      + 972-153-4622-7811



Carlos Mendes

não lida,
15 de set. de 2014, 07:39:2815/09/2014
para rav...@googlegroups.com
Thank you both. 

For now we will iterate the pages fetching the just the Ids with nocaching and notracking to avoid memory pressure.
Responder a todos
Responder ao autor
Encaminhar
0 nova mensagem