Skip to content
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

Inconsistent results #64

Closed
plozmun opened this issue Jan 16, 2018 · 13 comments
Closed

Inconsistent results #64

plozmun opened this issue Jan 16, 2018 · 13 comments

Comments

@plozmun
Copy link

plozmun commented Jan 16, 2018

I have started to use this bundle with ezplatform-kernel 7 but it seems filter service don't work properly.

I hace the following controller and results differ from eZ Search Service. Whats wrong in it?

<?php

namespace AppBundle\Controller;

use eZ\Publish\API\Repository\Values\Content\Query\Criterion\ParentLocationId;
use Netgen\Bundle\EzPlatformSiteApiBundle\Controller\Controller;
use Netgen\Bundle\EzPlatformSiteApiBundle\View\ContentView;
use eZ\Publish\API\Repository\Values\Content\LocationQuery;


class ContentController extends Controller
{
    /**
     * @param \Netgen\Bundle\EzPlatformSiteApiBundle\View\ContentView $view
     *
     * @return \Netgen\Bundle\EzPlatformSiteApiBundle\View\ContentView
     */
    public function indexAction(ContentView $view)
    {
        $locationId = $view->getParameter('locationId');

        $filterService = $this->getSite()->getFilterService();

        $seachService = $this->get('ezpublish.api.service.search');

        $query = new LocationQuery(['filter' => new ParentLocationId($locationId)]);
        $searchResult = $filterService->filterLocations($query);

        // Total count: 0
        dump($searchResult->totalCount);

        $searchResult = $seachService->findContent($query);

        // Total count: 3
        dump($searchResult->totalCount);
        
        return $view;
    }
}
@emodric
Copy link
Member

emodric commented Jan 16, 2018

@plozmun Are you using Solr in your app? Filter service is not using Solr search engine to fetch the content, while eZ Search service does. This might be the cause of the discrepancy in results between filter service and search service. To verify if that is the case, you can try using find service from this package and see what results you get with it. Find service is basically the same thing as filter service, but uses Solr as a backend instead of the database.

If that doesn't help, one other reason could be is that filter and find services automatically filter content and locations based on prioritized list of languages configured for the current siteaccess, which, again, search service from eZ does not.

@plozmun
Copy link
Author

plozmun commented Jan 16, 2018

No, i don't use Solr in the app. Then i can't use findService without Solr? With findService it works properly.

I have overide parameter:

    netgen.ezplatform_site.prioritized_languages:
        - 'esl-ES'
        - 'eng-GB'

but this does't work either

@emodric
Copy link
Member

emodric commented Jan 16, 2018

You can use find service even if you don't use Solr. Find service actually falls back to legacy if no Solr is present. I'm not sure why it gives different results from filter service if you don't use Solr. @pspanja do you have a clue why this would happen?

BTW, you should not override the netgen.ezplatform_site.prioritized_languages parameter, it is used internally and not meant to be configured directly.

@pspanja
Copy link
Member

pspanja commented Jan 16, 2018

@plozmun I've noticed in one case you use filterLocations() and in other findContent().
Is there any change in behavior if you search for the same on both sides, filterLocations() and findLocations() or filterContent() and findContent()?

@plozmun
Copy link
Author

plozmun commented Jan 16, 2018

I have try with filterContent and findContent and it`s the same.

It's strange because PermissionCriterionResolver returns false with filterService and true with ez Searchservice

@plozmun
Copy link
Author

plozmun commented Jan 16, 2018

I realized it's our fault. Close this issue. Sorry for the inconvenience .

Thank you

@plozmun plozmun closed this as completed Jan 16, 2018
@pspanja
Copy link
Member

pspanja commented Jan 16, 2018

No worries @plozmun, good to know that you solved the problem 👍

@plozmun
Copy link
Author

plozmun commented Jan 16, 2018

i reopen it , sorry 😆

I dont know why the UserReference used by filter service is

UserReference {#1467 ▼
  -userId: 10
}

and admin is:

UserReference {#854 ▼
  -userId: 14
}

Do you know why?

@plozmun plozmun reopened this Jan 16, 2018
@pspanja
Copy link
Member

pspanja commented Jan 16, 2018

That is coming from eZ Platform kernel, in default installation ID=10 is anonymous and ID=14 is admin. Are you testing that with different logins?

@plozmun
Copy link
Author

plozmun commented Jan 16, 2018

Nope, 😢

@emodric
Copy link
Member

emodric commented Jan 25, 2018

@plozmun We have identified the issue, however, it will take a couple of days to solve it as it is not really straightforward, so please be patient :)

@pspanja
Copy link
Member

pspanja commented Jan 25, 2018

Here we go: #67

@plozmun your feedback would be much appreciated!

@pspanja
Copy link
Member

pspanja commented Feb 2, 2018

Fixed by #67

@plozmun thanks for reporting this!

@pspanja pspanja closed this as completed Feb 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants