Skip to content

Instantly share code, notes, and snippets.

@janit
Last active November 2, 2015 13:53
Show Gist options
  • Save janit/732c5c73c420f43faf83 to your computer and use it in GitHub Desktop.
Save janit/732c5c73c420f43faf83 to your computer and use it in GitHub Desktop.
eZ Publish search api example
<?php
$contentTypes = array('article','blog_post');
$contentTypes = array('eng-GB','fin-FI');
$locationPath = '/2/30/44';
$query = new Query();
$query->filter = new Criterion\LogicalAnd(
array(
new Criterion\ContentTypeIdentifier($contentTypes),
new Criterion\Subtree($locationPath),
new Criterion\LanguageCode($languages),
)
);
$query->sortClauses = array(
new SortClause\DatePublished(),
);
$searchResults = $this->searchService->findContentInfo($query);
@JGrubb
Copy link

JGrubb commented Nov 2, 2015

I think you meant $languages = array('eng-GB','fin-FI'); on line 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment