silverstripe / silverstripe-search-service

A service-agnostic search module for Silverstripe CMS
BSD 3-Clause "New" or "Revised" License
5 stars 18 forks source link

Dataobjects using SearchServiceExtension become unindexed upon upgrading #99

Closed lukereative closed 4 months ago

lukereative commented 4 months ago

Module version(s) affected

3.0.3

Description

There was a fairly recent change (v3.0.3) that added a 'ShowInSearch' field to the SearchServiceExtension. The change also had a $defaults definition to default the value to true, however this only works for new records not existing ones.

Consequently for anyone upgrading existing projects, any DataObject (excluding SiteTree based ones) that uses this extension would have the 'ShowInSearch' column added and any existing records would use the database default of 0 which causes them all to become unindexed upon a full reindex.

How to reproduce

  1. Have a project using 3.0.2 of this module or earlier and a dataobject with the SearchServiceExtension applied.
  2. Create one or many of those dataobjects
  3. Upgrade the module to 3.0.3
  4. Run dev/build
  5. Those dataobjects now have 'ShowInSearch' set to 0
  6. Run a full reindex, data object are removed from the index

Possible Solution

I've provided a fix in #98

Additional Context

No response

Validations

lukereative commented 4 months ago

Fix was merged and tagged in 3.0.4