Hi if I have two collections that are joined toget...
# community-help
j
Hi if I have two collections that are joined together by an id, is it possible to have a query on both of them and then join them together (not a filter)? For example I have a collection with names and a collection with addresses and both have a
brand_id
on it. In one query can i fuzzy match on the
name
column of one collection, the
street_address
of the address collection and then join the results? If not, to achieve this would I need to put them into a single collection or do a multis search? My fear for multi search is the throughput, as I eventually want to search by more things and am afraid of multi searching across many collections. Thank you
f
If one brand id does not reference the other one, joining isn't possible. You could save them both on the same collection
j
There would be a reference between tables
f
Why not join with filters? It's the only way to perform a join in Typesense directly
j
I guess my use case is I want to query by a name, and by the address. So if a user inputs
q=Targ, New York
I want to search for all brands that match that criteria, but I want fuzzy matching in case of spelling mistakes, etc. Is it possible to do that if the data is on two different collections being joined together?
SO I have collection 1
Names
schema
{name: str, some_id_ref: str}
collection 2
Addresses
schema
{state: str, some_id_ref: str}
Can I do something like
q=Targ, New York
query_by=Names.name,Addresses.state
+ the joining logic obv
f
The
q
parameter will be used verbatim across all
query_by
fields. Using a comma won't spread it for the other
query_by
fields. The only thing that isn't possible by joins currently is querying by a joined field (say collection has a
brand_name
and a reference to collection b, you can't query by
$brand_name
on collection b)
For what you're describing I'd save them on the same collection, since you're searching by joined fields
j
Ok thank you!
🙌 1
f
You're welcome!