Nested join inside facet_by causes request to hang and time out
Describe the bug
When using nested joins in facetBy that reference a second-level nested field ($variantPricing) inside $productVariants, the request consistently times out, even though the same nested structure works correctly in filterBy and includeFields.
This occurs on Typesense v30.0.rca37 and results in a client-side timeout (Future not completed) instead of a server-side validation or error response.
Working query params
{ "collection": "products", "filterBy": "$productVariants(" "$variantPricing(countryCode:=JO) && " "$variantAttributeValues(" "$attributeValues(" "$attributes(id:)" ")" ")" ")", "includeFields": ", " "$productVariants(" ", " "$variantPricing(, strategy: nest_array) as pricing, " "$variantAttributeValues(" ", " "$attributeValues(, $attributes(*)) as attribute, " "strategy: nest_array" ") as attributes, " "strategy: nest_array" ") as variants", "facetBy": "$productVariants(status)", }
Not working query params (times out):
{ "collection": "products", "filterBy": "$productVariants(" "$variantPricing(countryCode:=JO) && " "$variantAttributeValues(" "$attributeValues(" "$attributes(id:)" ")" ")" ")", "includeFields": ", " "$productVariants(" ", " "$variantPricing(, strategy: nest_array) as pricing, " "$variantAttributeValues(" ", " "$attributeValues(, $attributes(*)) as attribute, " "strategy: nest_array" ") as attributes, " "strategy: nest_array" ") as variants", "facetBy": "$productVariants(status, $variantPricing(pricing.totalPrice))", }
Steps to reproduce the behavior:
- Use Typesense v30.0.rca37
- Create a collection with nested relationships similar to: products, productVariants, variantPricing
- Run a search query where: filterBy uses nested joins on $productVariants → $variantPricing includeFields includes the same nested joins
- Add a facetBy clause referencing a nested field inside $variantPricing, for example: facetBy: "$productVariants(status, $variantPricing(pricing.totalPrice))"
- Execute the query
Expected behavior
The query succeeds and returns facets for productVariants.status and variantPricing.pricing.totalPrice
Actual behavior
TimeoutException after 0:00:10.000000: Future not completed
Additional context
The exact same nested structure works correctly in: • filterBy • includeFields The issue appears specific to nested joins inside facetBy