Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add belongs_many_many support to search field scaffolding #357

Open
LeviWB opened this issue Feb 27, 2024 · 2 comments
Open

Add belongs_many_many support to search field scaffolding #357

LeviWB opened this issue Feb 27, 2024 · 2 comments

Comments

@LeviWB
Copy link

LeviWB commented Feb 27, 2024

Dataobjects with $many_many fields can be easily added to a search index by adding the field in the init() method of a search index

e.g.

public function init()
{
    $this->addClass(MyClass::class);

    $this->addFilterField('MyManyManyField.ID');
}

It would be handy if this also worked with $belongs_many_many fields.

I've had a look into this and one way to support this would be to make the following change to the fieldData() method in SilverStripe\FullTextSearch\Search\Indexes\SearchIndex:

Replace

$relationList = Config::inst()->get($dataclass, 'many_many', Config::UNINHERITED);

with

$relationList = array_merge(
    Config::inst()->get($dataclass, 'many_many', Config::UNINHERITED) ?? [],
    Config::inst()->get($dataclass, 'belongs_many_many', Config::UNINHERITED) ?? [],
);

I'm happy to create a pull request for this if it sounds reasonable.

@GuySartorelli
Copy link
Member

New features aren't being added to this module by the CMS Squad, as it isn't commercially supported for the Silverstripe CMS 5.x release line.

If you'd like to implement this as a PR it's possible someone will see it and review it, but there are no guarantees.

If you'd like to get access to maintain this module you can email [email protected] and request access.

Alternatively you could look at using https://codeberg.org/Firesphere/silverstripe-solr which is maintained by a community member and has a migration path for projects that are currently using this module.

@michalkleiner
Copy link
Contributor

Happy to review a PR ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants