Jump to:

1970 Posts in 1275 Topics by 607 members

Form Questions

SilverStripe Forums » Form Questions » Search error on silverstripe 3.0

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

Page: 1
Go to End
Author Topic: 384 Views
  • Nobi
    Avatar
    Community Member
    5 Posts

    Search error on silverstripe 3.0 Link to this post

    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.

  • martimiz
    Avatar
    Forum Moderator
    1035 Posts

    Re: Search error on silverstripe 3.0 Link to this post

    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

  • Nobi
    Avatar
    Community Member
    5 Posts

    Re: Search error on silverstripe 3.0 Link to this post

    LOL

    This is my second time forget to dev/build

    Thanks, its work now.

    384 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.