Appearance
Search ​
Overview ​
Search has two halves. Laravel Scout keeps four Typesense collections in sync with MySQL; the admin app queries those collections itself, through its own Nitro proxy route, not through Backend-API (see Search & Discovery on the frontend side). The backend's own search endpoints do two other jobs: they return the filter options (tags, file types, custom fields, collages, uploaders) for the admin search panel, and they run MySQL LIKE searches for the Portal and External APIs.
Scout config is in config/scout.php. The engine comes from SCOUT_DRIVER; the file carries a typesense section with a collection schema for each searchable model. Queued indexing runs on the medium queue of SCOUT_CONNECTION. after_commit and soft_delete are both false.
| Model | Indexed when (shouldBeSearchable) | Main fields |
|---|---|---|
DigitalAssets | not archived, not deleted, not final deleted, has a category_id | display_file_name, search_name, description, file_type (facet), type, sizes, orientation, instance_visibility, category_id, collection_ids, created_by, tags (facet), custom_fields, custom_field_values, portal_custom_fields, portal_custom_field_values, breadcrumb, created_at, modified_at |
DigitalAssetsCategory | visible_in_trashed = 0 and not final deleted | folder_name, search_name, description, parent_id, breadcrumb, instance_visibility |
DamCollection | always | collection_name, search_name, description, preview_images, assets_count, assets_id, instance_visibility, created_by |
DigitalAssetsTag | has a tag_name and its asset is live and in a folder | tag_name (facet), search_name (facet) |
instance_visibility holds the ids of portals where the item is public (DamInstancePermission.visibility = 0; for collages, any permission row), or [0] when it is public nowhere. Uncategorised uploads are never in the index.
Endpoints ​
Admin API (/api/v1/digital-assets) ​
| Method | Path | Controller@method | Purpose |
|---|---|---|---|
| GET | /get-search-data | Search\SearchController@getSearchData | Filter options for the whole workspace |
| GET | /inner-search-data | Search\SearchController@getInnerSearchData | Filter options inside one folder (category_id) or collage (collection_id) |
| GET | /recent-search | Search\SearchController@getRecentData | Last 5 keyword searches |
| POST | /recent-search | Search\SearchController@addRecentData | Save a keyword search |
| POST | /get-suggest-tag-list, /get-common-tag-list | TagController@getSuggestTagList, @getCommonTagList | Tag suggestions |
Portal API (/dam/v1/digital) ​
| Method | Path | Controller@method | Purpose |
|---|---|---|---|
| GET | /get-search-data, /inner-search-data | DashboardController@getSearchData, @getInnerSearchData | Filter options for the portal |
| POST | /search-assets | AssetController@SearchAllPopularData | Search with filters, logs history |
| POST | /common-search | AssetController@commonSearchData | Quick search across names and tags |
| GET | /popular-tag-assets | AssetController@getAssetsByTagName | Assets for a popular tag |
| GET POST | /recent-search | AssetController@getRecentSearchData, @addRecentSearchData | Recent searches |
| POST | /recent-search-remove, /recent-search-clear | AssetController@deleteRecentSearchData, @clearRecentSearchData | Hide one or all recent searches |
External and public ​
| Method | Path | Controller@method | Purpose |
|---|---|---|---|
| POST | /external/v1/search-assets | External\AssetsController@SearchAssets | Search by name or tag for an ACL role |
| POST | /api/v1/search-share-data, /dam/v1/search-share-data | ShareAssetsController@searchShareData | Search inside a share link |
Workflows ​
Keeping the index in sync ​
Because bulk update() calls skip model events, controllers reindex by hand: upload and version upload reindex inline with scout.queue turned off, move and restore reindex the affected folders, assets and tags, trash calls unsearchable() first. Collage membership changes reindex the assets because asset documents carry collection_ids. Portal visibility changes reindex the item and its subtree. typesense:smart-sync compares MySQL and Typesense counts per workspace and model, syncs on mismatch, then reindexes records updated in the last --hours (default 24). Other commands for manual use: scout:import-all, typesense:sync-data, typesense:workspace-sync, typesense:compare-data, typesense:daily-sync.
Admin filter options ​
uploaded_by merges admin users and external upload users. inner-search-data needs category_id or collection_id (one of them, both integers) and narrows every list to the assets in that folder or collage.
Portal search ​
Portal search does not use Typesense. Results are limited to assets public in the partner's portal (instanceVisible scope: a permission row with visibility = 0) and to live, categorised assets. Recent searches are stored in dam_search_histories and hidden with is_clear = 1 rather than deleted.
Search history ​
Both the admin and portal endpoints write user_type = 'admin' and search_by = 'web'; the user id keeps them apart.
Data ​
| Model / table | Use |
|---|---|
DigitalAssets, DigitalAssetsCategory, DamCollection, DigitalAssetsTag | Searchable models |
DamSearchHistory / dam_search_histories | Recent and popular searches |
DamInstancePermission | Source of instance_visibility |
Related ​
- Assets, Folders, Collages, Portals
- Jobs for
ReindexAssetsByIds,ReindexAssetTagsByAssetIds - DAM models
- Frontend: Search & Discovery