wintercms / wn-search-plugin

Enables full-text search capabilities in Winter.
MIT License
7 stars 2 forks source link

Allow searching of Halcyon models #4

Closed bennothommo closed 4 months ago

bennothommo commented 1 year ago

Fixes #3.

This adds the ability to search Halcyon models (ie. CMS pages, static pages). It works by using a proxy HalcyonIndex model which acts as the searchable model, collating all available records of a particular object in an arrayed model, and then hot-swaps them to the actual Halcyon records when being collated into a collection.

It still needs optimisation, in that it will always recreate the index. Ideally, we'd need to create some new functionality in Halcyon to detect the latest file modification time (preferably without opening every file) and compare it to when the database was last indexed, so that it only updates the index when the CMS files change.