Skip to content

Commit

Permalink
Merge pull request #2083 from thostetler/stop-empty-id-search
Browse files Browse the repository at this point in the history
Stop sending extra empty search request
  • Loading branch information
ehenneken committed Nov 19, 2020
2 parents d53e5e7 + 0a5c537 commit a42387d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/js/widgets/search_bar/search_bar_widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -859,20 +859,22 @@ define([

dispatchRequest: function(apiQuery) {
var sort = apiQuery.get('sort');
var da = this.defaultQueryArguments;
if (/citation_count_norm/i.test(sort)) {
da = _.extend(da, {
this.defaultQueryArguments = _.extend(this.defaultQueryArguments, {
stats: 'true',
'stats.field': 'citation_count_norm',
});
} else if (/citation_count/i.test(sort)) {
da = _.extend(da, {
this.defaultQueryArguments = _.extend(this.defaultQueryArguments, {
stats: 'true',
'stats.field': 'citation_count',
});
} else {
this.model.unset('citationCount');
this.model.unset('citationLabel');

// don't bother sending request
return;
}
BaseWidget.prototype.dispatchRequest.call(this, apiQuery);
},
Expand Down

0 comments on commit a42387d

Please sign in to comment.