-
Notifications
You must be signed in to change notification settings - Fork 0
Home
In order to include the FullTextSearch-Plugin in your Rapila installation run this command
./base/scripts/include-plugin.sh full_text_search
Note: this command is executed from the project’s root directory
If you use the version control system Git, the plugin is automatically registered as a git submodule when running this command.
You also have to create the model by running the command
./base/scripts/generate-model.sh
Note: there are short cuts available for these commands if you add some code to your .bash_profile
. More info at Quicker-Script-Access
generate-model.sh
generates all the methods required for the plugin.
After code generation, please import the new plugin-related generated sql from generated/data/schema.sql
You simply have to add the following configuration to your site/config/config.yml
full_text_search:
update_secret: 'yourCustomHash'
In order to include the search input on your site, simply include an identifier in the main template(s) defined in your page(s).
{{search_form}}
This identifier is replaced by the content of the default search form template templates/search_form/default.tmpl. However you can overwrite this template by adding a custom made template site/templates/search_form/my_search_input.tmpl. Make sure that the name of your custom search input is "q".
It is generally best practice to create a dedicated search template where you can add all the content/code you want to, for example:
- add the search input again in the sidebar
- add your custom information by configuring in search page content section in the container sidebar. (e.g. explanations for wild card behaviour of the search plugin)
- add the search result to the main content container of your template
<body>
<div id="main">
{{search_results}}
</div>
<div id="sidebar">
<h2>Suchinformation</h2>
{{search_form}}
{{container=sidebar}}
</div>
</body>
If you want to use your own templates for your search result output, please overwrite the used templates in templates/search_result by adding your own in your site/templates/search_result dir
In order to include your FullTextSearch-Plugin in your site you have to
- create a new page my_search set the status hidden to true (this is not a page that visitors need to navigate to, it is used by default if the search is executed)
- set the page to Search Result (Tab: Template and page type)
- choose the search template (if you do not choose to use a dedicated template, make sure you include the identifier required to display the search result
In order to index your site you just request the following url
Path elements:
- http://yourdomain.com
- /get_file/update_search
- /en (language_id)
- ?secret=yourCustomHash
http://yourdomain.com/get_file/update_search_index/en?secret=yourCustomHash
by requesting this url the index is created and and ready to be searched.
You can automize this process by setting up a periodical cron job search_index_daily.sh
#!/usr/bin/env bash
cd "/path_to_root_dir";
curl -s -S http://yourdomain.com/get_file/update_search_index/en?secret=yourCustomHash 2>&1 | mail -s "UpdateSearchIndex-Log yourdomain.com" [email protected]