Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search implementation overhaul #2857

Merged
merged 193 commits into from Apr 20, 2018

Conversation

notbakaneko
Copy link
Collaborator

reorganized with a brick.

fixes #2707
fixes #2590

  • adds counts to each tab in /home/search

  • reduce forum search page size to 20

  • switched the beatmap listing caching from caching the search response to caching the transformed json output.

  • added the 100 user search result limit back in.

  • user quick search only returns recently active users.

  • Moved parts of the search queries that probably should not affect scoring to run in a filter query instead.

  • Separate search classes for different searches; parameters should be parsed before going into search.

  • Makes the parameters used for building the queries less dependent on the request parameters.

  • Explicit parameter handlers for search classes.

  • make more use of the query builder and typings when handling searches.

  • SearchParams comes with an interface for determining cacheability of queries.

  • Search::response() is automatically memoized.

  • querying elasticsearch for no term matching is now always considered different from ''

Was originally going to implement ->paginate() but that turned out to be a terrible interface to actually use for more complicated scenarios.

nanaya
nanaya previously requested changes Apr 17, 2018
Copy link
Collaborator

@nanaya nanaya left a comment

Choose a reason for hiding this comment

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

ಠ_ಠ

*/
public function overLimit()
{
return $this->response()->total() > config('osu.search.max.user');

This comment was marked as off-topic.

public function __construct(string $index, $type, SearchParams $params)
{
parent::__construct($index, $params);
$this->recordType = $type;

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.


class UserSearch extends RecordSearch
{
public function __construct(UserSearchParams $params)

This comment was marked as off-topic.

'all' => null,
'user' => [
'type' => UserSearch::class,
'paramsType' => UserSearchRequestParams::class,

This comment was marked as off-topic.

This comment was marked as off-topic.

$this->params = $params;

if ($this->params->page !== null) {
$this->page($this->params->page);

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

*/
public function total()
{
return min($this->response()->total(), config('osu.search.max.user'));

This comment was marked as off-topic.

return html_excerpt($post->source('search_content'));
}, iterator_to_array($firstPost)));

$user = $users->where('user_id', $entry->source('poster_id'))->first() ?? new App\Models\DeletedUser();

This comment was marked as off-topic.

This comment was marked as off-topic.

<div class="page-mode__item">
<a
href="{{ route('search', ['mode' => $mode, 'query' => request('query')]) }}"
class="page-mode-link {{ isset($active) && $active ? 'page-mode-link--is-active' : '' }}"

This comment was marked as off-topic.

/**
* {@inheritdoc}
*/
public function getCacheKey() : string

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@nekodex nekodex merged commit 1d94797 into ppy:master Apr 20, 2018
@notbakaneko notbakaneko deleted the feature/search-update-calls branch April 21, 2018 17:15
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.

Tweak search results display Search implementation cleaning/refactoring
4 participants