Typesense is a fast, typo-tolerant open-source search engine. These exercises cover Typesense's data model, search parameters, faceting, geo-search, and how to integrate it with the popular instant-search.js UI library.
0 / 5 completed
1 / 5
At standup, a colleague asks what a Collection is in Typesense. What is the correct answer?
In Typesense, a Collection is the core data container — equivalent to a table or index in other search engines. You define a schema specifying field names, types (string, int32, float, etc.), and whether each field is facetable or optional. Documents are inserted into a collection, and all search, filter, and sort operations target a specific collection.
2 / 5
During a PR review, a teammate asks what facet_by does in a Typesense search request. Which answer is correct?
facet_by instructs Typesense to compute facet counts for the listed fields. The response includes a facet_counts array with each unique value and how many documents in the result match it. This powers filter sidebar UIs where users see counts like 'Color: Red (15), Blue (9)'. Fields must be declared as facet: true in the collection schema before they can be faceted.
3 / 5
In a design review, the team discusses adding geo-search to a Typesense collection. What is required? What is correct?
Typesense supports geo-search natively. You declare a geopoint field in the collection schema, storing coordinates as a two-element array [latitude, longitude]. At search time, you filter by radius (filter_by=location:(48.8566,2.3522,10 km)) or sort by proximity (sort_by=location(lat,lng):asc). Bounding-box and polygon searches are also supported via the filter syntax.
4 / 5
An incident report shows a Typesense search widget not updating results as users type. A senior engineer asks what instant-search.js integration with Typesense requires. What is correct?
Typesense provides a typesense-instantsearch-adapter package that translates the Algolia InstantSearch protocol into Typesense API calls. You configure the adapter with your Typesense connection details and pass it to InstantSearch as the searchClient. This gives you access to the entire instant-search.js widget ecosystem — SearchBox, Hits, RefinementList, Pagination, etc. — without writing custom search logic.
5 / 5
During a code review, a senior engineer asks what Typesense search parametersquery_by and query_by_weights control. What is accurate?
query_by is a comma-separated list of fields to search (e.g., title,description,tags). query_by_weights assigns an integer importance score to each field in the same order (e.g., 10,5,1). Documents matching the query in a higher-weighted field (like title) rank above matches in lower-weighted fields (like description). This allows fine-grained relevance tuning without custom ranking rules.