Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.x] Add a DatabaseEngine #564

Merged
merged 18 commits into from
Jan 8, 2022
28 changes: 28 additions & 0 deletions src/Attributes/SearchUsingFullText.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace Laravel\Scout\Attributes;

use Attribute;
use Illuminate\Support\Arr;

#[Attribute]
class SearchUsingFullText
{
/**
* The full-text columns.
*
* @var array
*/
public $columns = [];

/**
* Create a new attribute instance.
*
* @param array|string $columns
* @return void
*/
public function __construct($columns)
{
$this->columns = Arr::wrap($columns);
}
}
28 changes: 28 additions & 0 deletions src/Attributes/SearchUsingPrefix.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace Laravel\Scout\Attributes;

use Attribute;
use Illuminate\Support\Arr;

#[Attribute]
class SearchUsingPrefix
{
/**
* The prefix search columns.
*
* @var array
*/
public $columns = [];

/**
* Create a new attribute instance.
*
* @param array|string $columns
* @return void
*/
public function __construct($columns)
{
$this->columns = Arr::wrap($columns);
}
}
11 changes: 11 additions & 0 deletions src/EngineManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Illuminate\Support\Manager;
use Laravel\Scout\Engines\AlgoliaEngine;
use Laravel\Scout\Engines\CollectionEngine;
use Laravel\Scout\Engines\DatabaseEngine;
use Laravel\Scout\Engines\MeiliSearchEngine;
use Laravel\Scout\Engines\NullEngine;
use MeiliSearch\Client as MeiliSearch;
Expand Down Expand Up @@ -136,6 +137,16 @@ protected function ensureMeiliSearchClientIsInstalled()
throw new Exception('Please install the MeiliSearch client: meilisearch/meilisearch-php.');
}

/**
* Create a database engine instance.
*
* @return \Laravel\Scout\Engines\DatabaseEngine
*/
public function createDatabaseDriver()
{
return new DatabaseEngine;
}

/**
* Create a collection engine instance.
*
Expand Down
Loading