Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ This will create a config file at `config/plastic.php` and a mapping directory a
- [Searching](#searching)
- [Aggregation](#aggregation)
- [Suggestions](#suggestions)
- [Highlighting](#highlighting)
- [Mappings](#mappings)
- [Populate An Index](#populate-an-index)
- [Access The Client](#access-client)
Expand Down Expand Up @@ -240,6 +241,23 @@ The suggestions query builder can also be accessed directly from the model as we
Tag::suggest()->term('tag_term','admin')->get();
```

## [Highlighting]()

```php
$highlight = new Highlight();
$highlight->setTags(['<mark>'], ['</mark>']);
$highlight->addField('title', ['matched_fields' => ['title']]);
$highlight->addField('content', ['matched_fields' => ['content']]);

$highlight->setParameters([
'require_field_match' => false,
'force_source' => true,
]);


$search->query->addHighlight($highlight);
```

## [Model Mapping]()

Mappings are an important aspect of Elasticsearch. You can compare them to indexing in SQL databases. Mapping your models yields better and more efficient search results, and allows us to use some special query functions like nested fields and suggestions.
Expand Down