marklogic-community / RunDMC

MarkLogic application for running a developer site
http://developer.marklogic.com/code/rundmc
Other
17 stars 18 forks source link

Add search result suggestions to 404 page on docs.marklogic.com #169

Open evanlenz opened 12 years ago

evanlenz commented 12 years ago

So for example, if I type http://docs.marklogic.com/element-value, it would return a 404, but on that error page it would also list these search results: http://developer.marklogic.com/search?q=element-value (without changing the URL)

dsokolsky commented 12 years ago

It would be great if this wildcarded on a single word (including dashes and colons) to list all function names that match....

evanlenz commented 12 years ago

By way of implementation, I would probably insert a branch into the URL rewriter (/apidoc/controller/url_rewrite.xqy) after the one that checks for matching functions (by checking the range index of local names). When an exact match is not found, we'd return a 404 page but we'd also call a new function (perhaps similar to get-matching-functions()) which queries against the same index (for function names) and which rather than looking for an exact match looks for a wildcard match. This is what Danny's docapp did previously. The only difference here is that we only redirect directly to the page when there's an exact match, whereas wildcard matches get listed as suggestions in the 404 page.

In addition to wildcards, it might also be good to incorporate spelling suggestions (for when people mis-type or misspell part of the function name).