-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat: add wiki.autocomplete #42
Conversation
autocomplete is a bit of a misnomer maybe, as it implies that the results are all extensions of the initial query, which is not the case. my pr is referring to querying this list. the results often are extensions of the query, but does not have to be.maybe 'suggestions' is a better name? 'opensearch' is a possibility too, as that refers to the action-type, but this is not very descriptive. |
Thanks for the PR @bigmistqke let me check this tomorrow and add the necessary documentation and merge this. |
The MR looks good just a couple of points @bigmistqke.
|
…sult' in favor of 'Array<string>'
Cool!
I just saw the distinction between wiki- and page-methods. I think for autocompletions it might make sense to only have it available in wiki, what do you think? |
I think having it directly on wiki makes perfect sense. No sense for open-search to be a page method.
Your unit test is fine but its a test for the success response. Ideally while unit testing a application, we should also add a test for the error response. Basically, a test for You can check out Line 43 in 345ba33
Other than this, the MR looks ready to merge. |
MR looks all good now, ill merge this tomorrow and do a new release as i need my home computer to release this to npm. |
lovely. thanks for the feedback! |
(oops accidentally closed pr) |
released on 1.2.0 🎆 . Thanks for the PR @bigmistqke 🥇 |
fetches autocompletions from the OpenSearch-API
await wiki.autocomplete('test')
results in
["Test", "Testosterone", "Testicle", "Test cricket", "Test-driven development", "Testosterone (medication)", "Testicular cancer", "Tests of general relativity", "Test (wrestler)", "Test of English as a Foreign Language"]