Jump to content

Recommended Posts

Posted

Hi Guys,

I'm trying to create an elasticsearch module for processwire and I'm trying to figure out the best way to loop through every page to get their field data to add that to an elasticsearch index. First off I'm not sure how to get all pages, $pages->find('') doesn't do the trick. Second of all does anyone have a way to do this while keeping memory usage under control?

Thanks!

Posted

This is how I have done it in the past:

"id!=2, id!=7, has_parent!=2, has_parent!=7, template!=admin, sort=id, include=all"

Soma suggested (https://processwire.com/talk/topic/4530-how-to-get-a-list-of-all-pages-recursiv-without-admin-pages/?p=44508):

"has_parent!=2,id!=2|7,status<".Page::statusTrash.",include=all"

Ryan suggested (https://processwire.com/talk/topic/4530-how-to-get-a-list-of-all-pages-recursiv-without-admin-pages/?p=44782):

"template!=admin, has_parent!=2, include=all"

Those should help you with the getting of all pages. From there, getting pages fields is simple enough. Not sure about the memory usage issues - maybe you can test and see how it goes :)

  • Like 3

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
  • Recently Browsing   0 members

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