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

Site Search including Dataobjects


Reply


5 Posts   468 Views

Avatar
cumquat

Community Member, 198 Posts

16 August 2013 at 1:45am

Edited: 22/08/2013 10:49pm

Hi there,

Been trying to find the best way to integrate some dataobject fields in the Fulltext site search. I'm using 3.1 rc1 and the site is hosted on a shared hosting site so no access to install services (like solr) adding modules is fine.

Looking at the documentation for 3.1 regarding search it seems to intimate that by adding

private static $create_table_options = array(
'MySQLDatabase' => 'ENGINE=MyISAM'
);


to a data object that it will be included in the fulltext site search. (granted i may be reading/understanding it wrong)

info is here http://doc.silverstripe.org/framework/en/3.1/topics/search

Regards

Mick

Avatar
cumquat

Community Member, 198 Posts

20 August 2013 at 10:50pm

Bump?

Anyone my lack of experience is starting to show again trying to deal with searching on the site, i'd like to not have multiple search boxes. Any help?

Mick

Avatar
cumquat

Community Member, 198 Posts

22 August 2013 at 9:52am

bump bump..

Avatar
Mo

Community Member, 514 Posts

22 August 2013 at 10:54pm

I have done this in the past by overwriting the default search method on your controller to search for both page objects and other dataobjects.

I then merged the results sets into one DataObjectSet (this was in SS 2.1) and then returned that to the results page.

It is important though that your returned objects have properties that mirror a page object (title, content, link,etc). Otherwise it can cause issues in the search results (and merging the object sets).

I did write a tutorial for 2.1 here: http://www.i-lateral.com/tutorials/extending-fulltextsearch-for-dataobjects/

I don't think you would need to do a load of work to get it running on 3.

Cheers,

Mo

Avatar
cumquat

Community Member, 198 Posts

30 August 2013 at 7:06pm

Thanks for your help Mo, much appreciated.
I still never really managed to get it working confidently but it looks like i'm not getting the job i needed it for now so im giving this a rest till i get some spare time to try and work it out again.

Cheers

Mick