Fork me on GitHub

search_box

An article by Gaspard Bucher

Insert a form to search.

Insert a form to search.

  • ajax (true) ajax call
  • type (text,search)

Display a form with a text field to do fulltext search on the whole site:

<r:search_box/>

The result appears on the index node, in +search mode. The results can be displayed in the template by using search_results.

A search with basic ajax (results unfold under the search field):

<r:search_box ajax='true'/>

styling

This tag inserts a div with of class ‘search’ containing the form and input field. If you use ‘ajax’, it also adds two div with dom id ‘search_loader’ and ‘search_results’.

advanced search

If you need more advanced searching, you should use SQLiss with a live filter:

<r:filter update='doc_search' key='f' live='true'/>
...
<div id='doc_search' do='block'>
  <ul do='documents where fulltext match #{params[:f]} in project'>
    <li do='each' do='link'/>
  </ul>
</div>

The pseudo-sql query:

documents where fulltext match #{params[:f]} in project