Adjust search limits and ordering.
parent
cfaed183aa
commit
79cc6792a1
|
@ -3,7 +3,7 @@
|
||||||
class Api::V1::SearchController < Api::BaseController
|
class Api::V1::SearchController < Api::BaseController
|
||||||
include Authorization
|
include Authorization
|
||||||
|
|
||||||
RESULTS_LIMIT = 66
|
RESULTS_LIMIT = 100
|
||||||
|
|
||||||
before_action -> { doorkeeper_authorize! :read, :'read:search' }
|
before_action -> { doorkeeper_authorize! :read, :'read:search' }
|
||||||
before_action :require_user!
|
before_action :require_user!
|
||||||
|
|
|
@ -37,7 +37,7 @@ export function submitSearch() {
|
||||||
params: {
|
params: {
|
||||||
q: value,
|
q: value,
|
||||||
resolve: true,
|
resolve: true,
|
||||||
limit: 33,
|
limit: 100,
|
||||||
},
|
},
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
if (response.data.accounts) {
|
if (response.data.accounts) {
|
||||||
|
|
|
@ -99,9 +99,9 @@ class SearchResults extends ImmutablePureComponent {
|
||||||
<FormattedMessage id='search_results.total' defaultMessage='{count, number} {count, plural, one {result} other {results}}' values={{ count }} />
|
<FormattedMessage id='search_results.total' defaultMessage='{count, number} {count, plural, one {result} other {results}}' values={{ count }} />
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
{accounts}
|
||||||
{hashtags}
|
{hashtags}
|
||||||
{statuses}
|
{statuses}
|
||||||
{accounts}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,7 +14,6 @@ class SearchService < BaseService
|
||||||
results.merge!(url_resource_results) unless url_resource.nil?
|
results.merge!(url_resource_results) unless url_resource.nil?
|
||||||
elsif @query.present?
|
elsif @query.present?
|
||||||
results[:accounts] = perform_accounts_search! if account_searchable?
|
results[:accounts] = perform_accounts_search! if account_searchable?
|
||||||
results[:statuses] = perform_statuses_search! if full_text_searchable?
|
|
||||||
results[:hashtags] = perform_hashtags_search! if hashtag_searchable?
|
results[:hashtags] = perform_hashtags_search! if hashtag_searchable?
|
||||||
results[:statuses] = Status.search_for(query.gsub(/\A#/, ''), limit, account) unless query.start_with?('@') or query.start_with?('#')
|
results[:statuses] = Status.search_for(query.gsub(/\A#/, ''), limit, account) unless query.start_with?('@') or query.start_with?('#')
|
||||||
end
|
end
|
||||||
|
@ -27,7 +26,7 @@ class SearchService < BaseService
|
||||||
AccountSearchService.new.call(
|
AccountSearchService.new.call(
|
||||||
@query,
|
@query,
|
||||||
@account,
|
@account,
|
||||||
limit: @limit,
|
limit: [@limit, 15].min,
|
||||||
resolve: @resolve,
|
resolve: @resolve,
|
||||||
offset: @offset
|
offset: @offset
|
||||||
)
|
)
|
||||||
|
@ -61,7 +60,7 @@ class SearchService < BaseService
|
||||||
def perform_hashtags_search!
|
def perform_hashtags_search!
|
||||||
Tag.search_for(
|
Tag.search_for(
|
||||||
@query.gsub(/\A#/, ''),
|
@query.gsub(/\A#/, ''),
|
||||||
@limit,
|
[@limit, 30].min,
|
||||||
@offset
|
@offset
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue