Posted by nvahalik on March 18, 2010 at 3:45pm
I've got a site running some old but concise code that essentially allows people to search 3 different fields using a single field. A user can type in a zip code, county, or a name. If the script detects a 5-digit number, it geocodes the zip code using a built-in database and then performs a geocode search. If they type a regular string, it goes against both the county and the name fields.
I've seen a couple of articles that utilize hook_views_pre_view() to look at the arguments and modify the view based on the arguments that are passed. Is that the best way, essentially it might look like this:
- Create a set of rules. Each rule would have a regexp or test, and if it passes that test, it uses the associated rule.
- When executing a view, implement this logic:
- Load all of the rules.
- Loop through all of the rules until it finds one that matches (the last one is the default)
- Modify the view to look at that rule's columns and set the appropriate arguments.
Is there something that does this already? Is there a better way to do this?

Comments
Search issue
Hey!! i am also looking for the same solution. have to apply a search for all fields like username, node title, node body etc. with only one exposed field. which is a mannered solution for this.
Thanks
search issue
This may help you.
http://stackoverflow.com/questions/697728/can-i-use-one-single-exposed-f...