feat(query): Add TermsQuery#53
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 48 minutes and 48 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughIntroduces a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Coverage Report for CI Build 24506753412Coverage remained the same at 100.0%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/phpstan.yaml:
- Line 14: The inline list for php-version currently has extra spaces inside the
brackets ([ '8.4', '8.5' ]) which violates YAML lint rules; update the
declaration for php-version to remove the leading/trailing spaces inside the
brackets so it reads php-version: ['8.4', '8.5'] (keeping the comma/space
between items) to satisfy YAMLlint.
In `@README.md`:
- Around line 104-112: Update the TermsQuery docs to warn that constructing a
TermsQuery with an empty values array will throw an EmptyTermsQueryException;
specifically, add a one-line note to the TermsQuery section (near the example
using new TermsQuery('status', ['active', 'pending'])->boost(5)) stating that
providing an empty values list (e.g., new TermsQuery('field', [])) triggers
EmptyTermsQueryException so users can avoid the runtime surprise and handle the
error accordingly.
In `@src/Query/TermsQuery.php`:
- Line 10: Update the class-level PHPDoc `@see` annotation in TermsQuery
(src/Query/TermsQuery.php) to use the canonical Query DSL URL format by
replacing the legacy path with the stable one: reference
https://www.elastic.co/docs/reference/query-languages/query-dsl/terms-query so
the `@see` points to the query-dsl/terms-query page.
- Around line 23-24: The constructor-promoted properties "field" and "values" in
the TermsQuery class lack the required property PHPDoc `@var` annotations; update
the class to either convert the promoted properties into explicit class
properties with PHPDoc comments (e.g., add protected string|\Stringable $field;
protected array $values; each preceded by an `@var` line) or add equivalent
property-level docblocks so both "field" and "values" have `@var` annotations as
mandated by the repository rules.
In `@tests/Unit/Query/TermsQueryTest.php`:
- Around line 20-80: Add a unit test that covers the edge case where the
TermsQuery constructor receives a \Stringable object for $field (e.g., implement
a small stub class with __toString or use an existing Stringable value) to
verify the field key is properly cast to string in TermsQuery::toArray(); create
a new test method (e.g., itCorrectlyHandlesStringableField) in
Tests/Unit/Query/TermsQueryTest.php that constructs new TermsQuery(new
StringableStub('foo'), ['bar']) and asserts the resulting array contains the
'terms' key with 'foo' as the field name and the expected values and boost.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 74310494-90c0-4e8d-b758-6af30f2fb78f
📒 Files selected for processing (8)
.github/workflows/phpstan.yaml.github/workflows/phpunit.yamlAGENTS.mdREADME.mdsrc/Exception/Query/EmptyTermsQueryException.phpsrc/Query/AGENTS.mdsrc/Query/TermsQuery.phptests/Unit/Query/TermsQueryTest.php
No description provided.