This is a perfect spot for an `if` clause; which are rarely used, I know.

The case can be rewritten using if as:
```
Result = if Query =/= undefined -> search(Query, Context);
                true -> search(all, Context)
             end,
....
```

Arguably, one could actually setup the Query variable prior to even looking at it,
```
Query = case z_context:get_q(q, Context) of undefined -> all; Q -> Q end,
Result = search(Query, Context),
...
```

Hmmm... would be even better if `z_context:get_q` had an option to pass in a default value, much like `proplists:get_value` has.
Ah, turns out there is :D 
https://github.com/zotonic/zotonic/blob/master/src/support/z_context.erl#L607
So:
```
Query = z_context:get_q(q, Context, all),
Result = search(Query, Context),
...
```

Any how, just tossing my ideas out.. not asking for any changes for this PR (unless you feel like it). :)
I'll leave it open for a while to give you time to reply..