SpacetimeDB icon indicating copy to clipboard operation
SpacetimeDB copied to clipboard

How to implement server-side search logic?

Open egormanga opened this issue 7 months ago • 1 comments

A traditional straightforward solution would be to use WHERE name LIKE '%{}%', but SpacetimeDB's SQL dialect doesn't support LIKE.

The native approach seems like calling a reducer implementing the (perhaps, complex) search logic, but we can't return any data from reducers (unless we abuse Err responses, which I used once to return a String, but putting JSON there would be a crime).

The only actual solution now is to use a reducer paired with a volatile results table, but this seems cumbersome, counterproductive and pretty inefficient (have to store the entire thing).

Is there another way to it? If not, it's a feature request (might be as general as implementing reducer results).

egormanga avatar May 20 '25 08:05 egormanga

@egormanga procedural queries will be coming in the next few weeks which will solve your exact use case.

joshua-spacetime avatar Oct 31 '25 16:10 joshua-spacetime