Hi Team, I’m using React InstantSearch with the Ty...
# community-help
v
Hi Team, I’m using React InstantSearch with the Typesense adapter on a self-hosted Typesense setup, and I'm running into performance issues with the initial empty search (
q: "*"
) on page load. Even though I’m only fetching 20 results, the query takes over 8 seconds to respond. Here's the query: Search Payload:
Copy code
{
  "collection": "DFXApp",
  "q": "*",
  "query_by": "system,ocr_data",
  "group_limit": "1",
  "exclude_fields": "embedding",
  "per_page": 20,
  "page": 1,
  "sort_by": "system.lf.file.properties.ModifiedDate:desc",
  "highlight_full_fields": "system,ocr_data",
  "facet_by": "system.lf.file.properties.CreatedBy,system.lf.file.properties.CreatedDate,system.lf.file.properties.Extension,system.lf.file.properties.ModifiedDate,system.lf.file.properties.template.template_fields.Client Id,system.lf.file.properties.template.template_fields.Client Name,system.lf.file.properties.template.template_name",
  "max_facet_values": 20
}
R*esponse:* {
Copy code
"found": 441715,
  "out_of": 441716,
  "page": 1,
  "search_time_ms": 8800
}
How to reduce the response time to under 100ms (or as close as possible). Does anyone have tips on: • Optimizing performance for an empty search (
q: "*"
)? • Best practices for handling large document collections (440k+) with heavy faceting and sorting? Thanks in advance!
when I include infix params, response time is still getting increased Payload:{ "query_by": "system.lf.file.properties.EntryName, system.lf.file.properties.EntryID, ocr_data, system.lf.file.properties.template.template_name, system.lf.file.properties.template.template_fields.Document Type, system.lf.file.properties.template.template_fields.Document Sub Type, system.lf.file.properties.template.template_fields.Client Name, system.lf.file.properties.CreatedBy, system.lf.file.properties", "group_by": "system.lf.file.properties.EntryID", "group_limit": "1", "exclude_fields": "embedding", "infix": "always,off,off,always,always,always,always,off,off", "highlight_full_fields": "system.lf.file.properties.EntryName, system.lf.file.properties.EntryID, ocr_data, system.lf.file.properties.template.template_name, system.lf.file.properties.template.template_fields.Document Type, system.lf.file.properties.template.template_fields.Document Sub Type, system.lf.file.properties.template.template_fields.Client Name, system.lf.file.properties.CreatedBy, system.lf.file.properties", "collection": "DFXApp", "q": "*", "facet_by": "system.lf.file.properties.CreatedBy,system.lf.file.properties.CreatedDate,system.lf.file.properties.Extension,system.lf.file.properties.ModifiedDate,system.lf.file.properties.template.template_fields.Client Id,system.lf.file.properties.template.template_fields.Client Name,system.lf.file.properties.template.template_name", "max_facet_values": 20, "page": 1 }
f
Infix is taxing on the CPU and will always take a load in response times. You're faceting by a large number of fields. Maybe take a look at `facet_sample_percent`:
j
In addition to what Fanis mentioned, we have some performance improvements for
group_by
in
29.0.rc19
. So you want to try upgrading to that. I'd also recommend enabling caching for that query using the
use_cache=true
parameter (default TTL is 60s)
❤️ 2
👍 1
m
@Jason Bosco Really happy to hear about the performance improvements for group_by. I use that a lot here and that will help to reduce my headaches. Thanks!