Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Form Questions /

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba

Search error on silverstripe 3.0


Go to End
Reply


3 Posts   753 Views

Avatar
Nobi

Community Member, 5 Posts

23 October 2012 at 2:17pm

Hi,

I'm using SilverStripe 3.0 in my devel site http://www.rimantoro.com/jakpus2012

Have problem with SearchForm. The search result have an error on Query, it's told "......Can't find FULLTEXT index matching the column list". I have search on API Doc for 3.0 and have no SearchForm documentation.

I have set MyISAM & FulltextSearchable::enable(); in mysite config, below

<?php

global $project;
$project = 'mysite';

global $databaseConfig;
$databaseConfig = array(
	"type" => 'MySQLDatabase',
	"server" => 'localhost',
	"username" => 'xxx',
	"password" => 'xxx',
	"database" => 'xxx',
	"path" => '',
);

MySQLDatabase::set_connection_charset('utf8');

// Set the current theme. More themes can be downloaded from
// http://www.silverstripe.org/themes/
SSViewer::set_theme('jakpus');

// Set the site locale
i18n::set_locale('en_US');

// Enable nested URLs for this site (e.g. page/sub-page/)
if (class_exists('SiteTree')) SiteTree::enable_nested_urls();

Director::set_environment_type("dev");

DataObject::$create_table_options['MySQLDatabase'] = 'ENGINE=MyISAM';

FulltextSearchable::enable();

And here is the Page.php :

<?php
class Page extends SiteTree {

	public static $db = array(
	);

	public static $has_one = array(
	);

}
class Page_Controller extends ContentController {

	/**
	 * An array of actions that can be accessed via a request. Each array element should be an action name, and the
	 * permissions or conditions required to allow the user to access it.
	 *
	 * <code>
	 * array (
	 *     'action', // anyone can access this action
	 *     'action' => true, // same as above
	 *     'action' => 'ADMIN', // you must have ADMIN permissions to access this action
	 *     'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
	 * );
	 * </code>
	 *
	 * @var array
	 */
	public static $allowed_actions = array (
	);
	
	public function init() {
		parent::init();

		// Note: you should use SS template require tags inside your templates 
		// instead of putting Requirements calls here.  However these are 
		// included so that our older themes still work
		// Requirements::themedCSS('reset');
		Requirements::themedCSS('layout'); 
		// Requirements::themedCSS('typography'); 
		// Requirements::themedCSS('form'); 
		
		Requirements::themedCSS('thirdparty');
	}
	
	function searchform() {
		$fields = new FieldList(
			new TextField("Search", false)
		);
		
		$actions = new FieldList(
			new FormAction('results', 'search')
		);
		
		return new searchform(
			$this,
			"searchform",
			$fields,
			$actions
		);
	}
	
	function results($data, $form) {
		$results = $form->getResults(null, $data);
		
		$searchQueryTitle = $form->getSearchQuery($data);
		$templateData = array(
			'Results' => $results,
			'SearchQueryTitle' => $searchQueryTitle,
			'Title' => 'Search Results'
		);
		
		return $this->customise($templateData)->renderWith(array('Page_results', 'Page'));
	} 
	
}

Did I'have something wrong ?

Thanks.

Avatar
martimiz

Forum Moderator, 1199 Posts

23 October 2012 at 11:26pm

Hi Nobi, welcome to the forums

Before anything else - it's a lot of code to read :) - did you try to mydomain.xx/dev/build/?flush=1 after setting FulltextSearchable::enable(); ?

Martine

Avatar
Nobi

Community Member, 5 Posts

24 October 2012 at 2:06am

LOL

This is my second time forget to dev/build

Thanks, its work now.