clojure-grimoire / grimoire

Community documentation of Clojure
http://conj.io
159 stars 41 forks source link

Some search ideas #37

Closed glenjamin closed 10 years ago

glenjamin commented 10 years ago

Since the whole site is statically generated, the names and URLs of all the pages are known, which should make it possible to include a JS powered search backed by JSON data quite easily.

I'm happy to work on a PR if this is deemed sensible.

The data could either be dropped into every page, or left as a deferred call to a static json doc when the search box is interacted with.

Another option would be to just defer to something like https://www.google.com/search?q=site%3Ahttp%3A%2F%2Fgrimoire.arrdem.com%2F1.6.0%2F+hash although this won't play as well with non-alphanumeric chars

arrdem commented 10 years ago

As I mentioned over here a good chunk of my motivation with Grimoire was the lack of good webdocs of the weird alphanum symbols we have like as-> and friends. As such, I think that extending the existing search bar so that if given a unique, known symbol or a known namespace qualified symbol it redirects you to the appropriate page would be awesome.

Incremental search (showing parital matches) would be nice, but just being able to recognize that the search box has a a value equal to a known qualified or unqualified symbol and then jump to the appropriate page would be sufficient.

I'd love to see a PR for this as I confess my javascript foo is pretty weak.

boxed commented 10 years ago

I just tried searching for "seq?" and I quickly came to the conclusion that the search box is a regex search. That's not very helpful! :P

jafingerhut commented 10 years ago

boxed, arrdem: Just a couple of minutes ago I have updated the cheatsheet Javascript to escape regex-special characters like ? so that they are searched for literally, rather than having their special meaning in a regex.

arrdem commented 10 years ago

Awesome. Thanks Andy!