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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Search - Case sensitivity


Reply

4 Posts   1459 Views

Avatar
FullWebService

8 May 2010 at 11:50pm (Last edited: 9 May 2010 11:12pm), Community Member, 38 Posts

I'm using a basic search form with SS2.4 with the following code:

   function SearchForm() {
      $searchText = isset($_REQUEST['Search']) ? $_REQUEST['Search'] : 'Search';
      $fields = new FieldSet(
       new TextField("Search", "", $searchText)
       );
      $actions = new FieldSet(
       new FormAction('Results', 'Search')
       );

       return new SearchForm($this, "SearchForm", $fields, $actions);
   }
   
   function Results($data, $form){
      $data = array(
       'Results' => $form->getResults(),
       'Query' => $form->getSearchQuery(),
       'Title' => 'Zoek resultaten'
       );
      return $this->customise($data)->renderWith(array('Page_results', 'Page'));       
   }

With that I get te following error:

[User Error] Couldn't run query: SELECT ClassName, "SiteTree_Live".ID, ParentID, Title, MenuTitle, URLSegment, Content, LastEdited, Created, _utf8'' AS Filename, _utf8'' AS Name, MATCH (Title, MenuTitle, Content, MetaTitle, MetaDescription, MetaKeywords) AGAINST ('test') + MATCH (Title, MenuTitle, Content, MetaTitle, MetaDescription, MetaKeywords) AGAINST ('test') AS Relevance, CanViewType FROM "SiteTree_Live" WHERE ( MATCH (Title, MenuTitle, Content, MetaTitle, MetaDescription, MetaKeywords) AGAINST ('test*' IN BOOLEAN MODE) + MATCH (Title, MenuTitle, Content, MetaTitle, MetaDescription, MetaKeywords) AGAINST ('test*' IN BOOLEAN MODE) AND ShowInSearch 0) UNION SELECT ClassName, "File".ID, _utf8'' AS ParentID, Title, _utf8'' AS MenuTitle, _utf8'' AS URLSegment, Content, LastEdited, Created, Filename, Name, MATCH (Filename, Title, Content) AGAINST ('test') AS Relevance, NULL AS CanViewType FROM "File" WHERE (MATCH (Filename, Title, Content) AGAINST ('test*' IN BOOLEAN MODE) AND ClassName = 'File') ORDER BY Relevance DESC LIMIT 0, 10 Can't find FULLTEXT index matching the column list

I don't really have any more info, as I simply don't get it. Can anyone give me a hand?

TIA.

Avatar
ajshort

9 May 2010 at 1:22am Community Member, 244 Posts

http://doc.silverstripe.org/upgrading:2.4.0#fulltext_search_and_indexes_disabled_by_default

Avatar
FullWebService

9 May 2010 at 2:07am Community Member, 38 Posts

Oh, bloody hell...

Thanks so much!

Avatar
FullWebService

9 May 2010 at 11:13pm Community Member, 38 Posts

Ok, new search issue.

I noticed that the search is case sensitive. Is there a way around this?