-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Conversation
Builder::search()
Query\Builder::search()
and autocomplete()
?bool $returnStoredSource = null, | ||
?array $tracking = null, | ||
) { | ||
$results = $this->toBase()->search($operator, $index, $highlight, $concurrent, $count, $searchAfter, $searchBefore, $scoreDetails, $sort, $returnStoredSource, $tracking); |
There was a problem hiding this comment.
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.
} | ||
|
||
/** @return Collection<string> */ | ||
public function autocomplete(string $path, string $query, bool|array $fuzzy = false, string $tokenOrder = 'any'): Collection |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
Fix PHPORM-275 and PHPORM-276
Checklist
Model::search()
returns a collection of model instancesSchema::getIndexes()
introspection method #3233