Closed bounlu closed 11 months ago
Hey @bounlu.
Yes, you've missed out on a minor detail. (No worries, somebody else already did before as well.)
The limit
option is not part of the new Fuse(...)
options but of the options to the search
method. (More precisely: It's the only option of the search
method as of now).
So what you'd want to do is this:
$options = [
'keys' => ['author'],
- 'limit' => 1,
];
$fuse = new \Fuse\Fuse($list, $options);
echo "<pre>";
-print_r($fuse->search('o'));
+print_r($fuse->search('o', [ 'limit' => 1 ]));
echo "</pre>";
Hope this helps. :)
I see, thanks for the quick response. It works fine that way.
No matter what limit is specified, the results array return all the items. Basically
limit
option is not taken into effect.Both examples above return the same result:
Is this a bug or am I missing something?