Jump to:

3372 Posts in 998 Topics by 712 members

Data Model Questions

SilverStripe Forums » Data Model Questions » searchable_fields with DataObject / ModelAdmin

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

Page: 1
Go to End
Author Topic: 795 Views
  • Sarajin
    Avatar
    Community Member
    1 Post

    searchable_fields with DataObject / ModelAdmin Link to this post

    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!

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