I have implemented a search form in Zend ( SOLR in the backend ).
To offer the user some more control I have added a multicheckbox for applying certain content filters.
The thing is in the following steps ( bear with me here ):
-
The request is made, something similar to
/search/?q=bla&filter=1 -
The request is rewritten in the controller to be restful to:
/search/query/bla/filter/1 -
If the user removes filter 1, adds filter 2 and submits the request becomes:
/search/query/bla/filter/1?q=bla&filter=2
How would I properly create a restful request using that. The problem being here that using the getRequest() functionality of the Controller I will also get a value for the first filter, meaning I have no way of knowing which one I can discard.
So, to summarize:
How do I properly use a Zend_Form to create RESTful HTTP requests
IMO, you’re trying to solve an inexistent problem. You’re working on aesthetics not RESTful compliance.
REST tells that you need to identify resources, not that you’re resource links should look nice (well in a way). But since your search is a kind of a filter, it is totally acceptable to use a QueryParam.
I think, your use of the term “search” within REST is wrong. Search is not a resource (at least in your case).
You should either hide the search implementation by doing something like:
The way you construct your filters criteria should not matter.
Or you may want to define a “search” as a resource (SO actually does that IIRC).
Would result in something like:
Where
a125f41fbc135dis the identifier of the search which would be used to identify the search resource.