@Rob Bast
Let me clarify the confusion.
When a customer places an order, it looks like this:
P1:Q1, P2:Q2, ...
This means the customer needs
Q1 quantity of Part P1,
Q2 quantity of Part P2, and so on.
Now, to fulfill this order, we need to find the best supplier(s). For that, we calculate a
score for each supplier based on the order.
We prefer to calculate scores
after filtering suppliers using
Typesense, instead of calculating for every supplier.
Why?
Let’s take an example where we filter suppliers by
distance from the customer:
• Total suppliers:
50
• Suppliers within 10 km:
10
• Suppliers beyond 10 km:
40
Option 1: Calculate Scores Before Using Typesense
We calculate scores for
all 50 suppliers, then pass them to Typesense to apply filters like distance.
Option 2: Typesense to Filter First and Execute algo for filtered suppliers only
Typesense filters suppliers based on distance and finds the
10 relevant ones.
Then,
only for these 10, TS run our score calculation logic (e.g., via a Typesense hook).
This is faster and more efficient.
📌 Note: Distance is just one filter. We apply many filters (like discounts, ratings, etc.) to select suitable suppliers.