To search for words near each other use the ‘near’ and ‘before’ operators; e.g.:
president near Obama
matches all texts containing both ‘president’ and ‘Obama’ within 5 words – in any order;
president near/3 Obama
matches all texts containing both ‘president’ and ‘Obama’ within 3 words – again in any order;
president before Obama
matches all texts containing ‘president’ within 5 words before ‘Obama’, and finally:
president before/3 Obama
matches all texts containing ‘president’ within 3 words before ‘Obama’.
As for the logical operators above, the operator names ‘before’ and ‘near’ are case-sensitive: they must be lower-case.