This site has been archived. To learn more about our current products Ibexa Content, Ibexa Experience, Ibexa Commerce head over to the Ibexa Developer Portal

eZ Community » Forums » eZ Publish 5 Platform » Location Search vs. Search Service...
expandshrink

Location Search vs. Search Service when Sorting on Priorities

Location Search vs. Search Service when Sorting on Priorities

Monday 26 May 2014 12:26:50 pm - 2 replies

This post, which started more than half a year ago, has shown problems with the Search Service when sorting on priorities, when objects are located in more than one location.

Multiple locations have always been a very strong point in eZ Publish and we use it extensively in all our projects, quite frequently in combination with priorities.

Obviously the Search Service is Content oriented rather than Location oriented. This may explain the reason why the Search Service has problems returning the objects in the correct order - priorities are stored with the Location and this may explain why the LocationPriority Sort clause is marked as depreciated in 5.3.

As a replacement, the Location Service is offered, which (after some problems in 2014.01) works fine in 5.3, but has at least one major drawback: it lacks filtering!

This leaves us with a very unsatisfactory situation - either filtering or wrong sort order. I hope the developers know about this problem and can provide a solution very soon.

Thanks,
Donat

Monday 26 May 2014 2:42:31 pm

Peter Spanja has clarified the various use cases in https://jira.ez.no/browse/EZP-21518. To sum it up:

When searching for Content objects, use

 SearchService->findContent( $query )

When searching for Locations, there are two possibilities. For simple cases you may use

 LocationService->loadLocationChildren( $location )

This respects the sorting defined in the backend, but does not allow for filtering.

For a full fledge search for Locations, use

 SearchService->findLocations( $query )

This allows for filtering and sorting. Note that you will have to use Locations specific Criteria and SortClauses.

N.B. Sorting by priority works find with SearchService, even with multiple locations, I consider the problems as solved.

Modified on Monday 26 May 2014 2:43:19 pm by Donat Fritschy

Monday 26 May 2014 5:29:04 pm

Hi Donat,

thanks for posting. Also be aware of the https://github.com/ezsystems/ezpublish-kernel/pull/876, which removes some of the duplicated criterions.

For community builds this will unfortunately be a BC break and you will need to update your Location queries to use un-deprecated criterions.

Just to recapitulate once more: Location Search can use all criterions and sort clauses, Content Search can not use those in eZ/Publish/API/Repository/Values/Content/Query/Criterion/Location and eZ/Publish/API/Repository/Values/Content/Query/SortClause/Location namespaces, and of course you should avoid deprecated ones happy.gif Emoticon

Cheers,

Petar

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from