Additional nodes for scout search
This commit is contained in:
parent
ab578edaee
commit
0d415c5766
|
|
@ -28,6 +28,19 @@ class SearchController extends Controller
|
|||
|
||||
private array $quotes = [];
|
||||
|
||||
private array $expenses = [];
|
||||
|
||||
private array $credits = [];
|
||||
|
||||
private array $recurring_invoices = [];
|
||||
|
||||
private array $vendors = [];
|
||||
|
||||
private array $vendor_contacts = [];
|
||||
|
||||
private array $purchase_orders = [];
|
||||
|
||||
|
||||
public function __invoke(GenericSearchRequest $request)
|
||||
{
|
||||
if (config('scout.driver') == 'elastic') {
|
||||
|
|
@ -95,6 +108,13 @@ class SearchController extends Controller
|
|||
'client_contacts' => $this->client_contacts,
|
||||
'invoices' => $this->invoices,
|
||||
'quotes' => $this->quotes,
|
||||
|
||||
'expenses' => $this->expenses,
|
||||
'credits' => $this->credits,
|
||||
'recurring_invoices' => $this->recurring_invoices,
|
||||
'vendors' => $this->vendors,
|
||||
'vendor_contacts' => $this->vendor_contacts,
|
||||
'purchase_orders' => $this->purchase_orders,
|
||||
'settings' => $this->settingsMap(),
|
||||
], 200);
|
||||
|
||||
|
|
@ -135,7 +155,7 @@ class SearchController extends Controller
|
|||
break;
|
||||
case 'client_contacts':
|
||||
|
||||
if ($result['_source']['__soft_deleted']) { // do not return deleted contacts
|
||||
if ($result['_source']['__soft_deleted']) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -148,7 +168,7 @@ class SearchController extends Controller
|
|||
break;
|
||||
case 'quotes':
|
||||
|
||||
if ($result['_source']['__soft_deleted']) { // do not return deleted contacts
|
||||
if ($result['_source']['__soft_deleted']) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -160,6 +180,97 @@ class SearchController extends Controller
|
|||
];
|
||||
|
||||
break;
|
||||
|
||||
case 'expenses':
|
||||
|
||||
if ($result['_source']['__soft_deleted']) {
|
||||
break;
|
||||
}
|
||||
|
||||
$this->expenses[] = [
|
||||
'name' => $result['_source']['name'],
|
||||
'type' => '/expense',
|
||||
'id' => $result['_source']['hashed_id'],
|
||||
'path' => "/expenses/{$result['_source']['hashed_id']}"
|
||||
];
|
||||
|
||||
break;
|
||||
|
||||
case 'credits':
|
||||
|
||||
if ($result['_source']['__soft_deleted']) {
|
||||
break;
|
||||
}
|
||||
|
||||
$this->credits[] = [
|
||||
'name' => $result['_source']['name'],
|
||||
'type' => '/credit',
|
||||
'id' => $result['_source']['hashed_id'],
|
||||
'path' => "/credits/{$result['_source']['hashed_id']}"
|
||||
];
|
||||
|
||||
break;
|
||||
|
||||
case 'recurring_invoices':
|
||||
|
||||
if ($result['_source']['__soft_deleted']) {
|
||||
break;
|
||||
}
|
||||
|
||||
$this->recurring_invoices[] = [
|
||||
'name' => $result['_source']['name'],
|
||||
'type' => '/recurring_invoice',
|
||||
'id' => $result['_source']['hashed_id'],
|
||||
'path' => "/recurring_invoices/{$result['_source']['hashed_id']}"
|
||||
];
|
||||
|
||||
break;
|
||||
|
||||
case 'vendors':
|
||||
|
||||
if ($result['_source']['__soft_deleted']) {
|
||||
break;
|
||||
}
|
||||
|
||||
$this->vendors[] = [
|
||||
'name' => $result['_source']['name'],
|
||||
'type' => '/vendor',
|
||||
'id' => $result['_source']['hashed_id'],
|
||||
'path' => "/vendors/{$result['_source']['hashed_id']}"
|
||||
];
|
||||
|
||||
break;
|
||||
|
||||
case 'vendor_contacts':
|
||||
|
||||
if ($result['_source']['__soft_deleted']) {
|
||||
break;
|
||||
}
|
||||
|
||||
$this->vendor_contacts[] = [
|
||||
'name' => $result['_source']['name'],
|
||||
'type' => '/client',
|
||||
'id' => $result['_source']['hashed_id'],
|
||||
'path' => "/clients/{$result['_source']['hashed_id']}"
|
||||
];
|
||||
|
||||
break;
|
||||
|
||||
case 'purchase_orders':
|
||||
|
||||
if ($result['_source']['__soft_deleted']) {
|
||||
break;
|
||||
}
|
||||
|
||||
$this->purchase_orders[] = [
|
||||
'name' => $result['_source']['name'],
|
||||
'type' => '/purchase_order',
|
||||
'id' => $result['_source']['hashed_id'],
|
||||
'path' => "/purchase_orders/{$result['_source']['hashed_id']}"
|
||||
];
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue