discuitnet / discuit

A free and open-source community discussion platform.
https://discuit.net
GNU Affero General Public License v3.0
411 stars 52 forks source link

Add in-site search #28

Open Oracuda opened 7 months ago

Oracuda commented 7 months ago

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/

previnder commented 7 months ago

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.

fredrikburmester commented 7 months ago

This article shows the differences between Elasticsearch, Typesense, Algolia and Meilisearch:

There are some strong arguments for all engines. Some key takeaways are: