You generally must be within 10 feet of the object or surface to be searched. The table below gives DCs for typical tasks involving the Search skill.
Action: It takes a full-round action to search a 5-foot-by-5-foot area or a volume of goods 5 feet on a side.
Special: An elf has a +2 racial bonus on Search checks, and a half-elf has a +1 racial bonus. An elf (but not a half-elf) who simply passes within 5 feet of a secret or concealed door can make a Search check to find that door.
If you have the Investigator feat, you get a +2 bonus on Search checks.
The spells explosive runes, fire trap, glyph of warding, symbol, and teleportation circle create magic traps that a rogue can find by making a successful Search check and then can attempt to disarm by using Disable Device. Identifying the location of a snare spell has a DC of 23. spike growth and spike stones create magic traps that can be found using Search, but against which Disable Device checks do not succeed. See the individual spell descriptions for details.
Active abjuration spells within 10 feet of each other for 24 hours or more create barely visible energy fluctuations. These fluctuations give you a +4 bonus on Search checks to locate such abjuration spells.
Synergy: If you have 5 or more ranks in Search, you get a +2 bonus on Survival checks to find or follow tracks.
If you have 5 or more ranks in Knowledge (architecture and engineering), you get a +2 bonus on Search checks to find secret doors or hidden compartments.
Restriction: While anyone can use Search to find a trap whose DC is 20 or lower, only a rogue can use Search to locate traps with higher DCs. (Exception: The spell find traps temporarily enables a cleric to use the Search skill as if he were a rogue.)
A dwarf, even one who is not a rogue, can use the Search skill to find a difficult trap (one with a DC higher than 20) if the trap is built into or out of stone. He gains a +2 racial bonus on the Search check from his stonecunning ability.
The character can sense the presence of magic in an area.
Sense Magic: The character senses the presence of any active magical effects in the area being searched. The character can't determine the number, strength, or type of the effects.
Source: SRD 3.5 Combined Skills