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

PHPORM-275 PHPORM-276 Add Query\Builder::search() and autocomplete() #3232

Merged
merged 7 commits into from
Jan 6, 2025

Conversation

GromNaN
Copy link
Member

@GromNaN GromNaN commented Dec 23, 2024

Fix PHPORM-275 and PHPORM-276

Checklist

@GromNaN GromNaN changed the title PHPORM-275 Add Builder::search() PHPORM-275 PHPORM-276 Add Query\Builder::search() and autocomplete() Jan 2, 2025
@GromNaN GromNaN marked this pull request as ready for review January 2, 2025 14:38
@GromNaN GromNaN requested a review from a team as a code owner January 2, 2025 14:38
@GromNaN GromNaN requested a review from jmikola January 2, 2025 14:38
src/Eloquent/Builder.php Show resolved Hide resolved
?bool $returnStoredSource = null,
?array $tracking = null,
) {
$results = $this->toBase()->search($operator, $index, $highlight, $concurrent, $count, $searchAfter, $searchBefore, $scoreDetails, $sort, $returnStoredSource, $tracking);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noted the @method \MongoDB\Laravel\Query\Builder toBase() annotation on this class but I'm failing to see how toBase() actually returns this library's class instead of Illuminate\Database\Query\Builder. I imagine there's some magic or trait involved that isn't clear.

Noted this probably has nothing to do with the PR, so feel free to ignore this complaint.

src/Eloquent/Builder.php Outdated Show resolved Hide resolved
src/Eloquent/Builder.php Outdated Show resolved Hide resolved
src/Query/Builder.php Outdated Show resolved Hide resolved
}

/** @return Collection<string> */
public function autocomplete(string $path, string $query, bool|array $fuzzy = false, string $tokenOrder = 'any'): Collection
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're going to document the search() params, it'd probably make sense to do so for these as well. Alternatively, link to https://www.mongodb.com/docs/atlas/atlas-search/autocomplete/ or some other relevant documentation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would benefit from a docs link, like you did for search() in Eloquent\Builder.

}

/** @return Collection<string> */
public function autocomplete(string $path, string $query, bool|array $fuzzy = false, string $tokenOrder = 'any'): Collection
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would benefit from a docs link, like you did for search() in Eloquent\Builder.

src/Query/Builder.php Outdated Show resolved Hide resolved
@GromNaN GromNaN requested a review from jmikola January 3, 2025 18:54
@GromNaN GromNaN enabled auto-merge (squash) January 6, 2025 17:33
@GromNaN GromNaN merged commit d6d8004 into mongodb:5.x Jan 6, 2025
31 of 32 checks passed
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