This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » eZ Publish 5 Platform » Location Search ignores Visibility...
expandshrink

Location Search ignores Visibility Criterion

Location Search ignores Visibility Criterion

Friday 13 February 2015 3:56:45 pm - 3 replies

I am using eZ Version 5.3.4. When doing the location search:

 

$query = new LocationQuery();      

$fetchCriteria = array(new Criterion\ParentLocationId($identifier));

$fetchCriteria[] = new Criterion\Visibility(Criterion\Visibility::VISIBLE);

...

$searchResult = $searchService->findLocations($query);

 

The Visibility Criterion is ignored. I will also get the hidden content. It only works for the content search. Such there is no Criterion like

Criterion\Location\Visibility

 

i would like to know, how to handle this topic. The content search is not an option in this case.

Thank you for any help.

Saturday 14 March 2015 1:56:13 pm

Hi Andrea.

Based on your description, it does sound like a bug. I'll ping the main developer of the feature, he should be able to tell us a bit more.

Note that it might have been fixed in the latest versions (even though we do backport most reported bugs).

Modified on Saturday 14 March 2015 1:57:07 pm by Bertrand Dunogier

Saturday 14 March 2015 10:32:06 pm

Hi,

i'm using eZ Publish Community Project 2014.11 and i havent detect this problem. I just have tested on the dev and Live System and it works if the location is hiddden from the backend .

did you call your controller using render_esi ?

check this behaviour first on the dev System.

Ups, I'm not seeing the $fetchCriteria in your $query ! and $identifier should the locationId .

Try this:

                 $criteria = array(
                        new Criterion\ParentLocationId( $YourLocationId ),
                        new Criterion\Visibility( Criterion\Visibility::VISIBLE ),
                    );
                    
                    $sortClauses = array( new Query\SortClause\Location\Priority(Query::SORT_ASC) );
                    
                    $query = new LocationQuery(
                        array(
                            'criterion' => new Criterion\LogicalAnd( $criteria ),
                            'sortClauses' => $sortClauses
                        )
                    );
                    
                    $SearchResult = $this->getRepository()->getSearchService()->findLocations( $query );
                    
                    //print_r($SearchResult);    //check results here

Monday 16 March 2015 9:30:58 am

Hi Andrea,

I made a quick test and everything is working as expected. The same Visibility criterion should work for both Content and Location searches. It would really help if you could provide the exact code you're using, if just to eliminate the obvious mistakes.

Thanks,

Petar

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from