Skip to content

Commit

Permalink
refactor Suggest::search to Suggest::suggest
Browse files Browse the repository at this point in the history
  • Loading branch information
sitepark-veltrup committed Mar 22, 2024
1 parent 5c956fa commit 1a2081d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Console/Command/Suggest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected function execute(

$query = $this->buildQuery($terms, $lang);

$result = $this->search->search($query);
$result = $this->search->suggest($query);

$this->outputResult($result);

Expand Down
2 changes: 1 addition & 1 deletion src/Service/Search/SolrSuggest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct(
/**
* @throws UnexpectedResultException
*/
public function search(SuggestQuery $query): SuggestResult
public function suggest(SuggestQuery $query): SuggestResult
{
$index = $this->index->name($query->lang);
$client = $this->clientFactory->create($index);
Expand Down
2 changes: 1 addition & 1 deletion src/Suggest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
*/
interface Suggest
{
public function search(SuggestQuery $query): SuggestResult;
public function suggest(SuggestQuery $query): SuggestResult;
}
2 changes: 1 addition & 1 deletion test/Console/Command/SuggestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function setUp(): void
10
);
$solrSuggest = $this->createStub(SolrSuggest::class);
$solrSuggest->method('search')
$solrSuggest->method('suggest')
->willReturn($result);

$command = new Suggest($solrSuggest);
Expand Down
6 changes: 3 additions & 3 deletions test/Service/Search/SolrSuggestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function testSuggest(): void

$this->result->method('getResponse')->willReturn($response);

$suggestResult = $this->searcher->search($query);
$suggestResult = $this->searcher->suggest($query);

$expected = [
new Suggestion('category', 10),
Expand Down Expand Up @@ -108,7 +108,7 @@ public function testEmptySuggest(): void

$this->result->method('getResponse')->willReturn($response);

$suggestResult = $this->searcher->search($query);
$suggestResult = $this->searcher->suggest($query);

$this->assertEmpty(
$suggestResult->suggestions,
Expand All @@ -128,6 +128,6 @@ public function testInvalidSuggestResponse(): void
$this->result->method('getResponse')->willReturn($response);

$this->expectException(UnexpectedResultException::class);
$this->searcher->search($query);
$this->searcher->suggest($query);
}
}

0 comments on commit 1a2081d

Please sign in to comment.