Add the ability for a system to help inform whether a trace matches the current search term, so that the "search" function in the header can find traces based on more than just the URL.
For example:
Extend the System<T> interface to add the following (optional) function interface:
getKeywords?(context: TraceContext<T>): string[]
Update the logic which calculates the traces to display (in ApplicationContext#traces()) to, for each trace:
Determine whether the trace belongs to a specific system,
Determine whether that system has a getKeywords implementation and call it if so,
Check whether the search term can be found in the keywords returned (if applicable)
An alternative approach to consider might be to have a isSearchMatch function interface instead...
...which means that the current search term is used in a call to this and the system can return true/false based on whether the search term matches the trace
How might this be useful?
Take an example of a trace which lists product data. We might have the product ID in the URL meaning that the current search would find that trace if you type the product ID, but if it did not exist in the URL then it wouldn't. With this capability, we can expose the product ID(s) as keywords.
A further enhancement is that, if we have the trace response, we could expose some of the response data as keywords such as the name of the product, meaning that we can search by the product name and find the relevant trace(s).
Considerations
Performance will need to be considered, as we'd have to interrogate each trace to determine its system and (potential) keywords every time we update the trace list (including every time we change the search term).
Summary
Add the ability for a system to help inform whether a trace matches the current search term, so that the "search" function in the header can find traces based on more than just the URL.
For example:
Extend the
System<T>
interface to add the following (optional) function interface:Update the logic which calculates the traces to display (in
ApplicationContext#traces()
) to, for each trace:getKeywords
implementation and call it if so,An alternative approach to consider might be to have a
isSearchMatch
function interface instead......which means that the current search term is used in a call to this and the system can return true/false based on whether the search term matches the trace
How might this be useful?
Take an example of a trace which lists product data. We might have the product ID in the URL meaning that the current search would find that trace if you type the product ID, but if it did not exist in the URL then it wouldn't. With this capability, we can expose the product ID(s) as keywords.
A further enhancement is that, if we have the trace response, we could expose some of the response data as keywords such as the name of the product, meaning that we can search by the product name and find the relevant trace(s).
Considerations
Performance will need to be considered, as we'd have to interrogate each trace to determine its system and (potential) keywords every time we update the trace list (including every time we change the search term).