-
Notifications
You must be signed in to change notification settings - Fork 761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Homemade Full-Text Search to Examples Site #192
Conversation
…a custom port, since 8080 is often taken. Usage:
Very nice :) The logic on what to exclude is simple for the most part:
That would exclude the majority of it. The only other files it would pick-up that it shouldn't would be where you've got a However, I don't think it'll matter too much including them in the results. I could update the node build script to add in an extra property |
…archive directories, and any files in a directory containing a boot.json file. Remove file extension from UI for naming consitency. Handling special case of bootable directories in UI.
Thanks - this is merged so it'll auto-deploy to the main site shortly. |
I just saw! Thanks for merging it, I am super excited. Feel free to ping me if there's any issues or questions with anything. Thanks |
I notice when I do |
Actually, it's picking up the new files fine, was a Safari cache issue. They're not in alphabetical order though, which I'm wondering might be because I ran the script on my new Mac (I usually use Windows) and that may be the culprit. |
Hmmm well there's definitely nothing I did intentionally to change the sort order of the However it does seem that the culprit is more likely to be some combination of nodejs and operating system issues. I'm also on mac using node v8.9.4 and everything is sorted properly for me. The directory-tree module you're using generates the children list with node's Since the user interface does depend on the ordering being alphabetical and directory-tree doesn't guarantee any order or sorting I think the best approach would be to manually sort that tree alphabetically to ensure consistency across platforms and node versions. I could implement tonight after work if you'd like. |
I was struggling to find things I need in the site so I attempted to upgrade the search functionality to a pseudo full text search algorithm.
To accomplish this, it first hooks into the
npm run update
command and generates an index json file atpublic/documentIndex.json
. On the front-end, the current search implementation was replaced with a pop-up style search interface which loads the index data and then attempts to score each example against the query using a simple algorithm I came up with via trial and error.The only issue I'm aware of this causing is it seems to be linking to files that are not available through the browse interface. In order to fix that we'll need to update the exclude regular expression in the node.js file which produces the index. I wasn't totally sure of that logic and figured the examples could still be useful so I haven't fixed it.
Example Query: