Search extension AJAX-ification and other modifications

0 views
Skip to first unread message

vitali.y...@gmail.com

unread,
Aug 31, 2007, 1:57:08 PM8/31/07
to Radiant CMS: Dev
Hello everybody.

First of all thank you very much for Radiant, great job.

Couple words about me.
I'm learning Ruby and Rails and as a "lab" project decided to modify
some corporate website.

I have couple ideas for modifying search extension which I'm going to
use. So, I have done them already for my project and want to share
result in hope it will be useful for others.

1st issue - inability to use <r:search:form /> outside of SearchPage
page
I would like to be able to include search form from any other page,
layout or snippet. The main possible problem with this - tag must know
forms' action. So, instead of pulling pages URL, let's just send it as
attribute in <r:search:form action="/<url>/" />

2nd issue - hard modification of <r:search:form />
Current tag supports single attribute `label'. This makes form very
difficult to reuse. So, instead of having single <r:search:form /> I
suggest to split it into 2 parts <r:search:form />and
<r:search:form:input />. As a result to output search form you have to
put
<r:search:form action="controller_url">
<r:search:form:input />
<input type="submit" />
...
</r:search:form>

3rd - send AJAX requests while typing in form.
This idea inspired by http://apple.com Try to type "safari" in top
right field and see what happen. What I did here, with form, won't
give you complete result, but brings some background. Here is full
description of <r:search:form /> from the source
Outputs <form> element of the search form.
<r:search:form
action="controller_url"[ ajax_results="element_id"[ ajax_delay="500"]]
[exclude_pages="/url/1/,/url/2/"]>

action - url to the page of type Search that will handle
search request
ajax_results - if you want your form to be AJAX enabled, specify
ID of element that will contain search results
ajax_delay - time of inactivity before search request submitted
to the server
exclude_pages - comma separated list of page URLs to exclude from
results. Don't forget trailing slashes

Any additional parameters will be added to the tag as attributes.
If you use AJAX enabled form you can have separate page part for
displaying AJAX results. It should be called `ajax_body'.

*Usage:*
<pre><code><r:search:form action="controller_url">
<r:search:form:input />
<input type="submit" />
...
</r:search:form></code></pre>

4th issue - absence of tests
This is what I'm working on right now. I'm going to cover everything I
modified. I've finished on tags and now working on
SearchPage.render().

Thoughts? Comments?

Aitor Garay-Romero

unread,
Aug 31, 2007, 7:31:32 PM8/31/07
to radiant...@googlegroups.com

     I find your improvement ideas great.  Even if you don't receive any encourage messages go on and implement them.  That's how all good things are done.

    Now back to real life: i recommend you to copy the original search extension and call it something like "search2".  Add your improvements there.  This way it can be easily tested by other people and if the core developers decide to integrate your changes back to the original extension they shouldn't have problems creating patches from your changes (as the code based on the original extension).

    Good luck!

    /AITOR

vitali.y...@gmail.com

unread,
Sep 6, 2007, 3:56:10 PM9/6/07
to Radiant CMS: Dev
Aitor, thank you for your response, it's very supportive.
I don't understand the reason to copy original search extension
because it's available from SVN. Do core developers ever need to
create patch for my changes if I provide it?

Anyway, I finished on everything described above and created ticket in
the Trac with appropriate patch [http://dev.radiantcms.org/radiant/
ticket/523].

Any feedback would be greatly appreciate.

Drew

unread,
Oct 20, 2007, 12:16:04 PM10/20/07
to Radiant CMS: Dev
Vitali,

I've applied your patch to the original search extension, and spent
some time getting it to work. I'm delighted with the result, and
slightly amazed that your work has received so little attention on the
Radiant-Dev mailing list. I guess it boils down to a lack of
documentation. Having got this far, I would be willing to write a How-
To on the subject of enabling site-wide ajax-search, using your
modified extension. Would this be of interest to the community?

Cheers,

Drew

Aitor Garay-Romero

unread,
Oct 22, 2007, 4:10:14 AM10/22/07
to radiant...@googlegroups.com

  > Would this be of interest to the community?

   Yes, of course!

    /AITOR

nutch....@gmail.com

unread,
Oct 22, 2007, 5:03:06 AM10/22/07
to Radiant CMS: Dev
Hi Drew:

Yes, I would very much like some documentation or pointer how to
enable ajax-search. I am using 0.6.3 should I be using trunk version
of radiant for the ajax-search?

Thanks again for your help.
Suresh

Drew

unread,
Oct 23, 2007, 6:07:51 AM10/23/07
to Radiant CMS: Dev
OK, I've written a How To and posted it here:
http://wiki.radiantcms.org/Using_the_Search_Extension

Please let me know if you have any trouble following it.

Cheers,

Drew

Reply all
Reply to author
Forward
0 new messages