db/typesense
A Typesense client: collections, documents, typo tolerant, faceted, grouped, vector and union search, synonyms, curation, API keys, analytics and clusters.
import db.typesense
Typesense is an open source search engine with typo tolerance, filters, facets, grouping, vector and hybrid search. This package speaks its HTTP API directly with net.httpx and covers all of it: collections and their fields, documents one at a time or in bulk JSONL imports and exports, every search parameter, multi search and union search, synonym sets and curation sets, presets, stopwords, stemming dictionaries, API keys and scoped search keys signed with no request, analytics rules and events, conversation (RAG) models, natural language search models and the cluster operations. The examples need a running server, so they are only checked.
Every call takes an Error as its last argument and fills it when something fails; check it with Ok, or with IsNotFound and IsConflict for the two answers code usually handles. A client can hold several nodes: a node that does not answer, or answers with a 5xx, is skipped for healthcheck_ms and the request moves to the next one, the same way the official clients behave. Documents and hits come back as raw JSON text; read them into your own structs with GetDocumentAs and HitsAs, and send your structs with ImportOf and CreateDocumentOf. Typesense 30 replaced per collection synonyms and overrides with synonym sets and curation sets; both kinds are here, so the package works with 29 and 30 servers alike. For a route with no function of its own, use Request.
New to Typesense? The Search with Typesense lesson builds a small catalog step by step, with the output of every example.
Types
Client
struct ClientNew or NewCluster and release it with Free.| Name | Type | Description |
|---|---|---|
nodes | Vector | The node URLs, such as http://localhost:8108; a path after the host is kept as a prefix. |
nearest | str = "" | A node to try before the others, such as the one in the same region; empty for none. |
api_key | str = "" | The key sent in the X-TYPESENSE-API-KEY header. |
timeout_ms | int = 10000 | How long one request may take, in milliseconds; 0 waits forever. |
retries | int = 3 | How many more times to try after a node fails. |
retry_interval_ms | int = 100 | The pause between two tries, in milliseconds. |
healthcheck_ms | int = 60000 | How long a node that failed is skipped, in milliseconds. |
headers | Vector | Extra header lines added with AddHeader. |
state | Vector | Internal: the round robin position and when each node may be tried again. |
/*
* Salam Programming Language (2024-2026)
*
* +-------------------+
* | S A L A M |
* +-------------------+
*
* Designed by Seyyed Ali Mohammadiyeh and the Salam Team
* Born from a decade of language design experience (since 2018)
*
* Repository: https://github.com/SalamLang/Salam
*
*/
import db.typesense
func main:
mut nodes := Vector {} as Vector<str>
nodes.push("http://ts-1:8108")
nodes.push("http://ts-2:8108")
nodes.push("http://ts-3:8108")
mut c := typesense.NewCluster(nodes, "admin-key")
defer typesense.Free(c)
typesense.SetNearestNode(c, "http://ts-local:8108")
typesense.AddNode(c, "http://ts-4:8108")
typesense.AddHeader(c, "X-Request-Source", "salam")
c.timeout_ms = 5000
c.retries = 2
c.retry_interval_ms = 200
c.healthcheck_ms = 30000
mut err := typesense.Error {}
if not typesense.Health(c, err):
println "not ready: " + typesense.ErrorString(err)
ret 1
end
println typesense.IsHealthy(c), typesense.NodeHealthy(c, 0), typesense.NodeHealthy(c, -1)
println "server", typesense.ServerVersion(c, err), typesense.Debug(c, err)
st := typesense.Status(c, err)
println st.state, st.committed_index, st.queued_writes
println typesense.Stats(c, err)
println typesense.Metrics(c, err)
println typesense.CreateSnapshot(c, "/data/snapshots/today", err)
println typesense.Vote(c, err), typesense.ClearCache(c, err), typesense.CompactDB(c, err), typesense.ResetPeers(c, err)
println typesense.SchemaChanges(c, err).len()
println typesense.SetSlowRequestLog(c, 1000, err), typesense.UpdateConfig(c, `{"healthy-read-lag": 1000}`, err)
body := typesense.Request(c, "GET", "/collections?limit=1", "", err)
if not typesense.Ok(err):
println err.status, err.kind, err.message
println err.kind == typesense.KIND_HTTP, err.kind == typesense.KIND_NETWORK, err.kind == typesense.KIND_INVALID, err.kind == typesense.KIND_DECODE
println typesense.IsNotFound(err), typesense.IsConflict(err)
ret 1
end
println body
println typesense.RequestAs(c, "POST", "/stemming/dictionaries/import?id=plurals", "text/plain", `{"word":"mice","root":"mouse"}`, err)
println typesense.VERSION, c.nodes.len(), c.nearest, c.api_key.len(), c.headers.len(), c.state.len()
single := typesense.New("localhost:8108", "admin-key")
println single.nodes.get(0)
endError
struct Error| Name | Type | Description |
|---|---|---|
status | int = 0 | The HTTP status, or 0 when there was no answer. |
kind | str = "" | One of the KIND_ constants, or empty when the call worked. |
message | str = "" | The message from the server, or a description of the failure. |
The example for this item is shown with the ones above: db-typesense-Client.salam
ClusterStatus
struct ClusterStatus| Name | Type | Description |
|---|---|---|
state | str = "" | LEADER, FOLLOWER or another raft state. |
committed_index | i64 = 0 | The last committed raft index. |
queued_writes | i64 = 0 | Writes waiting to be applied. |
The example for this item is shown with the ones above: db-typesense-Client.salam
AnalyticsRule
struct AnalyticsRule| Name | Type | Description |
|---|---|---|
name | str = "" | Its name. |
kind | str = "" | One of the RULE_ constants. |
collection | str = "" | The collection whose events it collects. |
event_type | str = "" | One of the EVENT_ constants. |
rule_tag | str = "" | A tag to list rules by. |
params | str = "" | The rule parameters, as JSON, such as {"destination_collection":"pq","limit":100}. |
raw | str = "" | The whole rule, as JSON; the only place a Typesense 29 rule keeps its source and destination. |
/*
* Salam Programming Language (2024-2026)
*
* +-------------------+
* | S A L A M |
* +-------------------+
*
* Designed by Seyyed Ali Mohammadiyeh and the Salam Team
* Born from a decade of language design experience (since 2018)
*
* Repository: https://github.com/SalamLang/Salam
*
*/
import db.typesense
func main:
c := typesense.New("http://localhost:8108", "admin-key")
mut err := typesense.Error {}
popular := typesense.AnalyticsRule {
name = "popular-searches", kind = typesense.RULE_POPULAR_QUERIES, collection = "books", event_type = typesense.EVENT_SEARCH,
params = `{"destination_collection": "popular_queries", "limit": 1000}`
}
println typesense.AnalyticsRuleJSON(popular)
made := typesense.CreateAnalyticsRule(c, popular, err)
println made.name, made.kind, made.collection, made.event_type, made.params
clicks := typesense.AnalyticsRule {
name = "book-clicks", kind = typesense.RULE_COUNTER, collection = "books", event_type = typesense.EVENT_CLICK,
rule_tag = "homepage", params = `{"destination_collection": "books", "counter_field": "popularity", "weight": 1}`
}
println typesense.UpsertAnalyticsRule(c, clicks, err).rule_tag
println typesense.CreateAnalyticsRuleJSON(c, `{"name": "no-results", "type": "nohits_queries", "collection": "books", "event_type": "search", "params": {"destination_collection": "nohits", "limit": 100}}`, err)
println typesense.UpsertAnalyticsRuleJSON(c, "old-style", `{"type": "popular_queries", "params": {"source": {"collections": ["books"]}, "destination": {"collection": "pq"}}}`, err)
println typesense.GetAnalyticsRule(c, "book-clicks", err).raw
each r in typesense.ListAnalyticsRules(c, "homepage", err):
println r.name, r.kind
end
println typesense.SendEvent(c, "book-clicks", typesense.EVENT_CLICK, `{"doc_id": "42", "user_id": "u-7"}`, err)
println typesense.SendEventJSON(c, `{"name": "book-clicks", "event_type": "click", "data": {"doc_id": "43", "user_id": "u-7"}}`, err)
each e in typesense.GetEvents(c, "u-7", "book-clicks", 20, err):
println e
end
println typesense.FlushAnalytics(c, err), typesense.AnalyticsStatus(c, err)
println typesense.DeleteAnalyticsRule(c, "no-results", err)
println typesense.RULE_LOG, typesense.EVENT_CONVERSION, typesense.EVENT_VISIT, typesense.EVENT_CUSTOM
m := typesense.ConversationModel {
id = "books-assistant", model_name = "openai/gpt-4o-mini", api_key = "sk-...", history_collection = "conversations",
system_prompt = "You recommend books from our catalog.", max_bytes = 16384, ttl = 86400, account_id = "", vllm_url = "", extra = ""
}
println typesense.ConversationModelJSON(m)
println typesense.CreateConversationModel(c, m, err)
println typesense.GetConversationModel(c, "books-assistant", err)
println typesense.ListConversationModels(c, err).len()
println typesense.UpdateConversationModel(c, "books-assistant", typesense.ConversationModel { system_prompt = "Answer in one sentence." }, err)
println typesense.DeleteConversationModel(c, "books-assistant", err)
println typesense.CreateNLSearchModel(c, `{"id": "gpt-4o-nl", "model_name": "openai/gpt-4o-mini", "api_key": "sk-...", "max_bytes": 16000}`, err)
println typesense.GetNLSearchModel(c, "gpt-4o-nl", err)
println typesense.ListNLSearchModels(c, err).len()
println typesense.UpdateNLSearchModel(c, "gpt-4o-nl", `{"temperature": 0.0}`, err)
println typesense.DeleteNLSearchModel(c, "gpt-4o-nl", err)
endConversationModel
struct ConversationModel| Name | Type | Description |
|---|---|---|
id | str = "" | Its id. |
model_name | str = "" | The model, such as openai/gpt-4o. |
api_key | str = "" | The key for the model provider. |
history_collection | str = "" | The collection that keeps conversation history. |
system_prompt | str = "" | The instructions given to the model. |
max_bytes | int = 0 | How much context the model receives. |
ttl | int = 0 | How long a conversation is kept, in seconds. |
account_id | str = "" | The account id, for Cloudflare models. |
vllm_url | str = "" | The server URL, for vLLM models. |
extra | str = "" | More members as a JSON object. |
The example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
SearchParams
struct SearchParamsSet.| Name | Type | Description |
|---|---|---|
q | str = "" | The text to search for; * matches every document. |
query_by | str = "" | The fields to search, comma separated. |
query_by_weights | str = "" | The weight of each field in query_by, such as 2,1. |
text_match_type | str = "" | How field scores combine: max_score, max_weight or sum_score. |
prefix | str = "" | Whether the last word matches as a prefix, one value per field such as true,false. |
infix | str = "" | Infix search per field: off, always or fallback. |
filter_by | str = "" | A filter, such as year:>2000 && genre:=[scifi]. |
sort_by | str = "" | The sort order, such as year:desc,_text_match:desc. |
facet_by | str = "" | Fields to count values of. |
facet_query | str = "" | Narrow the facet values, such as genre:sci. |
max_facet_values | int = 0 | How many values each facet returns. |
group_by | str = "" | Group the results by these fields. |
group_limit | int = 0 | How many hits each group returns. |
include_fields | str = "" | Return only these fields. |
exclude_fields | str = "" | Leave these fields out of the results. |
highlight_fields | str = "" | Highlight only these fields. |
highlight_full_fields | str = "" | Highlight the whole value of these fields, not a snippet. |
highlight_start_tag | str = "" | The tag before a match; <mark> by default. |
highlight_end_tag | str = "" | The tag after a match. |
snippet_threshold | int = 0 | Fields shorter than this many words are highlighted whole. |
num_typos | str = "" | How many typos a word may have, 0 to 2, one value per field. |
typo_tokens_threshold | int = 0 | Look for typo matches only when fewer results than this were found. |
drop_tokens_threshold | int = 0 | Drop words from the query only when fewer results than this were found. |
page | int = 0 | The page, from 1. |
per_page | int = 0 | Hits per page, up to 250. |
offset | int = 0 | Skip this many hits; an alternative to page. |
limit | int = 0 | Return this many hits; used with offset. |
pinned_hits | str = "" | Pin documents to positions, such as 12:1,3:2. |
hidden_hits | str = "" | Ids of documents to hide. |
override_tags | str = "" | Apply only the curation rules with these tags. |
preset | str = "" | Use the parameters saved in this preset. |
vector_query | str = "" | A nearest neighbour search, such as embedding:([0.1, 0.2], k: 10). |
stopwords | str = "" | A stopword set to apply. |
exhaustive_search | bool = false | Consider every variation of the query, slower but complete. |
search_cutoff_ms | int = 0 | Stop searching after this many milliseconds and return what was found. |
use_cache | bool = false | Cache the results on the server. |
cache_ttl | int = 0 | How long to cache them, in seconds. |
conversation | bool = false | Answer the query with a conversation model (RAG). |
conversation_id | str = "" | Continue this conversation. |
conversation_model_id | str = "" | The conversation model to use. |
nl_query | bool = false | Turn a natural language query into filters and sorting with an NL search model. |
nl_model_id | str = "" | The NL search model to use. |
keys | Vector | Parameter names added with Set. |
values | Vector | Their values. |
/*
* Salam Programming Language (2024-2026)
*
* +-------------------+
* | S A L A M |
* +-------------------+
*
* Designed by Seyyed Ali Mohammadiyeh and the Salam Team
* Born from a decade of language design experience (since 2018)
*
* Repository: https://github.com/SalamLang/Salam
*
*/
import str
import db.typesense
struct Book:
pub id: str = ""
pub title: str = ""
pub year: int = 0
end
func main:
c := typesense.New("http://localhost:8108", "search-key")
mut err := typesense.Error {}
mut p := typesense.NewSearch("dune", "title,description")
p.query_by_weights = "3,1"
p.filter_by = "year:>1950 && genres:=[scifi]"
p.sort_by = "_text_match:desc,year:desc"
p.facet_by = "genres,year"
p.max_facet_values = 10
p.per_page = 20
p.page = 1
p.num_typos = "2,1"
p.highlight_start_tag = "<b>"
p.highlight_end_tag = "</b>"
typesense.Set(p, "prioritize_exact_match", "false")
println typesense.SearchQuery(p)
println typesense.SearchParamsJSON(p)
r := typesense.Search(c, "books", p, err)
if not typesense.Ok(err):
println typesense.ErrorString(err)
ret 1
end
println r.found, r.out_of, r.page, r.search_time_ms, r.search_cutoff
each h in r.hits:
println h.document, h.text_match, h.curated, typesense.Highlight(h, "title")
println h.highlight, h.highlights, h.text_match_info, h.vector_distance, h.geo_distance_meters, h.hybrid_search_info, h.raw.len()
end
each f in r.facets:
print f.field_name, f.sampled, f.stats, ":"
each fc in f.counts:
print " " + fc.value + "=" + fc.count + " " + fc.highlighted
end
println ""
end
mut books := Vector {} as Vector<Book>
if typesense.HitsAs(r, books, err):
println books.len()
end
println r.request_params, r.raw.len()
mut g := typesense.NewSearch("*", "")
g.group_by = "genres"
g.group_limit = 3
g.include_fields = "id,title"
rg := typesense.Search(c, "books", g, err)
println rg.found, rg.found_docs
each grp in rg.groups:
println str.Join(grp.key, ","), grp.found, grp.hits.len()
end
mut v := typesense.NewSearch("*", "")
v.vector_query = "embedding:([0.12, 0.45, 0.87], k: 10)"
v.exclude_fields = "embedding"
println typesense.SearchRaw(c, "books", v, err)
mut rag := typesense.NewSearch("which books are about deserts?", "title_vector")
rag.conversation = true
rag.conversation_model_id = "books-assistant"
rag.conversation_id = ""
rag.prefix = "false"
rag.exhaustive_search = true
rag.search_cutoff_ms = 200
rag.use_cache = true
rag.cache_ttl = 60
println typesense.Search(c, "books", rag, err).conversation
mut nl := typesense.NewSearch("science fiction books after 1960 sorted by year", "title")
nl.nl_query = true
nl.nl_model_id = "gpt-4o-nl"
println typesense.Search(c, "books", nl, err).parsed_nl_query
mut reqs := Vector {} as Vector<typesense.SearchRequest>
reqs.push(typesense.SearchRequest { collection = "books", params = typesense.NewSearch("dune", "") })
reqs.push(typesense.SearchRequest { collection = "authors", params = typesense.NewSearch("herbert", "name"), api_key = "scoped-key" })
common := typesense.NewSearch("", "title")
each m in typesense.MultiSearch(c, reqs, common, err):
println m.found, m.code, m.error
end
println typesense.MultiSearchRaw(c, reqs, common, err).len()
u := typesense.UnionSearch(c, reqs, common, err)
each h in u.hits:
println h.collection, h.search_index, h.document
end
mut rr := typesense.ParseSearchResult(`{"found": 0, "hits": []}`)
println rr.found, rr.code, rr.error, typesense.MAX_GET_QUERY
typesense.FreeResult(rr)
endSearchRequest
struct SearchRequest| Name | Type | Description |
|---|---|---|
collection | str = "" | The collection to search. |
params | SearchParams | Its parameters. |
api_key | str = "" | A different API key for this search only, such as a scoped key. |
The example for this item is shown with the ones above: db-typesense-Search.salam
Hit
struct Hit| Name | Type | Description |
|---|---|---|
document | str = "" | The document, as JSON. |
text_match | i64 = 0 | The text relevance score. |
highlight | str = "" | The highlights by field, as JSON; read one with Highlight. |
highlights | str = "" | The highlights in the older list form, as JSON. |
text_match_info | str = "" | How the score was made, as JSON. |
geo_distance_meters | str = "" | The distance from a geo sort point, as JSON. |
vector_distance | f64 = 0 | The distance from the query vector. |
hybrid_search_info | str = "" | How a hybrid search ranked it, as JSON. |
curated | bool = false | It was placed by a curation rule. |
collection | str = "" | The collection it came from, in a union search. |
search_index | int = 0 | Which search of a union search found it, from 0. |
raw | str = "" | The whole hit, as JSON. |
The example for this item is shown with the ones above: db-typesense-Search.salam
FacetCount
struct FacetCount| Name | Type | Description |
|---|---|---|
value | str = "" | The value. |
count | i64 = 0 | How many hits have it. |
highlighted | str = "" | The value with the facet query highlighted. |
The example for this item is shown with the ones above: db-typesense-Search.salam
Facet
struct Facet| Name | Type | Description |
|---|---|---|
field_name | str = "" | The field. |
counts | Vector | The values, most common first. |
sampled | bool = false | The counts were estimated from a sample. |
stats | str = "" | Minimum, maximum, sum and average of a number field, as JSON. |
The example for this item is shown with the ones above: db-typesense-Search.salam
Group
struct Groupgroup_by.| Name | Type | Description |
|---|---|---|
key | Vector | The values that make the group. |
found | i64 = 0 | How many hits the group has. |
hits | Vector | Its hits, up to group_limit. |
The example for this item is shown with the ones above: db-typesense-Search.salam
SearchResult
struct SearchResult| Name | Type | Description |
|---|---|---|
found | i64 = 0 | How many documents matched, or how many groups when grouping. |
found_docs | i64 = 0 | How many documents matched, when grouping. |
out_of | i64 = 0 | How many documents were searched. |
page | int = 0 | The page. |
search_time_ms | i64 = 0 | How long the search took. |
search_cutoff | bool = false | The search stopped at search_cutoff_ms. |
hits | Vector | The hits. |
groups | Vector | The groups, when grouping. |
facets | Vector | The facet counts. |
request_params | str = "" | The parameters the server used, as JSON. |
conversation | str = "" | The conversation answer, as JSON. |
parsed_nl_query | str = "" | What a natural language query was turned into, as JSON. |
code | int = 0 | In a multi search, the HTTP status of this search when it failed. |
error | str = "" | In a multi search, why this search failed. |
raw | str = "" | The whole answer, as JSON. |
The example for this item is shown with the ones above: db-typesense-Search.salam
KeySpec
struct KeySpec| Name | Type | Description |
|---|---|---|
description | str = "" | What the key is for. |
actions | Vector | What it may do, such as documents:search or *. |
collections | Vector | Which collections it may use; * for all, and patterns such as org_.* work. |
expires_at | i64 = 0 | A Unix time when it stops working; 0 for never. |
value | str = "" | The key text to use; empty lets the server make one. |
autodelete | bool = false | Delete the key once it expires. |
/*
* Salam Programming Language (2024-2026)
*
* +-------------------+
* | S A L A M |
* +-------------------+
*
* Designed by Seyyed Ali Mohammadiyeh and the Salam Team
* Born from a decade of language design experience (since 2018)
*
* Repository: https://github.com/SalamLang/Salam
*
*/
import db.typesense
func main:
c := typesense.New("http://localhost:8108", "admin-key")
mut err := typesense.Error {}
mut books := Vector {} as Vector<str>
books.push("books")
search := typesense.SearchOnlyKey(c, "website search", books, err)
println search.id, search.value, search.actions.len(), search.collections.get(0)
mut actions := Vector {} as Vector<str>
actions.push("documents:*")
actions.push("collections:get")
mut orgs := Vector {} as Vector<str>
orgs.push("org_.*")
spec := typesense.KeySpec { description = "tenant writer", actions = actions, collections = orgs, expires_at = 1924992000, autodelete = true }
println typesense.KeySpecJSON(spec)
k := typesense.CreateKey(c, spec, err)
println k.value, k.expires_at, k.autodelete
mut all := Vector {} as Vector<str>
all.push(typesense.KEY_ACTION_ALL)
admin := typesense.CreateKey(c, typesense.KeySpec { description = "admin", actions = all, collections = all, value = "my-chosen-admin-key" }, err)
println admin.id
g := typesense.GetKey(c, k.id, err)
println g.value_prefix, g.description
each key in typesense.ListKeys(c, err):
println key.id, key.value_prefix, key.description, key.actions.len(), key.collections.len(), key.expires_at
end
println typesense.DeleteKey(c, k.id, err)
scope := typesense.SearchParams { filter_by = "company_id:=124", exclude_fields = "salary" }
scoped := typesense.ScopedSearchKey(search.value, scope, 1924992000)
println scoped
println typesense.GenerateScopedSearchKey(search.value, `{"filter_by":"user_id:=42"}`)
mut browser := typesense.New("https://search.example.com", scoped)
defer typesense.Free(browser)
println typesense.Search(browser, "books", typesense.NewSearch("dune", "title"), err).found
println typesense.KEY_ACTION_SEARCH
endKey
struct Key| Name | Type | Description |
|---|---|---|
id | i64 = 0 | Its id. |
value | str = "" | The full key text; only returned when the key is created. |
value_prefix | str = "" | The first characters of the key, returned when it is read back. |
description | str = "" | What it is for. |
actions | Vector | What it may do. |
collections | Vector | Which collections it may use. |
expires_at | i64 = 0 | When it stops working, as a Unix time. |
autodelete | bool = false | Whether it is deleted once it expires. |
The example for this item is shown with the ones above: db-typesense-CreateKey.salam
Field
struct Field| Name | Type | Description |
|---|---|---|
name | str = "" | The field name, or a regular expression such as .*_facet. |
kind | str = "" | Its type, one of the TYPE_ constants. |
facet | bool = false | Count its values for facets and allow exact filters. |
optional | bool = false | Documents may leave it out. |
index | bool = true | Index it for search and filters; false keeps it stored only. |
store | bool = true | Keep it on disk; false indexes it without storing it. |
sort | int = 0 | 1 makes it sortable, -1 makes it not sortable, 0 keeps the default (numbers sort, text does not). |
infix | bool = false | Allow matches in the middle of words. |
locale | str = "" | The language of the text, such as fa or en. |
stem | bool = false | Match words by their root. |
stem_dictionary | str = "" | A custom stemming dictionary to use. |
range_index | bool = false | Index it for fast range filters. |
reference | str = "" | Join to another collection, as collection.field. |
async_reference | bool = false | Accept a reference to a document that does not exist yet. |
num_dim | int = 0 | The size of the vector, for a float[] vector field. |
vec_dist | str = "" | The vector distance, cosine or ip. |
embed | str = "" | How to make the vector automatically, as JSON; see EmbeddingField. |
token_separators | Vector | Extra characters that split words in this field. |
symbols_to_index | Vector | Special characters to keep in this field. |
truncate_len | int = 0 | How many characters of a long string to index. |
drop | bool = false | Removes the field in UpdateCollection; used by DropFields. |
extra | str = "" | More members as a JSON object, such as {"hnsw_params":{"M":16}}. |
/*
* Salam Programming Language (2024-2026)
*
* +-------------------+
* | S A L A M |
* +-------------------+
*
* Designed by Seyyed Ali Mohammadiyeh and the Salam Team
* Born from a decade of language design experience (since 2018)
*
* Repository: https://github.com/SalamLang/Salam
*
*/
import db.typesense
func main:
c := typesense.New("http://localhost:8108", "admin-key")
mut err := typesense.Error {}
mut s := typesense.Schema { name = "books_v2", default_sorting_field = "year", enable_nested_fields = true }
s.fields.push(typesense.NewField("title", typesense.TYPE_STRING))
s.fields.push(typesense.Field { name = "title_fa", kind = typesense.TYPE_STRING, locale = "fa", stem = true, optional = true })
s.fields.push(typesense.FacetField("year", typesense.TYPE_INT32))
s.fields.push(typesense.FacetField("genres", typesense.TYPE_STRING_ARRAY))
s.fields.push(typesense.Field { name = "price", kind = typesense.TYPE_FLOAT, range_index = true })
s.fields.push(typesense.Field { name = "isbn", kind = typesense.TYPE_STRING, index = false, optional = true })
s.fields.push(typesense.Field { name = "author_id", kind = typesense.TYPE_STRING, reference = "authors.id" })
s.fields.push(typesense.Field { name = "location", kind = typesense.TYPE_GEOPOINT, optional = true })
s.fields.push(typesense.VectorField("embedding", 384))
mut from := Vector {} as Vector<str>
from.push("title")
s.fields.push(typesense.EmbeddingField("title_vector", from, "ts/all-MiniLM-L12-v2"))
s.fields.push(typesense.Field { name = "meta.*", kind = typesense.TYPE_AUTO, optional = true })
s.symbols_to_index.push("+")
s.token_separators.push("-")
s.metadata = `{"owner": "catalog"}`
println typesense.SchemaJSON(s)
col := typesense.CreateCollection(c, s, err)
if typesense.IsConflict(err):
println "books_v2 already exists"
end
println col.name, col.num_documents, col.created_at, col.fields.len()
each f in col.fields:
println f.name, f.kind, f.facet, f.optional, f.sort, f.index, f.store
end
if typesense.CollectionExists(c, "books_v2", err):
println typesense.GetCollection(c, "books_v2", err).default_sorting_field
end
each x in typesense.ListCollections(c, err):
println x.name, x.num_documents
end
mut skip := Vector {} as Vector<str>
skip.push("fields")
println typesense.ListCollectionsPage(c, 0, 20, skip, err).len()
mut add := Vector {} as Vector<typesense.Field>
add.push(typesense.FacetField("publisher", typesense.TYPE_STRING))
println typesense.AddFields(c, "books_v2", add, err)
mut drop := Vector {} as Vector<str>
drop.push("isbn")
println typesense.DropFields(c, "books_v2", drop, err)
println typesense.SetCollectionMetadata(c, "books_v2", `{"owner": "search team"}`, err)
println typesense.UpdateCollection(c, "books_v2", `{"synonym_sets": ["book-words"]}`, err)
a := typesense.UpsertAlias(c, "books", "books_v2", err)
println a.name, a.collection_name
println typesense.GetAlias(c, "books", err).collection_name
each al in typesense.ListAliases(c, err):
println al.name, "->", al.collection_name
end
println typesense.CloneCollection(c, "books_v2", "books_v3", err).name
println typesense.TruncateCollection(c, "books_v3", err)
println typesense.DeleteCollection(c, "books_v3", err).name
println typesense.DeleteAlias(c, "old_books", err).name
println typesense.CreateCollectionJSON(c, `{"name": "authors", "fields": [{"name": "name", "type": "string"}]}`, err).name
println typesense.FieldJSON(typesense.NewField("pages", typesense.TYPE_INT32))
println typesense.TYPE_STRING_ANY, typesense.TYPE_INT32_ARRAY, typesense.TYPE_INT64, typesense.TYPE_INT64_ARRAY, typesense.TYPE_FLOAT_ARRAY
println typesense.TYPE_BOOL, typesense.TYPE_BOOL_ARRAY, typesense.TYPE_GEOPOINT_ARRAY, typesense.TYPE_GEOPOLYGON
println typesense.TYPE_OBJECT, typesense.TYPE_OBJECT_ARRAY, typesense.TYPE_IMAGE
endSchema
struct SchemaCreateCollection.| Name | Type | Description |
|---|---|---|
name | str = "" | The collection name. |
fields | Vector | The fields. |
default_sorting_field | str = "" | A numeric field to sort by when a search gives no sort order. |
enable_nested_fields | bool = false | Allow object fields. |
token_separators | Vector | Extra characters that split words. |
symbols_to_index | Vector | Special characters to keep, such as + for C++. |
synonym_sets | Vector | Synonym sets this collection uses (Typesense 30). |
curation_sets | Vector | Curation sets this collection uses (Typesense 30). |
metadata | str = "" | Any JSON object to keep with the collection. |
voice_query_model | str = "" | The speech to text model for voice search, as JSON. |
extra | str = "" | More members as a JSON object. |
The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
Collection
struct Collection| Name | Type | Description |
|---|---|---|
name | str = "" | Its name. |
num_documents | i64 = 0 | How many documents it holds. |
created_at | i64 = 0 | When it was made, as a Unix time. |
default_sorting_field | str = "" | The default sort field. |
enable_nested_fields | bool = false | Whether object fields are allowed. |
fields | Vector | Its fields, with every default filled in. |
token_separators | Vector | Extra word separators. |
symbols_to_index | Vector | Special characters it keeps. |
synonym_sets | Vector | The synonym sets it uses. |
curation_sets | Vector | The curation sets it uses. |
metadata | str = "" | Its metadata, as JSON. |
raw | str = "" | The whole answer, as JSON. |
The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
Alias
struct Alias| Name | Type | Description |
|---|---|---|
name | str = "" | The alias. |
collection_name | str = "" | The collection it points to. |
The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
Synonym
struct Synonym| Name | Type | Description |
|---|---|---|
id | str = "" | Its id. |
synonyms | Vector | The words. Without a root they all mean the same thing. |
root | str = "" | When set, a search for the root also finds the other words, but not the other way round. |
locale | str = "" | The language of the words, such as fa. |
symbols_to_index | Vector | Special characters the words contain that should be kept. |
/*
* Salam Programming Language (2024-2026)
*
* +-------------------+
* | S A L A M |
* +-------------------+
*
* Designed by Seyyed Ali Mohammadiyeh and the Salam Team
* Born from a decade of language design experience (since 2018)
*
* Repository: https://github.com/SalamLang/Salam
*
*/
import db.typesense
func main:
c := typesense.New("http://localhost:8108", "admin-key")
mut err := typesense.Error {}
mut words := Vector {} as Vector<str>
words.push("book")
words.push("novel")
words.push("کتاب")
mut items := Vector {} as Vector<typesense.Synonym>
items.push(typesense.Synonym { id = "books", synonyms = words })
set := typesense.UpsertSynonymSet(c, "book-words", items, err)
println set.name, set.items.len()
mut one := Vector {} as Vector<str>
one.push("paperback")
s := typesense.Synonym { id = "paper", root = "book", synonyms = one, locale = "en", symbols_to_index = Vector {} as Vector<str> }
println typesense.SynonymJSON(s)
println typesense.UpsertSynonymItem(c, "book-words", s, err).root
println typesense.GetSynonymItem(c, "book-words", "paper", err).synonyms.len()
println typesense.ListSynonymItems(c, "book-words", err).len(), typesense.GetSynonymSet(c, "book-words", err).items.len(), typesense.ListSynonymSets(c, err).len()
println typesense.DeleteSynonymItem(c, "book-words", "paper", err)
println typesense.UpsertSynonym(c, "books", s, err).id
println typesense.GetSynonym(c, "books", "paper", err).root, typesense.ListSynonyms(c, "books", err).len()
println typesense.DeleteSynonym(c, "books", "paper", err)
mut pins := Vector {} as Vector<typesense.Pin>
pins.push(typesense.Pin { id = "42", position = 1 })
mut hide := Vector {} as Vector<str>
hide.push("13")
mut tags := Vector {} as Vector<str>
tags.push("summer-sale")
rule := typesense.CurationRule {
id = "promote-dune", query = "dune", match_type = typesense.MATCH_EXACT, includes = pins, excludes = hide,
filter_curated_hits = true, effective_from_ts = 1924992000, metadata = `{"campaign": "summer"}`
}
println typesense.CurationJSON(rule)
mut rules := Vector {} as Vector<typesense.CurationRule>
rules.push(rule)
rules.push(typesense.CurationRule {
id = "sale", tags = tags, rule_filter_by = "on_sale:=true", filter_by = "stock:>0", sort_by = "price:asc",
match_type = typesense.MATCH_CONTAINS, replace_query = "", remove_matched_tokens = true, stop_processing = false,
effective_to_ts = 1956528000, extra = ""
})
cs := typesense.UpsertCurationSet(c, "promotions", rules, err)
println cs.name, cs.items.len()
println typesense.UpsertCurationItem(c, "promotions", rule, err).id
println typesense.GetCurationItem(c, "promotions", "sale", err).sort_by, typesense.ListCurationItems(c, "promotions", err).len()
println typesense.GetCurationSet(c, "promotions", err).items.len(), typesense.ListCurationSets(c, err).len()
println typesense.DeleteCurationItem(c, "promotions", "sale", err)
println typesense.UpdateCollection(c, "books", `{"synonym_sets": ["book-words"], "curation_sets": ["promotions"]}`, err)
println typesense.UpsertOverride(c, "books", rule, err).id
println typesense.GetOverride(c, "books", "promote-dune", err).query, typesense.ListOverrides(c, "books", err).len()
println typesense.DeleteOverride(c, "books", "promote-dune", err)
mut listing := typesense.NewSearch("", "title,description")
listing.per_page = 24
listing.sort_by = "popularity:desc"
pr := typesense.UpsertSearchPreset(c, "listing", listing, err)
println pr.name, pr.value
println typesense.UpsertPreset(c, "listing-raw", `{"query_by": "title"}`, err).value
println typesense.GetPreset(c, "listing", err).value
each x in typesense.ListPresets(c, err):
println x.name
end
println typesense.DeletePreset(c, "listing-raw", err)
mut sw := Vector {} as Vector<str>
sw.push("the")
sw.push("a")
st := typesense.UpsertStopwords(c, "english", sw, "en", err)
println st.id, st.locale, st.stopwords.len()
println typesense.GetStopwords(c, "english", err).stopwords.len(), typesense.ListStopwords(c, err).len()
println typesense.DeleteStopwords(c, "english", err)
mut stem := Vector {} as Vector<typesense.StemWord>
stem.push(typesense.StemWord { word = "mice", root = "mouse" })
stem.push(typesense.StemWord { word = "geese", root = "goose" })
println typesense.ImportStemmingDictionary(c, "irregular", stem, err)
println typesense.ImportStemmingJSONL(c, "irregular", `{"word": "teeth", "root": "tooth"}`, err)
d := typesense.GetStemmingDictionary(c, "irregular", err)
println d.id, d.words.len()
println typesense.ListStemmingDictionaries(c, err).len()
println typesense.DeleteStemmingDictionary(c, "irregular", err)
println typesense.DeleteCurationSet(c, "promotions", err), typesense.DeleteSynonymSet(c, "book-words", err)
endSynonymSet
struct SynonymSet| Name | Type | Description |
|---|---|---|
name | str = "" | Its name. |
items | Vector | The synonyms. |
The example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
Pin
struct Pin| Name | Type | Description |
|---|---|---|
id | str = "" | The document id. |
position | int = 0 | The position, from 1. |
The example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
CurationRule
struct CurationRule| Name | Type | Description |
|---|---|---|
id | str = "" | Its id. |
query | str = "" | The query text it matches. |
match_type | str = "" | MATCH_EXACT or MATCH_CONTAINS. |
rule_filter_by | str = "" | Apply the rule when the search uses this filter. |
tags | Vector | Apply the rule when the search sends one of these tags in override_tags. |
includes | Vector | Documents to pin. |
excludes | Vector | Ids of documents to hide. |
filter_by | str = "" | A filter to add to the search. |
sort_by | str = "" | A sort order to use instead. |
replace_query | str = "" | A query to search for instead. |
remove_matched_tokens | bool = false | Remove the matched words from the query. |
filter_curated_hits | bool = false | Apply the search filter to the pinned documents too. |
stop_processing | bool = true | Stop at this rule when it matches; false lets later rules apply too. |
effective_from_ts | i64 = 0 | A Unix time before which the rule does nothing; 0 for always. |
effective_to_ts | i64 = 0 | A Unix time after which the rule does nothing; 0 for never. |
metadata | str = "" | Any JSON object to return with the results when the rule applies. |
extra | str = "" | More members as a JSON object, merged into the rule as they are. |
The example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
CurationSet
struct CurationSet| Name | Type | Description |
|---|---|---|
name | str = "" | Its name. |
items | Vector | The rules. |
The example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
Preset
struct PresetSearchParams.preset.| Name | Type | Description |
|---|---|---|
name | str = "" | Its name. |
value | str = "" | The parameters, as JSON. |
The example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
Stopwords
struct Stopwords| Name | Type | Description |
|---|---|---|
id | str = "" | Its id, used in SearchParams.stopwords. |
stopwords | Vector | The words. |
locale | str = "" | Their language. |
The example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
StemWord
struct StemWord| Name | Type | Description |
|---|---|---|
word | str = "" | The word. |
root | str = "" | Its root. |
The example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
StemmingDictionary
struct StemmingDictionaryField.stem_dictionary.| Name | Type | Description |
|---|---|---|
id | str = "" | Its id. |
words | Vector | The words. |
The example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
WriteOptions
struct WriteOptions| Name | Type | Description |
|---|---|---|
action | str = "" | One of the ACTION_ constants; empty means create. |
dirty_values | str = "" | One of the DIRTY_ constants. |
batch_size | int = 0 | How many documents the server indexes at once during an import. |
return_id | bool = false | Include the id of each document in the import result. |
return_doc | bool = false | Include each document in the import result. |
remote_embedding_batch_size | int = 0 | How many documents to send to a remote embedding model at once. |
/*
* Salam Programming Language (2024-2026)
*
* +-------------------+
* | S A L A M |
* +-------------------+
*
* Designed by Seyyed Ali Mohammadiyeh and the Salam Team
* Born from a decade of language design experience (since 2018)
*
* Repository: https://github.com/SalamLang/Salam
*
*/
import db.typesense
struct Book:
pub id: str = ""
pub title: str = ""
pub year: int = 0
end
func main:
c := typesense.New("http://localhost:8108", "admin-key")
mut err := typesense.Error {}
println typesense.CreateDocument(c, "books", `{"id": "1", "title": "Dune", "year": 1965}`, err)
println typesense.UpsertDocument(c, "books", `{"id": "1", "title": "Dune", "year": 1965}`, err)
println typesense.EmplaceDocument(c, "books", `{"id": "2", "title": "Emma"}`, err)
println typesense.UpdateDocument(c, "books", "2", `{"year": 1815}`, err)
println typesense.UpdateDocumentWith(c, "books", "2", `{"year": "1815"}`, typesense.DIRTY_COERCE_OR_REJECT, err)
println typesense.IndexDocument(c, "books", `{"id": "3", "title": "Ulysses", "year": "1922"}`, typesense.WriteOptions { action = typesense.ACTION_UPSERT, dirty_values = typesense.DIRTY_COERCE_OR_DROP }, err)
println typesense.GetDocument(c, "books", "1", err)
println typesense.DocumentExists(c, "books", "42", err)
mut b := Book {}
if typesense.GetDocumentAs(c, "books", "1", b, err):
println b.title, b.year
end
println typesense.CreateDocumentOf(c, "books", Book { id = "4", title = "Beloved", year = 1987 }, err)
println typesense.UpsertDocumentOf(c, "books", Book { id = "4", title = "Beloved", year = 1987 }, err)
mut books := Vector {} as Vector<Book>
books.push(Book { id = "5", title = "Hamlet", year = 1603 })
books.push(Book { id = "6", title = "Middlemarch", year = 1871 })
r := typesense.ImportOf(c, "books", books, typesense.WriteOptions { action = typesense.ACTION_UPSERT, batch_size = 100, return_id = true }, err)
println r.success, r.failed, r.ids.len(), r.documents.len(), r.lines.len()
each e in r.errors:
println e.line, e.id, e.code, e.error, e.document
end
mut docs := Vector {} as Vector<str>
docs.push(`{"id": "7", "title": "Persuasion", "year": 1817}`)
docs.push(`{"id": "8", "title": "Walden", "year": "1854"}`)
r2 := typesense.ImportDocuments(c, "books", docs, typesense.WriteOptions { action = typesense.ACTION_CREATE, dirty_values = typesense.DIRTY_REJECT, return_doc = true }, err)
println r2.success, r2.failed
r3 := typesense.ImportJSONL(c, "books", "{\"id\": \"9\", \"title\": \"Emma\"}\n", typesense.WriteOptions { action = typesense.ACTION_UPDATE, remote_embedding_batch_size = 50 }, err)
println r3.success, typesense.ACTION_EMPLACE, typesense.DIRTY_DROP
println typesense.UpdateByFilter(c, "books", "year:<1900", `{"classic": true}`, err)
println typesense.DeleteByFilter(c, "books", "year:<1700", 500, err)
println typesense.DeleteDocument(c, "books", "9", err)
lines := typesense.ExportDocuments(c, "books", typesense.ExportOptions { filter_by = "year:>1800", include_fields = "id,title,year", exclude_fields = "" }, err)
mut back := Vector {} as Vector<Book>
if typesense.DecodeDocuments(lines, back, err):
println back.len()
end
mut one := Book {}
println typesense.DecodeDocument(`{"id": "1", "title": "Dune", "year": 1965}`, one, err), one.title
println typesense.ExportJSONL(c, "books", typesense.ExportOptions {}, err).len()
endImportError
struct ImportError| Name | Type | Description |
|---|---|---|
line | int = 0 | Its position in the import, from 0. |
id | str = "" | The document id, when return_id was set. |
code | int = 0 | The HTTP status for this line, such as 400 or 409. |
error | str = "" | The reason it failed. |
document | str = "" | The document text, when return_doc was set. |
The example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
ImportResult
struct ImportResultfailed.| Name | Type | Description |
|---|---|---|
success | int = 0 | How many documents were written. |
failed | int = 0 | How many were not. |
ids | Vector | The ids of the written documents, with return_id. |
documents | Vector | The written documents, with return_doc. |
errors | Vector | The lines that failed. |
lines | Vector | The raw result line of every document. |
The example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
ExportOptions
struct ExportOptions| Name | Type | Description |
|---|---|---|
filter_by | str = "" | A filter, such as year:>2000; empty exports all. |
include_fields | str = "" | Export only these fields, comma separated. |
exclude_fields | str = "" | Leave these fields out, comma separated. |
The example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
Constants and variables
VERSION
const VERSION: str = "1.0.0"The example for this item is shown with the ones above: db-typesense-Client.salam
KIND_HTTP
const KIND_HTTP: str = "http"Error.kind when the server answered with an error status.The example for this item is shown with the ones above: db-typesense-Client.salam
KIND_NETWORK
const KIND_NETWORK: str = "network"Error.kind when no node could be reached, or a request timed out.The example for this item is shown with the ones above: db-typesense-Client.salam
KIND_INVALID
const KIND_INVALID: str = "invalid"Error.kind when the client itself is unusable, such as having no nodes.The example for this item is shown with the ones above: db-typesense-Client.salam
KIND_DECODE
const KIND_DECODE: str = "decode"Error.kind when a document could not be read into your struct.The example for this item is shown with the ones above: db-typesense-Client.salam
RULE_POPULAR_QUERIES
const RULE_POPULAR_QUERIES: str = "popular_queries"The example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
RULE_NOHITS_QUERIES
const RULE_NOHITS_QUERIES: str = "nohits_queries"The example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
RULE_COUNTER
const RULE_COUNTER: str = "counter"The example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
RULE_LOG
const RULE_LOG: str = "log"The example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
EVENT_SEARCH
const EVENT_SEARCH: str = "search"The example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
EVENT_CLICK
const EVENT_CLICK: str = "click"The example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
EVENT_CONVERSION
const EVENT_CONVERSION: str = "conversion"The example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
EVENT_VISIT
const EVENT_VISIT: str = "visit"The example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
EVENT_CUSTOM
const EVENT_CUSTOM: str = "custom"The example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
MAX_GET_QUERY
const MAX_GET_QUERY: i32 = 4000/multi_search instead, as servers limit the length of a URL.The example for this item is shown with the ones above: db-typesense-Search.salam
KEY_ACTION_ALL
const KEY_ACTION_ALL: str = "*"The example for this item is shown with the ones above: db-typesense-CreateKey.salam
KEY_ACTION_SEARCH
const KEY_ACTION_SEARCH: str = "documents:search"The example for this item is shown with the ones above: db-typesense-CreateKey.salam
TYPE_STRING
const TYPE_STRING: str = "string"The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
TYPE_STRING_ARRAY
const TYPE_STRING_ARRAY: str = "string[]"The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
TYPE_STRING_ANY
const TYPE_STRING_ANY: str = "string*"The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
TYPE_INT32
const TYPE_INT32: str = "int32"The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
TYPE_INT32_ARRAY
const TYPE_INT32_ARRAY: str = "int32[]"The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
TYPE_INT64
const TYPE_INT64: str = "int64"The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
TYPE_INT64_ARRAY
const TYPE_INT64_ARRAY: str = "int64[]"The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
TYPE_FLOAT
const TYPE_FLOAT: str = "float"The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
TYPE_FLOAT_ARRAY
const TYPE_FLOAT_ARRAY: str = "float[]"num_dim it is a vector.The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
TYPE_BOOL
const TYPE_BOOL: str = "bool"The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
TYPE_BOOL_ARRAY
const TYPE_BOOL_ARRAY: str = "bool[]"The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
TYPE_GEOPOINT
const TYPE_GEOPOINT: str = "geopoint"[lat, lng].The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
TYPE_GEOPOINT_ARRAY
const TYPE_GEOPOINT_ARRAY: str = "geopoint[]"The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
TYPE_GEOPOLYGON
const TYPE_GEOPOLYGON: str = "geopolygon"The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
TYPE_OBJECT
const TYPE_OBJECT: str = "object"enable_nested_fields.The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
TYPE_OBJECT_ARRAY
const TYPE_OBJECT_ARRAY: str = "object[]"The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
TYPE_IMAGE
const TYPE_IMAGE: str = "image"The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
TYPE_AUTO
const TYPE_AUTO: str = "auto".*.The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
MATCH_EXACT
const MATCH_EXACT: str = "exact"The example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
MATCH_CONTAINS
const MATCH_CONTAINS: str = "contains"The example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
ACTION_CREATE
const ACTION_CREATE: str = "create"The example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
ACTION_UPSERT
const ACTION_UPSERT: str = "upsert"The example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
ACTION_UPDATE
const ACTION_UPDATE: str = "update"The example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
ACTION_EMPLACE
const ACTION_EMPLACE: str = "emplace"The example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
DIRTY_COERCE_OR_REJECT
const DIRTY_COERCE_OR_REJECT: str = "coerce_or_reject"The example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
DIRTY_COERCE_OR_DROP
const DIRTY_COERCE_OR_DROP: str = "coerce_or_drop"The example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
DIRTY_DROP
const DIRTY_DROP: str = "drop"The example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
DIRTY_REJECT
const DIRTY_REJECT: str = "reject"The example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
Functions
New
func New(url: str, api_key: str): Clienthttp://, and a trailing slash is dropped.The example for this item is shown with the ones above: db-typesense-Client.salam
NewCluster
func NewCluster(urls: Vector<str>, api_key: str): ClientThe example for this item is shown with the ones above: db-typesense-Client.salam
SetNearestNode
func SetNearestNode(c &: Client, url: str)The example for this item is shown with the ones above: db-typesense-Client.salam
AddNode
func AddNode(c &: Client, url: str)The example for this item is shown with the ones above: db-typesense-Client.salam
AddHeader
func AddHeader(c &: Client, name: str, value: str)The example for this item is shown with the ones above: db-typesense-Client.salam
Free
func Free(c &: Client)The example for this item is shown with the ones above: db-typesense-Client.salam
NodeHealthy
func NodeHealthy(c: Client, index: int): boolThe example for this item is shown with the ones above: db-typesense-Client.salam
Ok
func Ok(err: Error): boolThe example for this item is shown with the ones above: db-typesense-Client.salam
IsNotFound
func IsNotFound(err: Error): boolThe example for this item is shown with the ones above: db-typesense-Client.salam
IsConflict
func IsConflict(err: Error): boolThe example for this item is shown with the ones above: db-typesense-Client.salam
ErrorString
func ErrorString(err: Error): strThe example for this item is shown with the ones above: db-typesense-Client.salam
Request
func Request(c: Client, method: str, path: str, body: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-Client.salam
RequestAs
func RequestAs(c: Client, method: str, path: str, content_type: str, body: str, err &: Error): strRequest, with a content type of your choice.The example for this item is shown with the ones above: db-typesense-Client.salam
Health
func Health(c: Client, err &: Error): boolThe example for this item is shown with the ones above: db-typesense-Client.salam
IsHealthy
func IsHealthy(c: Client): boolHealth without the error argument.The example for this item is shown with the ones above: db-typesense-Client.salam
Debug
func Debug(c: Client, err &: Error): str/debug answer, with the server version, as JSON.The example for this item is shown with the ones above: db-typesense-Client.salam
ServerVersion
func ServerVersion(c: Client, err &: Error): str30.2.The example for this item is shown with the ones above: db-typesense-Client.salam
Stats
func Stats(c: Client, err &: Error): strThe example for this item is shown with the ones above: db-typesense-Client.salam
Metrics
func Metrics(c: Client, err &: Error): strThe example for this item is shown with the ones above: db-typesense-Client.salam
Status
func Status(c: Client, err &: Error): ClusterStatusThe example for this item is shown with the ones above: db-typesense-Client.salam
CreateSnapshot
func CreateSnapshot(c: Client, snapshot_path: str, err &: Error): boolThe example for this item is shown with the ones above: db-typesense-Client.salam
Vote
func Vote(c: Client, err &: Error): boolThe example for this item is shown with the ones above: db-typesense-Client.salam
ClearCache
func ClearCache(c: Client, err &: Error): boolThe example for this item is shown with the ones above: db-typesense-Client.salam
CompactDB
func CompactDB(c: Client, err &: Error): boolThe example for this item is shown with the ones above: db-typesense-Client.salam
ResetPeers
func ResetPeers(c: Client, err &: Error): boolThe example for this item is shown with the ones above: db-typesense-Client.salam
SchemaChanges
func SchemaChanges(c: Client, err &: Error): Vector<str>The example for this item is shown with the ones above: db-typesense-Client.salam
UpdateConfig
func UpdateConfig(c: Client, config: str, err &: Error): boolThe example for this item is shown with the ones above: db-typesense-Client.salam
SetSlowRequestLog
func SetSlowRequestLog(c: Client, millis: int, err &: Error): boolThe example for this item is shown with the ones above: db-typesense-Client.salam
AnalyticsRuleJSON
func AnalyticsRuleJSON(r: AnalyticsRule): strThe example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
CreateAnalyticsRuleJSON
func CreateAnalyticsRuleJSON(c: Client, rule: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
UpsertAnalyticsRuleJSON
func UpsertAnalyticsRuleJSON(c: Client, name: str, rule: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
CreateAnalyticsRule
func CreateAnalyticsRule(c: Client, r: AnalyticsRule, err &: Error): AnalyticsRuleThe example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
UpsertAnalyticsRule
func UpsertAnalyticsRule(c: Client, r: AnalyticsRule, err &: Error): AnalyticsRuleThe example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
GetAnalyticsRule
func GetAnalyticsRule(c: Client, name: str, err &: Error): AnalyticsRuleThe example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
ListAnalyticsRules
func ListAnalyticsRules(c: Client, rule_tag: str, err &: Error): Vector<AnalyticsRule>The example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
DeleteAnalyticsRule
func DeleteAnalyticsRule(c: Client, name: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
SendEventJSON
func SendEventJSON(c: Client, event: str, err &: Error): boolThe example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
SendEvent
func SendEvent(c: Client, name: str, event_type: str, data: str, err &: Error): bool{"doc_id":"1","user_id":"u1"}.The example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
GetEvents
func GetEvents(c: Client, user_id: str, name: str, n: int, err &: Error): Vector<str>The example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
FlushAnalytics
func FlushAnalytics(c: Client, err &: Error): boolThe example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
AnalyticsStatus
func AnalyticsStatus(c: Client, err &: Error): strThe example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
ConversationModelJSON
func ConversationModelJSON(m: ConversationModel): strThe example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
CreateConversationModel
func CreateConversationModel(c: Client, m: ConversationModel, err &: Error): strThe example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
GetConversationModel
func GetConversationModel(c: Client, id: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
ListConversationModels
func ListConversationModels(c: Client, err &: Error): Vector<str>The example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
UpdateConversationModel
func UpdateConversationModel(c: Client, id: str, m: ConversationModel, err &: Error): strThe example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
DeleteConversationModel
func DeleteConversationModel(c: Client, id: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
CreateNLSearchModel
func CreateNLSearchModel(c: Client, model: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
GetNLSearchModel
func GetNLSearchModel(c: Client, id: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
ListNLSearchModels
func ListNLSearchModels(c: Client, err &: Error): Vector<str>The example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
UpdateNLSearchModel
func UpdateNLSearchModel(c: Client, id: str, model: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
DeleteNLSearchModel
func DeleteNLSearchModel(c: Client, id: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-CreateAnalyticsRule.salam
NewSearch
func NewSearch(q: str, query_by: str): SearchParamsThe example for this item is shown with the ones above: db-typesense-Search.salam
Set
func Set(p &: SearchParams, key: str, value: str)prioritize_exact_match, or enable_curations set to false to switch off curation rules for one search (enable_overrides on Typesense 29).The example for this item is shown with the ones above: db-typesense-Search.salam
SearchQuery
func SearchQuery(p: SearchParams): strThe example for this item is shown with the ones above: db-typesense-Search.salam
SearchParamsJSON
func SearchParamsJSON(p: SearchParams): strThe example for this item is shown with the ones above: db-typesense-Search.salam
ParseSearchResult
func ParseSearchResult(body: str): SearchResultThe example for this item is shown with the ones above: db-typesense-Search.salam
SearchRaw
func SearchRaw(c: Client, collection: str, p: SearchParams, err &: Error): strThe example for this item is shown with the ones above: db-typesense-Search.salam
Search
func Search(c: Client, collection: str, p: SearchParams, err &: Error): SearchResultThe example for this item is shown with the ones above: db-typesense-Search.salam
MultiSearchRaw
func MultiSearchRaw(c: Client, searches: Vector<SearchRequest>, common: SearchParams, err &: Error): strThe example for this item is shown with the ones above: db-typesense-Search.salam
MultiSearch
func MultiSearch(c: Client, searches: Vector<SearchRequest>, common: SearchParams, err &: Error): Vector<SearchResult>code and error.The example for this item is shown with the ones above: db-typesense-Search.salam
UnionSearch
func UnionSearch(c: Client, searches: Vector<SearchRequest>, common: SearchParams, err &: Error): SearchResultThe example for this item is shown with the ones above: db-typesense-Search.salam
HitsAs
func HitsAs<T>(r: SearchResult, out &: Vector<T>, err &: Error): boolThe example for this item is shown with the ones above: db-typesense-Search.salam
Highlight
func Highlight(h: Hit, field: str): strThe example for this item is shown with the ones above: db-typesense-Search.salam
FreeResult
func FreeResult(r &: SearchResult)The example for this item is shown with the ones above: db-typesense-Search.salam
KeySpecJSON
func KeySpecJSON(spec: KeySpec): strThe example for this item is shown with the ones above: db-typesense-CreateKey.salam
CreateKey
func CreateKey(c: Client, spec: KeySpec, err &: Error): Keyvalue is the only time the full key is shown.The example for this item is shown with the ones above: db-typesense-CreateKey.salam
SearchOnlyKey
func SearchOnlyKey(c: Client, description: str, collections: Vector<str>, err &: Error): KeyThe example for this item is shown with the ones above: db-typesense-CreateKey.salam
GetKey
func GetKey(c: Client, id: i64, err &: Error): KeyThe example for this item is shown with the ones above: db-typesense-CreateKey.salam
ListKeys
func ListKeys(c: Client, err &: Error): Vector<Key>The example for this item is shown with the ones above: db-typesense-CreateKey.salam
DeleteKey
func DeleteKey(c: Client, id: i64, err &: Error): i64The example for this item is shown with the ones above: db-typesense-CreateKey.salam
GenerateScopedSearchKey
func GenerateScopedSearchKey(search_key: str, embedded_params: str): strfilter_by and an expires_at, are applied to every search made with it and cannot be changed by the browser.The example for this item is shown with the ones above: db-typesense-CreateKey.salam
ScopedSearchKey
func ScopedSearchKey(search_key: str, p: SearchParams, expires_at: i64): strGenerateScopedSearchKey with the parameters taken from a SearchParams; 0 for no expiry.The example for this item is shown with the ones above: db-typesense-CreateKey.salam
NewField
func NewField(name: str, kind: str): FieldThe example for this item is shown with the ones above: db-typesense-CreateCollection.salam
FacetField
func FacetField(name: str, kind: str): FieldThe example for this item is shown with the ones above: db-typesense-CreateCollection.salam
VectorField
func VectorField(name: str, num_dim: int): Fieldfloat[] vector field of the given size.The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
EmbeddingField
func EmbeddingField(name: str, from: Vector<str>, model_name: str): Fieldts/all-MiniLM-L12-v2.The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
FieldJSON
func FieldJSON(f: Field): strThe example for this item is shown with the ones above: db-typesense-CreateCollection.salam
SchemaJSON
func SchemaJSON(s: Schema): strThe example for this item is shown with the ones above: db-typesense-CreateCollection.salam
CreateCollection
func CreateCollection(c: Client, schema: Schema, err &: Error): CollectionThe example for this item is shown with the ones above: db-typesense-CreateCollection.salam
CreateCollectionJSON
func CreateCollectionJSON(c: Client, schema: str, err &: Error): CollectionThe example for this item is shown with the ones above: db-typesense-CreateCollection.salam
CloneCollection
func CloneCollection(c: Client, source: str, name: str, err &: Error): CollectionThe example for this item is shown with the ones above: db-typesense-CreateCollection.salam
GetCollection
func GetCollection(c: Client, name: str, err &: Error): CollectionThe example for this item is shown with the ones above: db-typesense-CreateCollection.salam
CollectionExists
func CollectionExists(c: Client, name: str, err &: Error): boolThe example for this item is shown with the ones above: db-typesense-CreateCollection.salam
ListCollections
func ListCollections(c: Client, err &: Error): Vector<Collection>The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
ListCollectionsPage
func ListCollectionsPage(c: Client, offset: int, limit: int, exclude_fields: Vector<str>, err &: Error): Vector<Collection>exclude_fields such as fields makes the answer smaller.The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
UpdateCollection
func UpdateCollection(c: Client, name: str, changes: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-CreateCollection.salam
AddFields
func AddFields(c: Client, name: str, fields: Vector<Field>, err &: Error): strThe example for this item is shown with the ones above: db-typesense-CreateCollection.salam
DropFields
func DropFields(c: Client, name: str, fields: Vector<str>, err &: Error): strThe example for this item is shown with the ones above: db-typesense-CreateCollection.salam
SetCollectionMetadata
func SetCollectionMetadata(c: Client, name: str, metadata: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-CreateCollection.salam
DeleteCollection
func DeleteCollection(c: Client, name: str, err &: Error): CollectionThe example for this item is shown with the ones above: db-typesense-CreateCollection.salam
TruncateCollection
func TruncateCollection(c: Client, name: str, err &: Error): i64The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
UpsertAlias
func UpsertAlias(c: Client, name: str, collection: str, err &: Error): AliasThe example for this item is shown with the ones above: db-typesense-CreateCollection.salam
GetAlias
func GetAlias(c: Client, name: str, err &: Error): AliasThe example for this item is shown with the ones above: db-typesense-CreateCollection.salam
ListAliases
func ListAliases(c: Client, err &: Error): Vector<Alias>The example for this item is shown with the ones above: db-typesense-CreateCollection.salam
DeleteAlias
func DeleteAlias(c: Client, name: str, err &: Error): AliasThe example for this item is shown with the ones above: db-typesense-CreateCollection.salam
SynonymJSON
func SynonymJSON(s: Synonym): strThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
CurationJSON
func CurationJSON(r: CurationRule): strThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
UpsertSynonymSet
func UpsertSynonymSet(c: Client, name: str, items: Vector<Synonym>, err &: Error): SynonymSetThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
GetSynonymSet
func GetSynonymSet(c: Client, name: str, err &: Error): SynonymSetThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
ListSynonymSets
func ListSynonymSets(c: Client, err &: Error): Vector<SynonymSet>The example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
DeleteSynonymSet
func DeleteSynonymSet(c: Client, name: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
UpsertSynonymItem
func UpsertSynonymItem(c: Client, set: str, item: Synonym, err &: Error): SynonymThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
GetSynonymItem
func GetSynonymItem(c: Client, set: str, id: str, err &: Error): SynonymThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
ListSynonymItems
func ListSynonymItems(c: Client, set: str, err &: Error): Vector<Synonym>The example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
DeleteSynonymItem
func DeleteSynonymItem(c: Client, set: str, id: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
UpsertSynonym
func UpsertSynonym(c: Client, collection: str, s: Synonym, err &: Error): SynonymThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
GetSynonym
func GetSynonym(c: Client, collection: str, id: str, err &: Error): SynonymThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
ListSynonyms
func ListSynonyms(c: Client, collection: str, err &: Error): Vector<Synonym>The example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
DeleteSynonym
func DeleteSynonym(c: Client, collection: str, id: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
UpsertCurationSet
func UpsertCurationSet(c: Client, name: str, items: Vector<CurationRule>, err &: Error): CurationSetThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
GetCurationSet
func GetCurationSet(c: Client, name: str, err &: Error): CurationSetThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
ListCurationSets
func ListCurationSets(c: Client, err &: Error): Vector<CurationSet>The example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
DeleteCurationSet
func DeleteCurationSet(c: Client, name: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
UpsertCurationItem
func UpsertCurationItem(c: Client, set: str, r: CurationRule, err &: Error): CurationRuleThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
GetCurationItem
func GetCurationItem(c: Client, set: str, id: str, err &: Error): CurationRuleThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
ListCurationItems
func ListCurationItems(c: Client, set: str, err &: Error): Vector<CurationRule>The example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
DeleteCurationItem
func DeleteCurationItem(c: Client, set: str, id: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
UpsertOverride
func UpsertOverride(c: Client, collection: str, r: CurationRule, err &: Error): CurationRuleThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
GetOverride
func GetOverride(c: Client, collection: str, id: str, err &: Error): CurationRuleThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
ListOverrides
func ListOverrides(c: Client, collection: str, err &: Error): Vector<CurationRule>The example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
DeleteOverride
func DeleteOverride(c: Client, collection: str, id: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
UpsertPreset
func UpsertPreset(c: Client, name: str, value: str, err &: Error): PresetThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
UpsertSearchPreset
func UpsertSearchPreset(c: Client, name: str, p: SearchParams, err &: Error): PresetSearchParams as a preset.The example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
GetPreset
func GetPreset(c: Client, name: str, err &: Error): PresetThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
ListPresets
func ListPresets(c: Client, err &: Error): Vector<Preset>The example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
DeletePreset
func DeletePreset(c: Client, name: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
UpsertStopwords
func UpsertStopwords(c: Client, id: str, words: Vector<str>, locale: str, err &: Error): StopwordsThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
GetStopwords
func GetStopwords(c: Client, id: str, err &: Error): StopwordsThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
ListStopwords
func ListStopwords(c: Client, err &: Error): Vector<Stopwords>The example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
DeleteStopwords
func DeleteStopwords(c: Client, id: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
ImportStemmingJSONL
func ImportStemmingJSONL(c: Client, id: str, jsonl: str, err &: Error): bool{"word","root"} object per line.The example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
ImportStemmingDictionary
func ImportStemmingDictionary(c: Client, id: str, words: Vector<StemWord>, err &: Error): boolThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
GetStemmingDictionary
func GetStemmingDictionary(c: Client, id: str, err &: Error): StemmingDictionaryThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
ListStemmingDictionaries
func ListStemmingDictionaries(c: Client, err &: Error): Vector<str>The example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
DeleteStemmingDictionary
func DeleteStemmingDictionary(c: Client, id: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-UpsertSynonymSet.salam
IndexDocument
func IndexDocument(c: Client, collection: str, document: str, opts: WriteOptions, err &: Error): strThe example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
CreateDocument
func CreateDocument(c: Client, collection: str, document: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
UpsertDocument
func UpsertDocument(c: Client, collection: str, document: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
EmplaceDocument
func EmplaceDocument(c: Client, collection: str, document: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
UpdateDocument
func UpdateDocument(c: Client, collection: str, id: str, partial: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
UpdateDocumentWith
func UpdateDocumentWith(c: Client, collection: str, id: str, partial: str, dirty_values: str, err &: Error): strUpdateDocument with a dirty_values mode.The example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
GetDocument
func GetDocument(c: Client, collection: str, id: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
DocumentExists
func DocumentExists(c: Client, collection: str, id: str, err &: Error): boolThe example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
DeleteDocument
func DeleteDocument(c: Client, collection: str, id: str, err &: Error): strThe example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
DeleteByFilter
func DeleteByFilter(c: Client, collection: str, filter_by: str, batch_size: int, err &: Error): i64The example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
UpdateByFilter
func UpdateByFilter(c: Client, collection: str, filter_by: str, partial: str, err &: Error): i64The example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
ImportJSONL
func ImportJSONL(c: Client, collection: str, jsonl: str, opts: WriteOptions, err &: Error): ImportResultThe example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
ImportDocuments
func ImportDocuments(c: Client, collection: str, documents: Vector<str>, opts: WriteOptions, err &: Error): ImportResultThe example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
ImportOf
func ImportOf<T>(c: Client, collection: str, documents: Vector<T>, opts: WriteOptions, err &: Error): ImportResultjson.Marshal.The example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
CreateDocumentOf
func CreateDocumentOf<T>(c: Client, collection: str, document: T, err &: Error): strThe example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
UpsertDocumentOf
func UpsertDocumentOf<T>(c: Client, collection: str, document: T, err &: Error): strThe example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
DecodeDocument
func DecodeDocument<T>(document: str, out &: T, err &: Error): boolThe example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
GetDocumentAs
func GetDocumentAs<T>(c: Client, collection: str, id: str, out &: T, err &: Error): boolThe example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
DecodeDocuments
func DecodeDocuments<T>(documents: Vector<str>, out &: Vector<T>, err &: Error): boolThe example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
ExportJSONL
func ExportJSONL(c: Client, collection: str, opts: ExportOptions, err &: Error): strThe example for this item is shown with the ones above: db-typesense-ImportDocuments.salam
ExportDocuments
func ExportDocuments(c: Client, collection: str, opts: ExportOptions, err &: Error): Vector<str>The example for this item is shown with the ones above: db-typesense-ImportDocuments.salam