Friday, 21 December 2007

Filter search results using regular expressions

Filter search results using regular expressions.

So Google has had this AJAX API out for some time. For the longest time, I've wanted to be able to apply regular expressions to the results. I figured using the Google API would be the best way to do it. That is the page linked to above. View the Javascript, it is pretty straight forward (and likely buggy!)

The API itself is pretty good. The only thing that bugs me is that I could only manage to get 8 results on which to apply my regular expression. Ideally, I would have liked to do something like this:

  1. Get query + filter string from user

  2. Submit query to Google using AJAX

  3. As the results come in, filter them using the filter string in step 1

  4. Present to user as results pass filter

So for the above page to be even slightly useful, I would have to be able to go through at least 100 relevant results.

Of course I understand that Google has limited the search for business reasons. But this is a very good way to totally make the feature useless, in my opinion.

Oh well, at least I learned something today.

No comments: