Saturday, February 2, 2013

[Google] URL query with wild card

In our indexes, we have millions of URLs each of which has a link to the
page content, now, suppose a user type a query with wild cards *, which
represent 0 or multiple occcurrences of any characters, how to build the
index such that such a type of query can be executed efficiently and the
contents of all correpsonding URLs can be displayed to the users? For
example, given a query http://www.*o*ve*ou.com. You man need to find iloveyou.com, itveabcu.com, etc.

[Thoughts]
use a Trie and traverse through are trie and for each * traversing to all the children of the node...

No comments: