search_box

An article by Gaspard Bucher

Insert a form to search.

  1. action
  2. ajax
  3. API
  4. classes
  5. common attributes
  6. conditions
  7. context
  8. dates
  9. display
    1. add_btn
    2. add_document
    3. admin_links
    4. comments_count
    5. content_lang
    6. design
    7. filter
    8. flash_messages
    9. h
    10. img
    11. javascripts
    12. mail_hide
    13. min / max
    14. search_box
    15. set
    16. show
    17. stat
    18. stylesheets
    19. summary
    20. text
    21. title
    22. uses_datebox
    23. zazen
    24. zena
  10. forms
  11. i18n
  12. meta
  13. SQLiss
  14. urls

Insert a form to search.

  • ajax (true) ajax call
  • type (text,search)
see search_results, zena 1.0

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