Hello, in the tutorial 4 described how to create search form, but this is form searches around all DB, i found this recipe:
http://doc.silverstripe.org/recipes:removingassetsfromsearch?s[]=getsearchquery
But it looks very dirty and results counting variables are staying the same.
So after reading silverstripe api, i found out that i can use FulltextSearchable::enable($class_names_array), but after adding it to the mysite/_config.php I got error on http://localhost/stable/dev/build?flush=1:
Fatal error: Uncaught exception 'Exception' with message 'FulltextSearchable::enable() I don't know the default search columns for class 'Page'' in /home/a2nt/work/www/stable/sapphire/search/FulltextSearchable.php:25 Stack trace: #0 /home/a2nt/work/www/stable/mysite/_config.php(48): FulltextSearchable::enable('Page') #1 /tmp/silverstripe-cache-home-a2nt-work-www-stable/manifest-main(6783): require_once('/home/a2nt/work...') #2 /home/a2nt/work/www/stable/sapphire/core/ManifestBuilder.php(66): require_once('/tmp/silverstri...') #3 /home/a2nt/work/www/stable/sapphire/core/Core.php(205): ManifestBuilder::include_manifest() #4 /home/a2nt/work/www/stable/sapphire/main.php(61): require_once('/home/a2nt/work...') #5 {main} thrown in /home/a2nt/work/www/stable/sapphire/search/FulltextSearchable.php on line 25
So I added to mysite/code/Page.php
class Page extends SiteTree {
..
static $indexes = array(
"SearchFields" => "fulltext (Title, MenuTitle, Content, MetaTitle, MetaDescription, MetaKeywords)",
"TitleSearchFields" => "fulltext (Title)",
"Sort" => true,
"Uniques" => "Unique('URLSegment')",
);
static $searchable_fields = array(
'Title',
'Content',
);
..
But still I have that error, also I am interested in creation different types of search forms for example to search only in StaffPage classes.