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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

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

searchable_fields with DataObject / ModelAdmin


Go to End


1550 Views

Avatar
Sarajin

Community Member, 1 Post

6 May 2010 at 4:08am

Edited: 06/05/2010 4:10am

Hi,

Forgive me if there is a better location to post this question or if it may have been answered some time in the past. I tried searching but can't find an answer to it.

If I have a DataObject for tracking purposes that has no $db component, just 3 $has_one components, roughly like:

Location (which is an object that inherits from Page)
Trial (which is an object that inherts from Page)
member (which is an object that inherits DataObject)

I create a new one of these tracking objects at certain points and write them to the database manually.

On the customer end, It is used mainly for searching the data on the various fields. Now this dataobject works perfectly fine
everywhere except for searching through ModelAdmin.

So far, the main search items are the Title fields from the two"Page' inherited objects and some fields from the other. When trying to run the search for say: Location of "Mars", I get this error... this happens with either of the Page inherited objects.

- SELECT DISTINCT COUNT(DISTINCT Tracking.ID) AS TotalCount
- FROM `Tracking`
- LEFT JOIN `Location` ON `Location`.`ID` = `Tracking`.`LocationID`
- WHERE (`SiteTree`.`Title` LIKE '%mars%')

- Unknown column 'SiteTree.Title' in 'where clause'

I can see why there is an error as SiteTree isn't being joined into the Query.

Is this fixable which some simple setting/methodcall?

Thanks!