Functional concerns
- A limit is defined in tracker.inc to define how many artifacts are "too many" when trying to filter using at least one computed field. This limit is arbitrary set to 100.
- Computed fields are available in search criteria only in normal mode (not in Tracker Query Language)
- There is a way to distinguish Computed fields in the search criteria so people are aware that the behaves differently and have some limitations (UI/mockup needed)
- Error handeling
- When the initial -SQL- search returns more artifacts than what is defined by the limit no results are returned and an error message tell users that they must refine there non computed fields search criteria with the number of matching artifacts w/o computed fields & the threshold (UI/mockup needed). In addition to that, this error is logged in tracker.log
- All tracker logs (this new one, workflow, email gateway, etc) are centralized in a new tracker.log with truncation & log rotation.
Please note that all this (esp. limit) was thought with 1 computed field in mind. It's very likely that is a tracker admin with tens of computed fields on a report with very deep hierarchy is going to be hit by a major slowdown, a fatal error or a blank page (and probably the 3, one after another). This is not covered by this story.
Technical concerns
Computation
- The filter on computed field must be done only after the other search criteria are done
How to avoid heavy computations ?
There are no ways to do the filtering at SQL side as the value must be computed in PHP. The global idea is to leverage the computation that is done for rendering and to filter out based on that. The rational is that if we can display the value, we can apply a filter on it.
There might a threshold on the max number of artifacts a query can contain before computing computed fields. This might even be a good idea for current "display only" situation. Let say that the threshold is 100, computed fields values wouldn't be computed (neither for display nor for search) if the query, without the computed field part, has more than 100 results.