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

hover link to show siblinks #9

Closed
pvh opened this issue Apr 15, 2020 · 2 comments
Closed

hover link to show siblinks #9

pvh opened this issue Apr 15, 2020 · 2 comments
Assignees

Comments

@pvh
Copy link
Contributor

pvh commented Apr 15, 2020

No description provided.

@Gozala Gozala self-assigned this Apr 15, 2020
@Gozala Gozala mentioned this issue Apr 15, 2020
@Gozala Gozala changed the title hover link to show context about that link hover link to show siblinks Apr 15, 2020
@Gozala
Copy link
Collaborator

Gozala commented Apr 16, 2020

Querying ksp for siblinks currently looks as follows:

query Siblinks {
  resource(url: "https://www.inkandswitch.com/local-first.html") {
    url
    sibLinks: links {
      ...sibLink
    }
  }
}

fragment sibLink on Link {
  target {
    url
    backLinks {
      ...backLink
    }
    tags {
      ...tag
    }
  }
}

fragment tag on Tag {
  name
}

fragment backLink on Link {
  kind
  identifier
  name
  title
  fragment
  location
  referrer {
    url
    info {
      title
      description
      cid
    }
    tags {
      ...tag
    }
  }
}

There are multiple problems with this:

  1. n+1 SQL queries
    1. First query will get links from the resource (with passed url) to materialize corresponding resources.
    2. Then it will query each materialized resource for backlinks.
  2. Resulted backlinks for each URL will contain resource for the passed URL itself. Which then on client we will have to filter out.

I don't want to spend time on optimizing this right now, but think we should expose another query endpoint to have something like:

query {
  siblinks(url: "https://www.inkandswitch.com/local-first.html") {
      ...sibLink
  }
}

Which in the KSP can accomplish this with single SQL query and exclude links for the passed url itself.

@Gozala
Copy link
Collaborator

Gozala commented Apr 16, 2020

Fixed by #18

@Gozala Gozala closed this as completed Apr 16, 2020
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

No branches or pull requests

2 participants