An onoremap will not act on anything if you exit the function without moving the cursor, so you should try to do that.
Your initial calls to searchpos() don't include the n flag, so they're doing that.
Here's a very simple and naive proof of concept (in pure Vimscript) to show how this works:
let [_, s] = searchpos('*', 'bcn', line('.')...