Jump to content

Custom selector and page fetching implementation


LostKobrakai
 Share

Recommended Posts

I'm currently in the process of implementing a naive selector parser and querying engine for the processwire database layout using elixir. This is for a talk I'll be giving in a few month, which is meant so showcase the flexibility of a database library, so this is not going into production or anything, but I'd still wonder about something I bumped into when working on this. I also might bump into more things, so I'll dedicate this thread to potential future questions as well.

When I looked into supporting `parent=…`/`has_parent=…` I started by joining `pages_parents`, but the new pages I had just added via the processwire admin moments before weren't present in that table. This was on an otherwise fresh installation. Aren't all pages supposed to be present in `pages_parents` and if not, what would be the conditions for them being present or not? I vaguely remember having run into issues with that table being out of date in the past, but I always blamed myself and whatever I did, not the system.

Edit:

$pages->parents()->rebuildAll(1);

This seems to have fixed the data in the table, but for some reason using it without the (documented to be optional) id it rebuilt the table incorrectly as well.

See context below

  • Like 1
Link to comment
Share on other sites

Just to be clear, which version of ProcessWire are you using? The implementation for populating pages_parents has changed a few times even in recent versions.

Anyway, my understanding is that pages_parents should contain every page that has children — but again, the implementation has changed a few times, and earlier versions (before 3.0.165?) were not entirely reliable. Meanwhile the very latest dev version has another approach that fixes scalability issues that were introduced around 3.0.165, but this version is considered experimental 🙂

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...