[Catalyst] Paging thru a complex POSTed search -- HOWTO?
Stuart Watt
swatt at infobal.com
Wed Jun 2 18:23:39 GMT 2010
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 and 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 magic). Because the serialized/compressed search query token =
is opaque and you can'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 this 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)... but 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/
> =
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100602/81dcc=
ca0/attachment.htm
More information about the Catalyst
mailing list