retrospring
retrospring copied to clipboard
add some search functionality
super early WIP, resolves #13
this requires Meilisearch to be installed. it's ridiculously fast and super easy to use. eats up a lot of disk space however but i guess that's what it takes to have a decent search.
to set it up locally (macOS):
brew install meilisearch
to enable search functionality:
SEARCH_ENABLED=true foreman start -f Procfile.dev
to import data to meilisearch:
SEARCH_ENABLED=true bundle exec rails runner '[Answer, Question].map(&:reindex!)'
what's still left to be done:
- [ ] decide how we want to present the search results (maybe each type in a tab? multisearch, while fast, seems a bit wonky)
- [ ] decide whether we want search to be done by signed in users only (i'd say yes)
- [ ] decide what questions to include in the index (answer count >= 1? non-anonymous ones? definitely skip the generated ones though)
- [ ] pagination
- [ ] clean up the UI in general (this includes maybe a search bar or button in the navbar)
- [ ] set it up to index stuff in a sidekiq worker (see also https://github.com/meilisearch/meilisearch-rails?tab=readme-ov-file#queues--background-jobs)
- [ ] perhaps introduce some
/@user/questions/search//@user/searchpages too which only searches for the user's qustions/answers - [ ] add some gradual rollout so we can keep an eye on how it behaves
- [ ] deal with extra user flags (exclude from search results)
- [ ] introduce a flag for enabling/disabling search globally
- [ ] introduce a flag that overrides the user's choice of being present in the search results (the idea is to not display results from spammers or some other problematic people)
- [ ] (for prod): set up machines for meilisearch