Intermittently, this doesn't work because there's no guarantee that the search query will be set in the field by the time this is executed, as that happens by the statechange listener.