In a scenario where the Advanced Search Box is accompanied by a “Execute Search” button, if the user enters some string in to a search parameter and clicks the “Execute Search” button before the searchThrottleTime expires then the model used for searching will not be the same as that entered by the user.
Proposed Solution
As a temporary solution to support the current application, I extracted out the changeBuffer array as a separate factory and provided a flushBuffer() method so that the application controller can take it as a dependency and call it to flush the buffer before using the model for searching.
Please see the attached code.
Any comments are appreciated. [Hope I didn’t miss an obvious alternate solution]
AdvancedSearchBoxModified.txt