Applied StyleCI changes
This commit is contained in:
parent
63d8d72d7e
commit
2633b94deb
|
@ -175,7 +175,7 @@ class SearchIndex
|
|||
$names = [];
|
||||
$values = [];
|
||||
|
||||
foreach($tags as $tag) {
|
||||
foreach ($tags as $tag) {
|
||||
$names[] = $tag->name;
|
||||
$values[] = $tag->value;
|
||||
}
|
||||
|
@ -243,7 +243,6 @@ class SearchIndex
|
|||
return $dataArray;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* For the given term data arrays, Merge their contents by term
|
||||
* while combining any scores.
|
||||
|
|
|
@ -124,7 +124,6 @@ class SearchOptions
|
|||
return $terms;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parse a standard search term string into individual search terms and
|
||||
* extract any exact terms searches to be made.
|
||||
|
|
|
@ -8,10 +8,10 @@ use Illuminate\Support\HtmlString;
|
|||
|
||||
class SearchResultsFormatter
|
||||
{
|
||||
|
||||
/**
|
||||
* For the given array of entities, Prepare the models to be shown in search result
|
||||
* output. This sets a series of additional attributes.
|
||||
*
|
||||
* @param Entity[] $results
|
||||
*/
|
||||
public function format(array $results, SearchOptions $options): void
|
||||
|
@ -49,6 +49,7 @@ class SearchResultsFormatter
|
|||
|
||||
/**
|
||||
* Highlight tags which match the given terms.
|
||||
*
|
||||
* @param Tag[] $tags
|
||||
* @param string[] $terms
|
||||
*/
|
||||
|
@ -104,6 +105,7 @@ class SearchResultsFormatter
|
|||
* adjacent or where they overlap.
|
||||
*
|
||||
* @param array<int, int> $matchPositions
|
||||
*
|
||||
* @return array<int, int>
|
||||
*/
|
||||
protected function sortAndMergeMatchPositions(array $matchPositions): array
|
||||
|
@ -118,7 +120,7 @@ class SearchResultsFormatter
|
|||
$mergedRefs[$start] = $end;
|
||||
$lastStart = $start;
|
||||
$lastEnd = $end;
|
||||
} else if ($end > $lastEnd) {
|
||||
} elseif ($end > $lastEnd) {
|
||||
$mergedRefs[$lastStart] = $end;
|
||||
$lastEnd = $end;
|
||||
}
|
||||
|
@ -204,5 +206,4 @@ class SearchResultsFormatter
|
|||
|
||||
return $content;
|
||||
}
|
||||
|
||||
}
|
|
@ -141,13 +141,13 @@ class SearchRunner
|
|||
$relations = ['tags'];
|
||||
|
||||
if ($entityModelInstance instanceof BookChild) {
|
||||
$relations['book'] = function(BelongsTo $query) {
|
||||
$relations['book'] = function (BelongsTo $query) {
|
||||
$query->visible();
|
||||
};
|
||||
}
|
||||
|
||||
if ($entityModelInstance instanceof Page) {
|
||||
$relations['chapter'] = function(BelongsTo $query) {
|
||||
$relations['chapter'] = function (BelongsTo $query) {
|
||||
$query->visible();
|
||||
};
|
||||
}
|
||||
|
|
|
@ -14,7 +14,8 @@ class SearchController extends Controller
|
|||
protected $searchRunner;
|
||||
protected $entityContextManager;
|
||||
|
||||
public function __construct(SearchRunner $searchRunner) {
|
||||
public function __construct(SearchRunner $searchRunner)
|
||||
{
|
||||
$this->searchRunner = $searchRunner;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ use BookStack\Entities\Models\Book;
|
|||
use BookStack\Entities\Models\Bookshelf;
|
||||
use BookStack\Entities\Models\Chapter;
|
||||
use BookStack\Entities\Models\Page;
|
||||
use BookStack\Entities\Models\SearchTerm;
|
||||
use Tests\TestCase;
|
||||
|
||||
class EntitySearchTest extends TestCase
|
||||
|
@ -410,5 +409,4 @@ class EntitySearchTest extends TestCase
|
|||
$search->assertSee('My <cool> <strong>TestPageContent</strong>', false);
|
||||
$search->assertSee('My supercool <great> <strong>TestPageContent</strong> page', false);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue