Search terms in URL

I have set up a ferret search using the examples in the demo app. Is it
possible to have the search terms included in the URL, so that, for
example, users can bookmark a search results page ?

Chris

On Sun, Jul 09, 2006 at 05:51:27PM +0200, Chris L. wrote:

I have set up a ferret search using the examples in the demo app. Is it
possible to have the search terms included in the URL, so that, for
example, users can bookmark a search results page ?

sure, setting the search form’s method to ‘get’ should do the trick.

Jens


webit! Gesellschaft für neue Medien mbH www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer [email protected]
Schnorrstraße 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66

sure, setting the search form’s method to ‘get’ should do the trick.

Thank you for taking the time to respond. I now have

<%= form_tag :action => ‘search’, :method => ‘get’%>

Search by street name, or zip code <%= submit_tag 'search' %> <%= end_form_tag %>

<% if @results -%>

<% end -%>

in my view. However the URL generated after search looks like :

http://localhost:3000/residence/search?method=get

and doesn’t contain the search terms. Any suggestions ?

Kind regards,

Chris

Jens K. wrote:

try

<%= form_tag { :action => ‘search’ }, :method => ‘get’ %>

instead. this explicitly tells ruby where the first hash argument
(url_for_options) to form_tag ends, all following arguments then
will be aggrgated into the second optional argument to form_tag,
options:

Thank you Jens. In the end I had to call form_tag with () like so :
<%= form_tag( { :action => ‘search’}, :method => ‘get’) %>

but it now works,

Chris

On Mon, Jul 10, 2006 at 09:39:45PM +0200, Chris L. wrote:

sure, setting the search form’s method to ‘get’ should do the trick.

Thank you for taking the time to respond. I now have

<%= form_tag :action => ‘search’, :method => ‘get’%>

try

<%= form_tag { :action => ‘search’ }, :method => ‘get’ %>

instead. this explicitly tells ruby where the first hash argument
(url_for_options) to form_tag ends, all following arguments then
will be aggrgated into the second optional argument to form_tag,
options:

form_tag(url_for_options = {}, options = {}, *parameters_for_url)

Jens


webit! Gesellschaft für neue Medien mbH www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer [email protected]
Schnorrstraße 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66