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

Add minimum_should_match support for BoolQuery #38

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

srowan
Copy link

@srowan srowan commented Apr 15, 2024

Updates BoolQuery to allow for setting the minimum_should_match option

  • This option is a string with a variety of formats, so it made sense to me to just keep it as a string value
  • If the option is not set, nothing is added to the payload

This option is very useful when you need it, but is perhaps somewhat niche - would you want it added to the readme?

@srowan
Copy link
Author

srowan commented Apr 16, 2024

One thing to note - this change does not allow for setting this option on the top-most BoolQuery which gets instanciated here:

    public function addQuery(Query $query, string $boolType = 'must'): static
    {
        if (! $this->query) {
            $this->query = new BoolQuery();
        }

        $this->query->add($query, $boolType);

        return $this;
    }

I think this could be worked around, but it would be nice if there was a clean way to do that

@freekmurze freekmurze merged commit 13e66ae into spatie:main Apr 25, 2024
4 checks passed
@freekmurze
Copy link
Member

Thanks!

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 this pull request may close these issues.

2 participants