Duncan and I had an interesting problem recently where we had to make it possible to search within an ‘item’ to find possible sub items that exist inside it.
The URI for the item was something like this:
Let’s say Item 234 contains the following sub items:
We have a search box on the page which allows us to type in the name of a sub item and go the sub item’s page if it exists or see an error message if it doesn’t.
If the user types in the sub item name exactly right then there’s no problem:
It becomes more interesting if the user gets the case of the sub item wrong e.g. they type ‘mark’ instead of ‘Mark’.
would therefore find us the ‘Mark’ sub item.
Duncan pointed out that we’d now have more than 1 URI for the same document which isn’t particularly great since theoretically there should be a one to one mapping between a URI and a given document.
He pointed out that we could do a look up to find the ‘canonical identifier’ before we did the redirect such that if you typed in ‘mark’:
would redirect to:
The logic for checking the existence of a sub item would be the bit that’s case insensitive and makes it more user friendly.