-
Notifications
You must be signed in to change notification settings - Fork 4
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
How to index only live versions of pages? #4
Comments
Hi Barry
You should only push pages to the elastic search index once they are published / live.
So you don’t need to filter the live pages in ES. Instead, use the removeRecord() in the onAdterUnpublish() or archive to make sure the ES index is always in sync with only live pages.
Hope it helps
Best,
Sylvain
… On 24 Oct 2019, at 06:10, Barry Keenan ***@***.***> wrote:
Hi Andrew,
In the docs you show how to filter:
$index->index([
Page::class => [
'ClassName:not' => ErrorPage::class,
],
File::class => [
'ClassName:not' => Folder::class,
],
]);
How would I filter to only get live versions of pages? Similar to:
$live_pages = Versioned::get_by_stage(Page::class, Versioned::LIVE);
Many thanks,
Barry
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Hi Sylvain! I was thinking more from the point of view of a SilverStripe task to re-index the whole site. Since draft pages are returned by default I was ending up with urls in my index with a In my case I changed I wonder if this would be a useful option for others? |
Hi @barrykeenan - For posterity, another approach is using |
Hi Andrew,
In the docs you show how to filter:
How would I filter to only get live versions of pages? Similar to:
Many thanks,
Barry
The text was updated successfully, but these errors were encountered: