# CARO Search Discussion
## Current Search
* Only supports tenants searches
* Uses a scopedKeyToken using the tenantId and responds results with that tenantId indexed in the collection
## Admin Search
Seems pretty straightforward admins should have access to all the data in the database for viewing so we do not need any sort of restrictions.
### Searchable Entities
1. Tenants
2. Service Providers
## Service Provider Search
This one seems complicated because we need to have separate searches specific to vrs-providers and credential issuers. It makes sense to use the scopedKey in this as well since this way we'll be able to scope the results for specific service providers only.
### Searchable Entities
#### VRS Provider
* Events
* Correlation Reports
* Identifiers
* Customers
#### Credential Issuer
* Credentials
* Onboardings
* Customers
* Identifiers??
Now the tricky part. We do not have any connections at the moment between Events and VRS, so we do not know which event was triggered by which VRS Provider. Same with the Correlation Report.
Onboardings do have a direct connection to the credential issuer, but Credential do not have that direct link, but do have an implicit link (Credential -> Onboarding -> ServiceProviderId).
## Point of Discussion
1. Do we make an implicit connection in the typesense collection for these entities and not in the database? Maybe we can make some on the database level for **Events**, and **Onboardings**, and **Correlation Reports** and **Credentials** we can have it on a typesense level. This does help us reduce redundancy at a database level, but then we'll have to manage separate data on a typesense colelction, also need to think about it while indexing on a new creation of that item. We already do have connections for customers.
2. We need to keep in account typesense collection while doing deletions for any entity as well.
3. Do we want **USERS** to be searchable by platform admins as well? If we do want that, how does that work because we currently do not have any users in our system on an entity level, so we need to fetch from auth0 and then index them on typesense. Keep in mind we'd have to index every new user to the collection as well.
## Frontend Design
At the moment we currently only have one search button for tenants, but when tackling this for **Service Providers** and **Admins** how do we see that? Dennis suggested to have separate tabs for the specific roles for searches, so we can segragate the results from each tabs separately. Because Credentials for a Tenant and Credentials for a Credential Issuer will be completely different.