const NULL = Symbol('null');

export default class Search {
  constructor(name, query, attrs = {}) {
    this.name = name;
    this.query = query;
    this.attrs = attrs;
  }

  getName() {
    return this.name;
  }

  createQuery() {
    return this.query;
  }

  // A null search has insufficient information to construct a canned query, so it should always return no results.
  isNull() {
    return this.attrs[NULL] || false;
  }

  static forCurrentPR(remote, branch) {
    const name = 'Current pull request';

    const upstream = branch.getUpstream();
    if (!remote.isPresent() || !remote.isGithubRepo() || !upstream.isRemoteTracking()) {
      return new this(name, '', {[NULL]: true});
    }

    return new this(name, `repo:${remote.getOwner()}/${remote.getRepo()} type:pr head:${upstream.getShortRemoteRef()}`);
  }

  static inRemote(remote, name, query) {
    if (!remote.isPresent()) {
      return new this(name, '', {[NULL]: true});
    }

    return new this(name, `repo:${remote.getOwner()}/${remote.getRepo()} ${query.trim()}`);
  }
}

@@ -565,57 +565,8 @@
 if (
-!remote.isPresent() %7C%7C !remote.isGithubRepo() %7C%7C 
 !ups
@@ -664,70 +664,37 @@
 urn 
-new this(name, %60repo:$%7Bremote.getOwner()%7D/$%7Bremote.getRepo()%7D 
+this.inRemote(remote, name, %60
 type
@@ -805,15 +805,18 @@
 e.is
-Present
+GithubRepo
 ()) 

Use inRemote to implement forCurrentPR