Hi Luke,
My aim is to create a consistent filter for content which does not have consistent metadata and which often doesn't have expressive URLs. For example, I want to filter documents relating to 'Research' where this concept is exposed in my content as more than a dozen different metadata keys and URLS. The inconsistent URL patterns prevents me from using gscopes.
The way that I thought I'd solve this problem is by appending a consistent metadata key to the query response. The documentation says:
Post-datafetch: (hook_post_datafetch.groovy) This runs immediately after the response object is populated based on the raw XML return, but before other response elements are built. This is most commonly used to modify underlying data before the faceted navigation is built.
You can see why I've tried to use the Post-datafetch hook script. I have also used external metadata for some keys which don't exist in content.
The way that I think you're pointing is that I need to alter the index before the query runs. I'm not clear whether the script should run against the cached documents, the index is built, or as a step before the query is processed. It would be most efficient to alter the index or cached documents.
Next on my list to read is document filtering.
Thanks,
Will