1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-31 15:24:31 +03:00

Search: Added structure for search term inputs

Sets things up to allow more complex terms ready to handle negation.
This commit is contained in:
Dan Brown
2024-10-02 17:31:45 +01:00
parent 34ade50181
commit 177cfd72bf
7 changed files with 194 additions and 86 deletions

View File

@ -25,11 +25,12 @@ class SearchResultsFormatter
* Update the given entity model to set attributes used for previews of the item
* primarily within search result lists.
*/
protected function setSearchPreview(Entity $entity, SearchOptions $options)
protected function setSearchPreview(Entity $entity, SearchOptions $options): void
{
$textProperty = $entity->textField;
$textContent = $entity->$textProperty;
$terms = array_merge($options->exacts, $options->searches);
$relevantSearchOptions = $options->exacts->merge($options->searches);
$terms = $relevantSearchOptions->toValueArray();
$originalContentByNewAttribute = [
'preview_name' => $entity->name,