Update search.cpp

Simplify and explain condition.

No functional change.