Minds / engine

mirror of https://gitlab.com/minds/engine
https://minds.com
GNU Affero General Public License v3.0
200 stars 93 forks source link

Added a GET: /search/suggest/user route for @user tags. #29

Open hopeseekr opened 5 years ago

hopeseekr commented 5 years ago

Documentation:

Every user: GET: /api/v2/search/suggest/user

Response:

{
    "entities": [
        "user1", "user2", "user3"...
    ]
}

Filtered users by matching the beginning of the usernames:

GET: /api/v2/search/suggest/user?username={searchString}

Response:

{
    "entities": [
        {searchString}1", "{searchString}", "{searchString}"...
    ]
}

If no usernames are found, it will return an empty entities: [] array.

The full user's list is cached using the default caching implementation (currently Redis) for 5 minutes ensuring that the Cassandra DB isn't raped by multiple requests.


This change is Reviewable

hopeseekr commented 5 years ago

I originally was going to use the route /v2/search/suggest/userTags, but I saw several instances in the frontend code that called the /search/suggest/user route, which didn't exist, so I implemented it.