-
Notifications
You must be signed in to change notification settings - Fork 275
Speed up search by not invoking apm #1014
Changes from 5 commits
47bbea4
4239b94
278c168
46a55c2
e64b9e3
c8efff1
6bb842c
b1f5fc8
7cf0831
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
|
||
import path from 'path' | ||
import electron from 'electron' | ||
import _ from 'underscore-plus' | ||
import {CompositeDisposable, TextEditor} from 'atom' | ||
import etch from 'etch' | ||
|
||
|
@@ -207,12 +206,11 @@ export default class InstallPanel { | |
this.refs.searchMessage.textContent = `Searching ${this.searchType} for \u201C${query}\u201D\u2026` | ||
this.refs.searchMessage.style.display = '' | ||
|
||
const opts = {} | ||
opts[this.searchType] = true | ||
opts['sortBy'] = 'downloads' | ||
const options = {sort: {downloads: 'desc'}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should just be Also, seems weird how we sort by downloads. Now that the relevance sorting has been improved maybe we can default to relevance instead, probably in a different PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Considering sorting was not done before, I am guessing it can be straight omitted and perhaps the reason why it works is because it has no effect (unconfirmed). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it was because of the garbage value in sort field why it seemed to work. However, when properly sorting on serverside vs not sorting at all, we are getting way different results. The default, unsorted search seems to give more relevant results compared to what is popular, but less relevant. I will roll back the sorting part from last night. |
||
options[this.searchType] = true | ||
|
||
try { | ||
let packages = (await this.packageManager.search(query, opts)) || [] | ||
const packages = (await this.client.search(query, options)) || [] | ||
this.refs.resultsContainer.innerHTML = '' | ||
this.refs.searchMessage.style.display = 'none' | ||
if (packages.length === 0) { | ||
|
@@ -233,7 +231,7 @@ export default class InstallPanel { | |
} | ||
|
||
highlightExactMatch (container, query, packages) { | ||
const exactMatch = _.filter(packages, pkg => pkg.name === query)[0] | ||
const exactMatch = packages.filter(pkg => pkg.name === query)[0] | ||
|
||
if (exactMatch) { | ||
this.addPackageCardView(container, this.getPackageCardView(exactMatch)) | ||
|
@@ -242,7 +240,7 @@ export default class InstallPanel { | |
} | ||
|
||
addCloseMatches (container, query, packages) { | ||
const matches = _.filter(packages, pkg => pkg.name.indexOf(query) >= 0) | ||
const matches = packages.filter(pkg => pkg.name.indexOf(query) >= 0) | ||
|
||
for (let pack of matches) { | ||
this.addPackageCardView(container, this.getPackageCardView(pack)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unfamiliar with proxying but is there anything special that needs to be done here to avoid proxy issues?
EDIT: Seems like some ongoing proxy work in #1010 that you could look at.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is what is needed to be added to the request options when that pull request is merged.