[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tapestry-user
Subject:    VS: How to use grid with large data sets.
From:       "Ville Virtanen" <ville.virtanen () orientimport ! fi>
Date:       2014-01-17 15:16:59
Message-ID: 001801cf1397$2b0374f0$810a5ed0$ () orientimport ! fi
[Download RAW message or body]

The griddatasource is natural fit for sql databases, but
lucene/solr/elasticsearch etc. may not fit it 100% 

That said, you can access the current page of the grid that is selected
(grid. getCurrentPage()) and rowsPerPage (grid. getRowsPerPage())  and do
the math yourself to be able to pull in correct content in the first place.

Tapestry uses the total amount of rows available to only make sure, that the
selected page is not out of the range of possible pages, and that the end
index is never more than there actually are rows. (The last page may not be
full.)

Ville

-----Alkuperäinen viesti-----
Lähettäjä: George Christman [mailto:gchristman@cardaddy.com] 
Lähetetty: 17. tammikuuta 2014 15:49
Vastaanottaja: Tapestry users
Aihe: Re: How to use grid with large data sets.

I wouldn't say it's premature optimization when I'm essentially performing
two of the exact same free text queries, it's twice the work ;-) My company
is hosting our dev database remotely on awful hardware to help us to find
performance issues. They believe if we can make something fast on dev, it
will be lighting fast in production, so everything counts lol.

Now if I understand GridDataSource correctly, you need to return the count
in availableRows() before the prepare() method can be called, is this
correct? If that is the case, I'm not sure how to go about combining this
into a single query do to the fact I would first need to get the count
before prepare is called to pass in the start / end index.

hibernate-search, which is based on the lucene free text search engine will
return the total filtered result count while only returning the pagination
results. When using the Tap5 loop component, I typically just return an
object containing the total count and an array list of the results, but
seeing the prepare is called secondly, I'm not sure how to do this. I guess
worse case I can just do two queries.



On Thu, Jan 16, 2014 at 5:51 PM, Lance Java
<lance.java@googlemail.com>wrote:

> If there's a concept in lucene that allows you to bring back the total 
> rowcount and a page of data in a single query then the GridDataSource 
> interface can support that.
>
>
> On 16 January 2014 22:36, Lance Java <lance.java@googlemail.com> wrote:
>
> > One query is for the rowcount, the other is for the results (for a 
> > single page).
> > The only way to do it with one query is to add an extra column to 
> > the result set for the row count. This value will be exactly the 
> > same for
> every
> > row in the result set.
> >
> > I personally don't see an issue with 2 queries... premature 
> > optimisation perhaps ;)
> >
> >
> > On 16 January 2014 20:23, George Christman <gchristman@cardaddy.com
> >wrote:
> >
> >> I found the following documentation
> >>
> >> http://wiki.apache.org/tapestry/Tapestry5HibernateGridDatasource2
> >>
> >> However I'm still a little confused, I'm seeing two queries needed 
> >> to
> get
> >> this to work, one containing the filtered results to get the
> availableRow
> >> count
> >> and the second one to get the prepare filtered result set 
> >> containing startindex / endindex for get getRowValue();
> >>
> >> With my hibernate search service, I'm able to get everything in a 
> >> single query, is there anyway to do this in a single query?
> >>
> >>
> >> On Thu, Jan 16, 2014 at 2:48 PM, George Christman
> >> <gchristman@cardaddy.com>wrote:
> >>
> >> > So I'm playing with the GridDateSource and was wondering how you 
> >> > are suppose to get the filtered result count for availableRows()? 
> >> > With hibernate search you get this count after the results have 
> >> > been
> >> filtered,
> >> > but the way the methods are called in GridDataSource, the
> availableRows
> >> > method is called before prepare.
> >> >
> >> > The next question is how do you get your filters back to 
> >> > GridDataSouce prepare? I'm wondering if I'm going about this the
right way.
> >> >
> >> > Example I'm working from
> >> >
> >> >
> >>
> http://jumpstart.doublenegative.com.au/jumpstart/examples/tables/gridd
> atasources
> >> >
> >> >
> >> > On Thu, Jan 16, 2014 at 12:26 PM, George Christman < 
> >> > gchristman@cardaddy.com> wrote:
> >> >
> >> >> I guys, thanks for the help, I'm using hibernate-search with lucene.
> >> >>
> >> >>
> >> >> On Thu, Jan 16, 2014 at 12:10 PM, Ville Virtanen < 
> >> >> ville.virtanen@orientimport.fi> wrote:
> >> >>
> >> >>> Hi,
> >> >>>
> >> >>> here is one example:
> >> >>>
> >> >>>
> >> >>>
> >>
> http://jumpstart.doublenegative.com.au/jumpstart7/examples/tables/grid
> dataso
> >> >>> urces
> >> >>>
> >> >>> Ville
> >> >>>
> >> >>> -----Alkuperäinen viesti-----
> >> >>> Lähettäjä: George Christman [mailto:gchristman@cardaddy.com]
> >> >>> Lähetetty: 16. tammikuuta 2014 18:34
> >> >>> Vastaanottaja: Tapestry users
> >> >>> Aihe: How to use grid with large data sets.
> >> >>>
> >> >>> Hello, I'm wondering how to use the grid component with large 
> >> >>> data
> >> sets.
> >> >>> Currently the grid is grabbing the entire data set rather than 
> >> >>> a sub
> >> set.
> >> >>> How do I pass back the current page and row count as well as 
> >> >>> the
> >> sorts?
> >> >>> Can
> >> >>> this be done with the grid component, or would I need to builds
> >> something
> >> >>> custom with a loop?
> >> >>>
> >> >>> --
> >> >>> George Christman
> >> >>> www.CarDaddy.com
> >> >>> P.O. Box 735
> >> >>> Johnstown, New York
> >> >>>
> >> >>>
> >> >>>
> ---------------------------------------------------------------------
> >> >>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> >>> For additional commands, e-mail: users-help@tapestry.apache.org
> >> >>>
> >> >>>
> >> >>
> >> >>
> >> >> --
> >> >> George Christman
> >> >> www.CarDaddy.com
> >> >> P.O. Box 735
> >> >> Johnstown, New York
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> > George Christman
> >> > www.CarDaddy.com
> >> > P.O. Box 735
> >> > Johnstown, New York
> >> >
> >> >
> >>
> >>
> >> --
> >> George Christman
> >> www.CarDaddy.com
> >> P.O. Box 735
> >> Johnstown, New York
> >>
> >
> >
>



--
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic