Live preview of search queries
Is your feature request related to a problem? Please describe. When typing search queries in places like bulk edit or custom download, it would be useful to get a preview of matching strings.
Describe the solution you'd like
- Show number of matching string next to the search input. Should be live updated as typing, possibly with some delay to reduce server-side load.
- Add link to search showing matched strings.
@nijel I started working on this. first by working on Search and Replace. I will make the handler of the Post request of this tool check if a certain header is available indicating preview then it will return only the search result as JSON for the preview without performing the Replace. then consume the response and show it in a popover while the user is typing with a certain interval.
I think you can use API to perform the search server-side (see https://docs.weblate.org/en/latest/api.html#units). It might need additional predicate to support filtering by URL path to make things easier to implement.
I have implemented it in 73a50ef for Search and Replace but not sure about the correctness of the results. meaning if the api returns the units related to the current project we are trying to edit, etc.
@nijel from reading the docs about api/search I am not sure what is exactly needed to implement the search preview in Tools. I wonder what is missing to add, so this endpoint is complete for the search preview. I might jump on it and them!
https://github.com/WeblateOrg/weblate/pull/12460 implements the missing filtering for the search queries.
Ah, and the preview should be applied to the filter field above, this one is only a string to replace.
Thank you for your report; the issue you have reported has just been fixed.
- In case you see a problem with the fix, please comment on this issue.
- In case you see a similar problem, please open a separate issue.
- If you are happy with the outcome, don’t hesitate to support Weblate by making a donation.