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

Range filter doesnt use related search #217

Open
einorler opened this issue Nov 16, 2016 · 5 comments
Open

Range filter doesnt use related search #217

einorler opened this issue Nov 16, 2016 · 5 comments
Labels

Comments

@einorler
Copy link
Member

In preProcessSearch method of Range filter stats aggregation is added:

$search->addAggregation($stateAgg);

it provides data for max and min values, but, it aggregates on all documents instead of limiting to current search. IMO it should add a FilterAggregation with post filters from related search instance like it is done in filters like choice, dynamic aggregate and others. Any thoughts?

@saimaz
Copy link
Member

saimaz commented Nov 17, 2016

It should, this is a bug.

@saimaz saimaz added bug and removed question labels Nov 17, 2016
@borjadinamic
Copy link

borjadinamic commented Jun 26, 2018

This bug still existing, any fix?

@saimaz
Copy link
Member

saimaz commented Jun 26, 2018

Yes it is still here, filter manager could be revised after ElasticsearchBundle will be done.

The faster way would be if somebody could create a fix by PR and then I would merge and release a patch ;)

@bnd170
Copy link

bnd170 commented Jun 26, 2018

I'm investigating about it. If I found any solution will create a PR.

@bnd170
Copy link

bnd170 commented Jun 26, 2018

I'm testing it. According with @einorler i'm trying to add the FilterAggregattions of search instance but atm without results.

    /**
     * {@inheritdoc}
     */
    public function preProcessSearch(Search $search, Search $relatedSearch, FilterState $state = null)
    {
        $stateAgg = new StatsAggregation($state->getName());
        $stateAgg->setField($this->getDocumentField());

        /** @var FilterAggregation $filter */
        foreach ($search->getAggregations() as $filter)
        {
            $stateAgg->addAggregation($filter);
        }
        $search->addAggregation($stateAgg);
    }

Any suggest whould be appreciated :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants