[Catalyst] Paging thru a complex POSTed search -- HOWTO?

will at serensoft.com will at serensoft.com
Wed Jun 9 15:56:40 GMT 2010


Stuart -- This sounds very intriguing.

Can you share some code or pseudocode? That would be very instructive.

Thanks!


On Wed, Jun 2, 2010 at 1:23 PM, Stuart Watt <swatt at infobal.com> wrote:

>  Actually, I'll elaborate our more detailed solution.
>
> 1. We don't actually use POST requests for search, but our GET requests
> have many fields and strange Dojo magic
> 2. We serialize the query with its many fields, using a bit of compression
> on the URI query string, and base 64 encoding, into a relatively opaque a=
nd
> relatively short token
> 3. This string is used by our search request handler, which unpacks the
> string and allows a pageable search by merging in a few additional fields
> (_page and _page_size) which are not serialized (that was underscore magi=
c).
> Because the serialized/compressed search query token is opaque and you ca=
n't
> have two searches with the same query token, we use this as a cache key
> extensively for performance.
>
> We find this works well. Also, since we have a model object for the search
> (with serialize/deserialize) we can create views on it which allows us to
> generate nice textual descriptions of the search -- very handy for user
> feedback. And our users like to keep a history using these descriptions, =
so
> they can go back and look/run previous searches.
>
> The only problem would appear to be when the URLs become excessive for a
> GET request. When this happens, the POST can handle the form, generate the
> serialized/compressed search query bundle, and then hand off to the GET
> request with that instead.
>
> One caveat we hit was Microsoft's IIS rejected path elements in URLs which
> were more than 240 characters (bytes?) even the URL was sound. It probably
> thought they might be files. So we did pass stuff as query elements, as t=
his
> seems to be more viable on Microsoft servers anyway.
>
> --S
>
> Stuart Watt
> ARM Product Developer
> Information Balance
>
> On 6/2/2010 1:56 PM, will at serensoft.com wrote:
>
> Short version:
>
>  Using [% c.req.uri_with({ page =3D> pager.next_page }) %] is fine for a
> simple single-field search (where the form uses GET instead of POST)... b=
ut
> how do we PAGE through (and/or cache) a multi-field form search that uses
> POST?
>
>  _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.u=
k/
> Dev site: http://dev.catalyst.perl.org/
>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
>


-- =

will trillich
"I think it would be worse to expect nothing than to be disappointed." --
Anne (with an 'e') Shirley
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100609/faf0c=
3d7/attachment.htm


More information about the Catalyst mailing list