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

FullText Filter and Joins


Go to End


2 Posts   937 Views

Avatar
Mo

Community Member, 541 Posts

10 January 2015 at 4:01am

Hi All,

I am working on a module that builds on the default Silverstripe FullTextSearch functionality, but allows you to search any data object.

Problem I am having is that if I have a DataObject, for example:

class BaseProduct extends DataObject {
    static $db = array(
        "Title" => "Varchar",
        "Content" => "HTMLText"
    );
}

If I use BaseProduct::get()->filter("Title:FullText", "Some string"); then the filter works without error.

If I extend BaseProduct, for example:

class Product extends BaseProduct {
    static $db = array(
        "SKU" => "Varchar"
    );
}

I then use

Product::get()
    ->filter(array(
        "Title:FullText" => "Some string",
        "SKU:FullText" => "Some string"
    ));

Then I get an error, it looks like Product isn't joining properly to the BaseProduct (parent) object. Anyone had this issue? Any ideas what might be going on?

Cheers in advance.

Mo

Avatar
Mo

Community Member, 541 Posts

10 January 2015 at 4:02am