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

Fetch multiple subtree in single query #212

Open
geekguy opened this issue Nov 6, 2014 · 4 comments
Open

Fetch multiple subtree in single query #212

geekguy opened this issue Nov 6, 2014 · 4 comments

Comments

@geekguy
Copy link

geekguy commented Nov 6, 2014

Hi all,

Is it possible to fetch all subtree of given nodes in one query ?

Basically, I want to add proper pagination. So I will first query root nodes, limit them and then find subtrees for them.

Is there any batter way to do this rather than this answer ?

@ThisIsMissEm
Copy link

I've ended up doing this:

  def self.subtree(tags)
    tags.reduce ({}) do |memo, tag|
      memo[tag] = tag.descendants.arrange
      memo
    end
  end

But it's certainly not a single query (my use case is to select two root nodes of the tree and return them to the user. I may just switch to using two individual calls. Not sure.

@rudph2
Copy link

rudph2 commented Jan 13, 2016

It seems this thread is dead which is a shame. I would really appreciate query optimisation

@kbrock
Copy link
Collaborator

kbrock commented Jan 14, 2016

@rudph2 do you have an idea how you would implement this?

@dpsk
Copy link

dpsk commented Jan 26, 2016

Stuck on this too, any ideas?

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

5 participants