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, Ed, biapar, Willr, Ingo, swaiba

Extending SearchForm.php for working with extended page classes

Go to End

2 Posts   1622 Views


Community Member, 121 Posts

24 August 2010 at 5:23am

Has any had any success extending the built in search engine, i.e. searchForm.php? I have an extension of Page which has extra content areas which the user can update in the CMS. The search engine doesn't look for anything other than the standard variables in sitetree as can be seen in the file \sapphire\core\model\MySQLDatabase.php and the public function searchEngine.

I tried editing it and haven't found a way to make it work without coming up with a harsh sql error.

[User Error] Couldn't run query: SELECT count(*) FROM "SiteTree_Live" WHERE ("SiteTree_Live"."ClassName" IN ('TripleColumnPage','HomeRSSAggregatingPage','TestimonialsPage')) AND ( MATCH (ColumnOne,ColumnTwo,ColumnThree,BottomContent) AGAINST ('tewst*' IN BOOLEAN MODE) + MATCH (ColumnOne,ColumnTwo,ColumnThree,BottomContent) AGAINST ('tewst*' IN BOOLEAN MODE) ) Unknown column 'ColumnOne' in 'where clause'
GET /searchpage/SearchForm?Search=tewst+&action_SynergyResults=Search

Line 536 in /home/kathyw/public_html/synergy_silverstripe_blank_dev/sapphire/core/model/MySQLDatabase.php

I can see that where sapphire is trying to create the SQL term it is having trouble joining the two database tables. Has anybody had any luck extending the search form in this way?

I have used Symfony framework and with that there is an option to bring up the SQL query on screen to help with debugging. does anyone know of such a query with silverstripe.


Community Member, 121 Posts

27 August 2010 at 11:29am

okay I have since found this post which is more sophisticated and established idea,