Hey everyone, Hope you’re all doing well! I’m JD...
# community-help
j
Hey everyone, Hope you’re all doing well! I’m JD, the lead engineer at WorkMade, a FinTech startup. We’re in the process of implementing
global search
in our mobile app and are planning to use Typesense for this feature. As we reviewed the documentation, we noticed that Typesense requires defining documents based on the structure of the data. Since we’re dealing with multiple tables (like
transactions
,
externalTransactions
,
taxCalculations
,
yearlyTaxSummaries
, etc.), I wanted to get some guidance on the best architectural approach. Here’s our core question: To support global search across all these data types, should we: 1.
Create one unified document schema
that merges relevant fields from all the tables into a single collection/document type? 2. Or
create multiple collections
, one per table, and query them independently? Also, how does
global search work
across multiple documents/collections in Typesense? Does it support cross-collection search natively or would we need to stitch results together manually? Any insights, best practices, or examples would be really appreciated. We’re just getting started with Typesense, so trying to understand what makes the most sense long term. Thanks so much in advance! JD, WorkMade
f
It depends on how you want to categorize things. For example, if you want to have different sections on the results (a great example of this https://hem.com, try searching for rug, there's results from products, material samples, designers), you can break them into different collections. On an e-commerce environment, you could have had many different categories in different tables in your RDMS, but it would be best to bunch everything up into a single collection with a category field that's facetable. Typesense can handle querying multiple collections at the same time using the Multisearch feature: https://typesense.org/docs/29.0/api/federated-multi-search.html#multi-search-parameters You can even have a single set of results from multiple queries through Union search as well: https://typesense.org/docs/29.0/api/federated-multi-search.html#union-search
j
Thanks @Fanis Tharropoulos Will take a look on this