vanstyn / RapidApp

Turnkey ajaxy webapps
http://rapi.io
Other
48 stars 15 forks source link

"canary" test case for internals of QuickSearch #185

Closed nrdvana closed 3 years ago

nrdvana commented 4 years ago

This test case verifies the ability to override pieces of quicksearch. There isn't an official API for this yet, but there is at least one project out there using this method, which will need updated if the internals of quicksearch ever change.

This example overrides chain_Rs_req_quicksearch to make a change to the returned resultset. (doesn't matter what, just that the code ran when overriding that method)

Then it also overrides _resolve_quicksearch_condition to make one per-column change to the way that the search expression is generated. This couldn't be done in chain_Rs_req_quicksearch because all the columns together get applied in one single { -or => [] } clause. (subclassing chain_Rs_req_quicksearch would be sufficient if there were an official API to reach back into the ResultSet clauses and inspect and modify them)

vanstyn commented 3 years ago

@nrdvana - please see recent changes to the Quick Search API and consider refactoring to match. You should wait till an official release is cut, as the API is still in flux, but it is absolutely worthwhile to finally have some test coverage of quick_search. I will try to remember to come back to this when I do make the release, but should I forget, I didn't want to leave the PR unanswered with no explanation of why it wasn't merged

nrdvana commented 3 years ago

This was solved differently with the SearchBox module system, and the project this was going to be a "Canary" for is no longer customizing this internal API.