discuit
discuit copied to clipboard
Add in-site search
Elasticsearch could be used for searching, or a slower SQL query.
On the API end, modifiers such as the following could be included in the search string for more customization, for example:
parent:identifier
or in:identifier
to search the comments of a specific post, the posts of a specific community, or the comments by a specific user. perhaps also author:identifier
or by:identifier
type:what
such as type:community
, type:comment
, type:post
and type:user
to search the type of the following.
If these modifiers aren't specified, the backend could assume based upon the API endpoint being used, perhaps making multiple queries for different types, for example: some users, some communities, some posts, etc.
Some examples of fully customized, but not nessacary search string would be:
type:post in:gaming tetris
type:user tetrispro549
type:comment author:tetrispro549 in:1233214
as a post id or type:comment author:tetrispro549 in:gaming
I've made a quick jsfiddle example of what a frontend search could look like, forgive me, for I am not a frontend dev. https://jsfiddle.net/n4a2foed/2/
Love the idea of search modifier parameters. It fits very well with one of the core values of Discuit—that is, giving users more control over their experience (and thus not designing everything for the lowest common denominator user).
I was thinking of going with Elasticsearch, but I was also recently recommended Meilisearch. Don't know how good it is and whether it fits our use case; I'll have to take a look at it sometime.
Your UI idea looks nice, but it's probably not necessary. Search modifiers are an 'advance' feature that not everyone will use.
This article shows the differences between Elasticsearch, Typesense, Algolia and Meilisearch:
There are some strong arguments for all engines. Some key takeaways are:
- Elasticsearch does not rely as heavily on RAM and the others, rather disk space. Is not completely open source.
- Meilisearch only supports a single-node setup (no redundancy). Is also not technically limited by RAM.
- Typesense supports the most features but is limited by RAM.
- Algolia is not open source.