Jump to:

10977 Posts in 2720 Topics by 1815 members

All other Modules

SilverStripe Forums » All other Modules » MSSQL Full Text Search on Page Classname

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 317 Views
  • donsimpson66
    Avatar
    Community Member
    1 Post

    MSSQL Full Text Search on Page Classname Link to this post

    I am new to SS and have SS 3.0.5 running on IIS 7 and MSSQL. I enabled the full text search but it was not searching any items in the SiteTree with the Classname of Page. Searches on other classes works fine just not on Page. The only reference I could find to this was this post http://www.silverstripe.org/general-questions/show/18319 . I was able to use this to find where the query is made in the mssql module and on line 1366 of MSSQLdatabase.php.

    I changed this line from

    $queries[$tableName]->addWhere("\"$baseClass\".\"ClassName\" IN ('".implode($allClassesToSearch, "', '")."')");

    to this

    $queries[$tableName]->addWhere("\"$baseClass\".\"ClassName\" IN ('Page','".implode($allClassesToSearch, "', '")."')");

    and now the search works for Page.

    I don't think is the proper correction for this but I don't know if this an MSSQL only problem. I traced the problem back to the ClassInfo.php file in framework/core.

    /**
        * Returns an array of the current class and all its ancestors and children
        * which have a DB table.
        *
        * @param string|object $class
        * @todo Move this into data object
        * @return array
        */
    public static function dataClassesFor($class) {
          $result = array();

          if (is_object($class)) {
             $class = get_class($class);
          }

          $classes = array_merge(
             self::ancestry($class),
             self::subclassesFor($class));

          foreach ($classes as $class) {
             if (self::hasTable($class)) $result[$class] = $class;
          }

          return $result;
       }

    Page is the only classname in SiteTree that does not have a table and thus it not being passed into the query.

    317 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.