I'm trying to validate that the fields given to sphinx are valid, but I'm having difficulty.
Imagine that valid fields are cat, mouse, dog, puppy.
Valid searches would then be:
@cat search terms
@(cat) search terms
@(cat, dog) search term
@cat searchterm1 @dog searchterm2
@(cat, dog) searchterm1 @mouse searchterm2
So, I want to use a regular expression to find terms such as cat, dog, mouse in the above examples, and check them against a list of valid terms.
Thus, a query such as:
@(goat)
Would produce an error because goat is not a valid term.
I've gotten so that I can find simple queries such as @cat with this regex: (?:@)([^( ]*)
But I can't figure out how to find the rest.
I'm using python & django, for what that's worth.