Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typesense: Added latency due to unnecessary collection check before search #897

Closed
tharropoulos opened this issue Dec 18, 2024 · 0 comments · Fixed by #898
Closed

Typesense: Added latency due to unnecessary collection check before search #897

tharropoulos opened this issue Dec 18, 2024 · 0 comments · Fixed by #898

Comments

@tharropoulos
Copy link
Contributor

Scout Version

10.11.0

Scout Driver

Typesense

Laravel Version

11.35.1

PHP Version

8.4.1

Database Driver & Version

No response

SDK Version

v27.1

Meilisearch CLI Version

No response

Description

Currently, every search operation triggers an additional GET request to /collections/users
that checks if the collection exists. As collections grow in size and number of fields,
this verification step introduces significant latency before the actual search request.

A user reported via email that while the search endpoint itself is very fast (~10ms),
they're seeing an extra GET request to verify collection existence before each search.
For large collections with many fields, this verification step is adding noticeable
overhead to every search operation.

I'll submit a PR that skips the collection existence check for search operations while
maintaining it for index operations. This change shouldn't introduce any issues, as search operations
will fail regardless if the collection doesn't exist in Typesense.

Steps To Reproduce

  1. Set up Laravel Scout with Typesense driver
  2. Create a model with a large number of searchable fields
  3. Enable debug logging for HTTP requests
  4. Perform a search operation using Scout
  5. Check the logs to observe two requests:
    • First request to /collections/users to verify collection
    • Second request to /collections/users/documents/search for actual search
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant