Up until now, PyVideo had only a rudimentary search feature using Google Site Search. This is not ideal and downright bad on mobile as it’s using iframes which don’t work well in that environment.
As the site is statically generated using Pelican, we have to integrate any kind of dynamic search-feature using JavaScript. A couple of months ago I implemented exactly that for my own blog here so I thought I should be able to solve this also for PyVideo in a couple of days. An ideal task for the PyCon sprints π
This new search feature should be as light weighted as possible as we don’t want to have to run something like an ElasticSearch cluster for that. Since the site is about Python, an ideal implementation would be using asyncio in combination with a simple search index like whoosh. Sadly, that seems not to support asyncio and so I opted to go with an implementation in Go using bleve. You can find the implementation on Github if you want to play around with it π
To host this service and stay as flexible as possible, we have created a new
sub-domain called api.pyvideo.org
where we might offer other API-ish services
in the future.
The integration into Pelican required a search content-page with a custom template where I could add the necessary JavaScript. Also straight forward but something I haven’t done in a while as I’m now using React in combination with Webpack etc. for most of my projects. You can find the PR for this change again on Github π
Do you want to give me feedback about this article in private? Please send it to comments@zerokspot.com.
Alternatively, this website also supports Webmentions. If you write a post on a blog that supports this technique, I should get notified about your link π