Skip to content

Commit eeab28d

Browse files
authored
Remove search callback call (#15)
1 parent 6e103a2 commit eeab28d

File tree

2 files changed

+1
-35
lines changed

2 files changed

+1
-35
lines changed

src/Engines/ArrayEngine.php

-10
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,6 @@ protected function performSearch(Builder $builder, array $options = [])
111111
{
112112
$index = $builder->index ?: $builder->model->searchableAs();
113113

114-
if ($builder->callback) {
115-
return call_user_func(
116-
$builder->callback,
117-
$this->store,
118-
$index,
119-
$builder->query,
120-
$options
121-
);
122-
}
123-
124114
$matches = $this->store->find($index, function ($record) use ($builder) {
125115
$values = new RecursiveIteratorIterator(new RecursiveArrayIterator($record));
126116

tests/Engines/ArrayEngineTest.php

+1-25
Original file line numberDiff line numberDiff line change
@@ -90,31 +90,7 @@ public function search_results_can_be_limited()
9090
$this->assertCount(2, $results['hits']);
9191
$this->assertEquals(3, $results['total']);
9292
}
93-
94-
/** @test */
95-
public function callback_can_be_passed_to_search()
96-
{
97-
$arrayStore = new ArrayStore();
98-
$engine = new ArrayEngine($arrayStore);
99-
$engine->update(Collection::make([
100-
new SearchableModel(['id' => 1, 'foo' => 'bar', 'scoutKey' => 1]),
101-
new SearchableModel(['id' => 2, 'foo' => 'baz', 'scoutKey' => 2]),
102-
new SearchableModel(['id' => 3, 'foo' => 'bar', 'scoutKey' => 3])
103-
]));
104-
105-
$wasCalled = false;
106-
$builder = new Builder(new SearchableModel, 'bar', function ($store, $index, $query) use (&$wasCalled, $arrayStore) {
107-
$wasCalled = true;
108-
$this->assertSame($store, $arrayStore);
109-
$this->assertEquals($index, (new SearchableModel())->searchableAs());
110-
$this->assertEquals('bar', $query);
111-
});
112-
113-
$engine->search($builder);
114-
115-
$this->assertTrue($wasCalled);
116-
}
117-
93+
11894
/** @test */
11995
public function it_returns_empty_array_if_no_results_found()
12096
{

0 commit comments

Comments
 (0)