Skip to content

Conversation

@hopeseekr
Copy link

@hopeseekr hopeseekr commented Nov 14, 2018

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 hopeseekr changed the title Usertags Added a GET: /search/suggest/user route for @user tags. Nov 14, 2018
@hopeseekr
Copy link
Author

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.

/** @var abstractCacher $cache */
$cache = Core\Di\Di::_()->get('Cache');

$usernames = $cache->get('usernames');
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if the key name needs to be a lot more ... unique ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant