-
Notifications
You must be signed in to change notification settings - Fork 0
Improve the search result ordering #296
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
Conversation
Previously, if we made changes to the indexing code, the cached version of the Lunr index (from local storage) would still be used. This commit adds a version number near our indexing code that should be incremented whenever we make changes to how Lunr indexes our content.
| "styles": "rm -rf node_modules/bit-docs-generate-html/site/static && node make-example.js -f", | ||
| "test": "npm run testee", | ||
| "styles": "rm -rf node_modules/bit-docs-generate-html/site/static && npm start", | ||
| "test": "npm start && npm run testee", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to generate the site before running the tests so it always works.
| var searchIndexVersionKey = this.formatLocalStorageKey(this.searchIndexVersionLocalStorageKey); | ||
| var index = this.getLocalStorageItem(searchIndexKey); | ||
| var indexVersion = this.getLocalStorageItem(searchIndexVersionKey); | ||
| var currentIndexVersion = 1;// Bump this whenever the index code is changed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See this commit for more details: 0d346e5
imaustink
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
This PR rewrites how we query the Lunr index to get search results. I’ve added tests for a few scenarios—if you test search and find that the results aren’t great for a specific term, I can add a new test case for it and fix the results.
Fixes #290