We have a large database of partial urls (strings) such as:
"example1.com"
"example2.com/test.js"
"/foo.js"
Our software listens for HTTP requests and tries to find one of our database's partial urls in the HTTP request's full url.
So we are getting full urls (i.e.: http://www.example.com/blah.js?foo=bar") and trying to match one of our database's partial patterns on it.
Which would be the best data structure to store our partial urls database on if all we care about is search speed?
Right now, this is what we do:
- Iterating through the entire database of partial urls (strings) and using indexOf (in javascript) to see if the full url contains each partial string.
UPDATE:
This software is an extension for Firefox written in Javascript on Firefox's Addon SDK.