Skip to content

Instantly share code, notes, and snippets.

View pspanja's full-sized avatar

Petar Španja pspanja

View GitHub Profile
@pspanja
pspanja / autocomplete.php
Created July 13, 2017 13:56
How to implement suggest/autocomplete for Solr Search Engine for eZ Platform
<?php
namespace Vendor\Bundle\ProjectBundle\Core\Search\Solr\Query\Content\FacetBuilder;
use eZ\Publish\API\Repository\Values\Content\Query\FacetBuilder;
class SuggestionFacetBuilder extends FacetBuilder
{
public $prefix;
}
@pspanja
pspanja / services.yml
Created February 9, 2017 08:21
Container service definitions for additional SearchService with Legacy search engine
parameters:
client_name.ezpublish.repository.permission_criterion_handler.class: eZ\Publish\Core\Repository\PermissionsCriterionHandler
client_name.ezpublish.repository.domain_mapper.factory.class: ClientName\Bundle\ProjectBundle\ApiLoader\RepositoryDomainMapperFactory
client_name.ezpublish.repository.domain_mapper.class: eZ\Publish\Core\Repository\Helper\DomainMapper
services:
# Legacy Search Service
client_name.ezpublish.repository.domain_mapper.factory:
class: %client_name.ezpublish.repository.domain_mapper.factory.class%
arguments:
@pspanja
pspanja / RepositoryDomainMapperFactory.php
Last active February 9, 2017 08:20
RepositoryDomainMapperFactory for additional SearchService with Legacy search engine
<?php
namespace ClientName\Bundle\ProjectBundle\ApiLoader;
use eZ\Publish\Core\Base\Container\ApiLoader\FieldTypeCollectionFactory;
use eZ\Publish\Core\Repository\Helper\DomainMapper;
use eZ\Publish\Core\Repository\Helper\FieldTypeRegistry;
use eZ\Publish\SPI\Persistence;
use Symfony\Component\DependencyInjection\ContainerAware;
@pspanja
pspanja / init.sh
Last active December 16, 2016 18:06
Start Solr for Solr Search Engine for eZ Platform
#!/usr/bin/env bash
if [[ $# -eq 0 ]] ; then
echo 'ERROR: no version provided'
exit 1
fi
if [ ${2} ] ; then
./__solr/${1}/bin/solr stop -all
exit 1
@pspanja
pspanja / pre-commit
Last active October 7, 2015 10:40
PHP-CS-Fixer Git pre-commit hook
#!/bin/bash
PROJECTROOT=`pwd`
if [ ! -f ${PROJECTROOT}/.php_cs ]; then
exit 0
fi
hash php-cs-fixer 2>/dev/null || { echo >&2 "I require php-cs-fixer but it's not installed. Aborting."; exit 1; }
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 22,
<?php
class PageController extends Controller
{
...
/**
*
*
* @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException
diff --git a/eZ/Publish/Core/Repository/URLAliasService.php b/eZ/Publish/Core/Repository/URLAliasService.php
index 065956e..348a9a5 100644
--- a/eZ/Publish/Core/Repository/URLAliasService.php
+++ b/eZ/Publish/Core/Repository/URLAliasService.php
@@ -257,8 +257,23 @@ class URLAliasService implements URLAliasServiceInterface
*/
protected function selectAliasLanguageCode( SPIURLAlias $spiUrlAlias, $languageCode )
{
- if ( isset( $languageCode ) && !in_array( $languageCode, $spiUrlAlias->languageCodes ) )
+ if ( isset( $languageCode ) )
Example of Criterions not relating to each other:
There is a Content with two Locations: Location A and Location B
- Location A is visible
- Location B is hidden
Searching with LocationId criterion with Location B id and Visibility
criterion with Visibility::VISIBLE will return the Content because
conditions are satisfied: