Skip to content

Commit

Permalink
flexable indexable nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
saleem-hadad committed Feb 6, 2019
1 parent 4efc56e commit 46ecf9d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions publishable/config/larecipe.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@
'enabled' => false,
'default' => 'algolia',
'engines' => [
'internal' => [
'index' => ['h2', 'h3']
],
'algolia' => [
'key' => '',
'index' => ''
Expand Down
4 changes: 3 additions & 1 deletion src/Traits/Indexable.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ public function index($version)
if(! $pageContent)
continue;

$indexableNodes = implode(',', config('larecipe.search.engines.internal.index'));

$nodes = (new Crawler($pageContent))
->filter('h2, h3')
->filter($indexableNodes)
->each(function (Crawler $node, $i) {
return $node->text();
});
Expand Down

0 comments on commit 46ecf9d

Please sign in to comment.