Skip to content

Commit 623bbeb

Browse files
committed
added plain text for searchability purposes
1 parent 3d14f51 commit 623bbeb

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

src/Entities/Post.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class Post extends JsonSerializableObject
1313
protected $slug;
1414
protected $markdown;
1515
protected $html;
16+
protected $plaintext;
1617
protected $image;
1718
protected $featured;
1819
protected $page;
@@ -267,4 +268,24 @@ public function getTags()
267268
{
268269
return $this->tags;
269270
}
271+
272+
/**
273+
* @param mixed $tags
274+
*
275+
* @return self
276+
*/
277+
public function setTags($tags)
278+
{
279+
$this->tags = $tags;
280+
281+
return $this;
282+
}
283+
284+
/**
285+
* @return string
286+
*/
287+
public function getPlaintext()
288+
{
289+
return $this->plaintext;
290+
}
270291
}

src/Providers/PostProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public function getAll(array $fields = [], $limit = 15)
2020
$options = [
2121
'query' => [
2222
'limit' => $limit,
23+
'formats' => ['html', 'plaintext'],
2324
'include' => [ 'tags' ] // We include all the tag information by default
2425
]
2526
];

tests/Providers/PostProviderTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public function testProvidersCanGetAllPostsWithFieldsParameter()
8282
'query' => [
8383
'fields' => ['id', 'html'],
8484
'limit' => 15,
85+
'formats' => ['html', 'plaintext'],
8586
'include' => ['tags']
8687
]
8788
]

0 commit comments

Comments
 (0)