solariumphp / solarium

PHP Solr client library
Other
929 stars 302 forks source link

MinimumScoreFilter can have a null value in a ValueGroupResult #1082

Closed thomascorthals closed 1 year ago

thomascorthals commented 1 year ago

The example assumes null is possible, but the ValueGroupResult() constructor doesn't allow it to be nullable in the method signature.

https://github.com/solariumphp/solarium/blob/be762b8db6d75529d967394fbd78a2464989540e/examples/7.7.1-plugin-minimumscorefilter-grouping.php#L38-L39

Since the example happens to select only documents with a value for the field, it doesn't actually deal with null values. With a query that does yield a null group value, you get a Fatal Error.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.05 :tada:

Comparison is base (be762b8) 97.43% compared to head (450e309) 97.49%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1082 +/- ## ========================================== + Coverage 97.43% 97.49% +0.05% ========================================== Files 389 389 Lines 10140 10140 ========================================== + Hits 9880 9886 +6 + Misses 260 254 -6 ``` | Flag | Coverage Δ | | |---|---|---| | unittests | `97.49% <100.00%> (+0.05%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=solariumphp#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://app.codecov.io/gh/solariumphp/solarium/pull/1082?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=solariumphp) | Coverage Δ | | |---|---|---| | [src/Plugin/MinimumScoreFilter/ValueGroupResult.php](https://app.codecov.io/gh/solariumphp/solarium/pull/1082?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=solariumphp#diff-c3JjL1BsdWdpbi9NaW5pbXVtU2NvcmVGaWx0ZXIvVmFsdWVHcm91cFJlc3VsdC5waHA=) | `50.00% <100.00%> (+50.00%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.