> this means that the words and, or, not, prox and sortby are valid terms.

Yes, they are.

> and

This is a single term search for "and"

> and and and

"and" AND "and"

> and or not and or not and dino and not not and

"and" OR "not" AND "or" NOT "and" ... dino is not a boolean.

So I don't think this is valid, or at least shouldn't be!

The key point is that when checking the next token in the query stream, 
you must be able to determine if it's a boolean or a relation, as that 
determines if the currect token is a term or an index.