OCaml bindings to the Typesense embeddings search API
at main 3691 lines 175 kB view raw
1(** {1 Typesense} 2 3 An open source search engine for building delightful search experiences. 4 5 @version 30.0 *) 6 7type t 8 9val create : 10 ?session:Requests.t -> 11 sw:Eio.Switch.t -> 12 < net : _ Eio.Net.t ; fs : Eio.Fs.dir_ty Eio.Path.t ; clock : _ Eio.Time.clock ; .. > -> 13 base_url:string -> 14 t 15 16val base_url : t -> string 17val session : t -> Requests.t 18 19module VoiceQueryModelCollection : sig 20 module Config : sig 21 (** Configuration for the voice query model 22 *) 23 type t 24 25 (** Construct a value *) 26 val v : ?model_name:string -> unit -> t 27 28 val model_name : t -> string option 29 30 val jsont : t Jsont.t 31 end 32end 33 34module SynonymSetDeleteSchema : sig 35 module T : sig 36 type t 37 38 (** Construct a value 39 @param name Name of the deleted synonym set 40 *) 41 val v : name:string -> unit -> t 42 43 (** Name of the deleted synonym set *) 44 val name : t -> string 45 46 val jsont : t Jsont.t 47 end 48 49 (** Delete a synonym set 50 51 Delete a specific synonym set by its name 52 @param synonym_set_name The name of the synonym set to delete 53 *) 54 val delete_synonym_set : synonym_set_name:string -> t -> unit -> T.t 55end 56 57module SynonymItemUpsertSchema : sig 58 module T : sig 59 type t 60 61 (** Construct a value 62 @param synonyms Array of words that should be considered as synonyms 63 @param locale Locale for the synonym, leave blank to use the standard tokenizer 64 @param root For 1-way synonyms, indicates the root word that words in the synonyms parameter map to 65 @param symbols_to_index By default, special characters are dropped from synonyms. Use this attribute to specify which special characters should be indexed as is 66 *) 67 val v : synonyms:string list -> ?locale:string -> ?root:string -> ?symbols_to_index:string list -> unit -> t 68 69 (** Locale for the synonym, leave blank to use the standard tokenizer *) 70 val locale : t -> string option 71 72 (** For 1-way synonyms, indicates the root word that words in the synonyms parameter map to *) 73 val root : t -> string option 74 75 (** By default, special characters are dropped from synonyms. Use this attribute to specify which special characters should be indexed as is *) 76 val symbols_to_index : t -> string list option 77 78 (** Array of words that should be considered as synonyms *) 79 val synonyms : t -> string list 80 81 val jsont : t Jsont.t 82 end 83end 84 85module SynonymItemSchema : sig 86 module T : sig 87 type t 88 89 (** Construct a value 90 @param id Unique identifier for the synonym item 91 @param synonyms Array of words that should be considered as synonyms 92 @param locale Locale for the synonym, leave blank to use the standard tokenizer 93 @param root For 1-way synonyms, indicates the root word that words in the synonyms parameter map to 94 @param symbols_to_index By default, special characters are dropped from synonyms. Use this attribute to specify which special characters should be indexed as is 95 *) 96 val v : id:string -> synonyms:string list -> ?locale:string -> ?root:string -> ?symbols_to_index:string list -> unit -> t 97 98 (** Unique identifier for the synonym item *) 99 val id : t -> string 100 101 (** Locale for the synonym, leave blank to use the standard tokenizer *) 102 val locale : t -> string option 103 104 (** For 1-way synonyms, indicates the root word that words in the synonyms parameter map to *) 105 val root : t -> string option 106 107 (** By default, special characters are dropped from synonyms. Use this attribute to specify which special characters should be indexed as is *) 108 val symbols_to_index : t -> string list option 109 110 (** Array of words that should be considered as synonyms *) 111 val synonyms : t -> string list 112 113 val jsont : t Jsont.t 114 end 115 116 (** List items in a synonym set 117 118 Retrieve all synonym items in a set 119 @param synonym_set_name The name of the synonym set to retrieve items for 120 *) 121 val retrieve_synonym_set_items : synonym_set_name:string -> t -> unit -> T.t 122 123 (** Retrieve a synonym set item 124 125 Retrieve a specific synonym item by its id 126 @param synonym_set_name The name of the synonym set 127 @param item_id The id of the synonym item to retrieve 128 *) 129 val retrieve_synonym_set_item : synonym_set_name:string -> item_id:string -> t -> unit -> T.t 130 131 (** Create or update a synonym set item 132 133 Create or update a synonym set item with the given id 134 @param synonym_set_name The name of the synonym set 135 @param item_id The id of the synonym item to upsert 136 *) 137 val upsert_synonym_set_item : synonym_set_name:string -> item_id:string -> body:SynonymItemUpsertSchema.T.t -> t -> unit -> T.t 138end 139 140module SynonymSetCreateSchema : sig 141 module T : sig 142 type t 143 144 (** Construct a value 145 @param items Array of synonym items 146 *) 147 val v : items:SynonymItemSchema.T.t list -> unit -> t 148 149 (** Array of synonym items *) 150 val items : t -> SynonymItemSchema.T.t list 151 152 val jsont : t Jsont.t 153 end 154end 155 156module SynonymSetSchema : sig 157 module T : sig 158 type t 159 160 (** Construct a value 161 @param items Array of synonym items 162 @param name Name of the synonym set 163 *) 164 val v : items:SynonymItemSchema.T.t list -> name:string -> unit -> t 165 166 (** Array of synonym items *) 167 val items : t -> SynonymItemSchema.T.t list 168 169 (** Name of the synonym set *) 170 val name : t -> string 171 172 val jsont : t Jsont.t 173 end 174 175 (** List all synonym sets 176 177 Retrieve all synonym sets *) 178 val retrieve_synonym_sets : t -> unit -> T.t 179 180 (** Retrieve a synonym set 181 182 Retrieve a specific synonym set by its name 183 @param synonym_set_name The name of the synonym set to retrieve 184 *) 185 val retrieve_synonym_set : synonym_set_name:string -> t -> unit -> T.t 186 187 (** Create or update a synonym set 188 189 Create or update a synonym set with the given name 190 @param synonym_set_name The name of the synonym set to create/update 191 *) 192 val upsert_synonym_set : synonym_set_name:string -> body:SynonymSetCreateSchema.T.t -> t -> unit -> T.t 193end 194 195module SynonymSetsRetrieveSchema : sig 196 module T : sig 197 type t 198 199 (** Construct a value 200 @param synonym_sets Array of synonym sets 201 *) 202 val v : synonym_sets:SynonymSetSchema.T.t list -> unit -> t 203 204 (** Array of synonym sets *) 205 val synonym_sets : t -> SynonymSetSchema.T.t list 206 207 val jsont : t Jsont.t 208 end 209end 210 211module SynonymItemDeleteSchema : sig 212 module T : sig 213 type t 214 215 (** Construct a value 216 @param id ID of the deleted synonym item 217 *) 218 val v : id:string -> unit -> t 219 220 (** ID of the deleted synonym item *) 221 val id : t -> string 222 223 val jsont : t Jsont.t 224 end 225 226 (** Delete a synonym set item 227 228 Delete a specific synonym item by its id 229 @param synonym_set_name The name of the synonym set 230 @param item_id The id of the synonym item to delete 231 *) 232 val delete_synonym_set_item : synonym_set_name:string -> item_id:string -> t -> unit -> T.t 233end 234 235module Success : sig 236 module Status : sig 237 type t 238 239 (** Construct a value *) 240 val v : success:bool -> unit -> t 241 242 val success : t -> bool 243 244 val jsont : t Jsont.t 245 end 246 247 (** Toggle Slow Request Log 248 249 Enable logging of requests that take over a defined threshold of time. Default is `-1` which disables slow request logging. Slow requests are logged to the primary log file, with the prefix SLOW REQUEST. *) 250 val toggle_slow_request_log : t -> unit -> Status.t 251 252 (** Clear the cached responses of search requests in the LRU cache. 253 254 Clear the cached responses of search requests that are sent with `use_cache` parameter in the LRU cache. *) 255 val clear_cache : t -> unit -> Status.t 256 257 (** Compacting the on-disk database 258 259 Typesense uses RocksDB to store your documents on the disk. If you do frequent writes or updates, you could benefit from running a compaction of the underlying RocksDB database. This could reduce the size of the database and decrease read latency. While the database will not block during this operation, we recommend running it during off-peak hours. *) 260 val compact_db : t -> unit -> Status.t 261 262 (** Creates a point-in-time snapshot of a Typesense node's state and data in the specified directory. 263 264 Creates a point-in-time snapshot of a Typesense node's state and data in the specified directory. You can then backup the snapshot directory that gets created and later restore it as a data directory, as needed. 265 @param snapshot_path The directory on the server where the snapshot should be saved. 266 *) 267 val take_snapshot : snapshot_path:string -> t -> unit -> Status.t 268 269 (** Triggers a follower node to initiate the raft voting process, which triggers leader re-election. 270 271 Triggers a follower node to initiate the raft voting process, which triggers leader re-election. The follower node that you run this operation against will become the new leader, once this command succeeds. *) 272 val vote : t -> unit -> Status.t 273end 274 275module StopwordsSetUpsertSchema : sig 276 module T : sig 277 type t 278 279 (** Construct a value *) 280 val v : stopwords:string list -> ?locale:string -> unit -> t 281 282 val locale : t -> string option 283 284 val stopwords : t -> string list 285 286 val jsont : t Jsont.t 287 end 288end 289 290module StopwordsSetSchema : sig 291 module T : sig 292 type t 293 294 (** Construct a value *) 295 val v : id:string -> stopwords:string list -> ?locale:string -> unit -> t 296 297 val id : t -> string 298 299 val locale : t -> string option 300 301 val stopwords : t -> string list 302 303 val jsont : t Jsont.t 304 end 305 306 (** Upserts a stopwords set. 307 308 When an analytics rule is created, we give it a name and describe the type, the source collections and the destination collection. 309 @param set_id The ID of the stopwords set to upsert. 310 *) 311 val upsert_stopwords_set : set_id:string -> body:StopwordsSetUpsertSchema.T.t -> t -> unit -> T.t 312end 313 314module StopwordsSetsRetrieveAllSchema : sig 315 module T : sig 316 type t 317 318 (** Construct a value *) 319 val v : stopwords:StopwordsSetSchema.T.t list -> unit -> t 320 321 val stopwords : t -> StopwordsSetSchema.T.t list 322 323 val jsont : t Jsont.t 324 end 325 326 (** Retrieves all stopwords sets. 327 328 Retrieve the details of all stopwords sets *) 329 val retrieve_stopwords_sets : t -> unit -> T.t 330end 331 332module StopwordsSetRetrieveSchema : sig 333 module T : sig 334 type t 335 336 (** Construct a value *) 337 val v : stopwords:StopwordsSetSchema.T.t -> unit -> t 338 339 val stopwords : t -> StopwordsSetSchema.T.t 340 341 val jsont : t Jsont.t 342 end 343 344 (** Retrieves a stopwords set. 345 346 Retrieve the details of a stopwords set, given it's name. 347 @param set_id The ID of the stopwords set to retrieve. 348 *) 349 val retrieve_stopwords_set : set_id:string -> t -> unit -> T.t 350end 351 352module StemmingDictionary : sig 353 module T : sig 354 type t 355 356 (** Construct a value 357 @param id Unique identifier for the dictionary 358 @param words List of word mappings in the dictionary 359 *) 360 val v : id:string -> words:Jsont.json list -> unit -> t 361 362 (** Unique identifier for the dictionary *) 363 val id : t -> string 364 365 (** List of word mappings in the dictionary *) 366 val words : t -> Jsont.json list 367 368 val jsont : t Jsont.t 369 end 370 371 (** Retrieve a stemming dictionary 372 373 Fetch details of a specific stemming dictionary. 374 @param dictionary_id The ID of the dictionary to retrieve 375 *) 376 val get_stemming_dictionary : dictionary_id:string -> t -> unit -> T.t 377end 378 379module SearchSynonymSchema : sig 380 module T : sig 381 type t 382 383 (** Construct a value 384 @param synonyms Array of words that should be considered as synonyms. 385 @param locale Locale for the synonym, leave blank to use the standard tokenizer. 386 @param root For 1-way synonyms, indicates the root word that words in the `synonyms` parameter map to. 387 @param symbols_to_index By default, special characters are dropped from synonyms. Use this attribute to specify which special characters should be indexed as is. 388 *) 389 val v : synonyms:string list -> ?locale:string -> ?root:string -> ?symbols_to_index:string list -> unit -> t 390 391 (** Locale for the synonym, leave blank to use the standard tokenizer. *) 392 val locale : t -> string option 393 394 (** For 1-way synonyms, indicates the root word that words in the `synonyms` parameter map to. *) 395 val root : t -> string option 396 397 (** By default, special characters are dropped from synonyms. Use this attribute to specify which special characters should be indexed as is. *) 398 val symbols_to_index : t -> string list option 399 400 (** Array of words that should be considered as synonyms. *) 401 val synonyms : t -> string list 402 403 val jsont : t Jsont.t 404 end 405end 406 407module SearchSynonymDelete : sig 408 module Response : sig 409 type t 410 411 (** Construct a value 412 @param id The id of the synonym that was deleted 413 *) 414 val v : id:string -> unit -> t 415 416 (** The id of the synonym that was deleted *) 417 val id : t -> string 418 419 val jsont : t Jsont.t 420 end 421end 422 423module SearchSynonym : sig 424 module T : sig 425 type t 426 427 (** Construct a value 428 @param synonyms Array of words that should be considered as synonyms. 429 @param locale Locale for the synonym, leave blank to use the standard tokenizer. 430 @param root For 1-way synonyms, indicates the root word that words in the `synonyms` parameter map to. 431 @param symbols_to_index By default, special characters are dropped from synonyms. Use this attribute to specify which special characters should be indexed as is. 432 *) 433 val v : synonyms:string list -> id:string -> ?locale:string -> ?root:string -> ?symbols_to_index:string list -> unit -> t 434 435 (** Locale for the synonym, leave blank to use the standard tokenizer. *) 436 val locale : t -> string option 437 438 (** For 1-way synonyms, indicates the root word that words in the `synonyms` parameter map to. *) 439 val root : t -> string option 440 441 (** By default, special characters are dropped from synonyms. Use this attribute to specify which special characters should be indexed as is. *) 442 val symbols_to_index : t -> string list option 443 444 (** Array of words that should be considered as synonyms. *) 445 val synonyms : t -> string list 446 447 val id : t -> string 448 449 val jsont : t Jsont.t 450 end 451end 452 453module SearchSynonyms : sig 454 module Response : sig 455 type t 456 457 (** Construct a value *) 458 val v : synonyms:SearchSynonym.T.t list -> unit -> t 459 460 val synonyms : t -> SearchSynonym.T.t list 461 462 val jsont : t Jsont.t 463 end 464end 465 466module SearchResultConversation : sig 467 module T : sig 468 type t 469 470 (** Construct a value *) 471 val v : answer:string -> conversation_history:Jsont.json list -> conversation_id:string -> query:string -> unit -> t 472 473 val answer : t -> string 474 475 val conversation_history : t -> Jsont.json list 476 477 val conversation_id : t -> string 478 479 val query : t -> string 480 481 val jsont : t Jsont.t 482 end 483end 484 485module SearchRequestParams : sig 486 module T : sig 487 type t 488 489 (** Construct a value *) 490 val v : collection_name:string -> per_page:int -> q:string -> ?voice_query:Jsont.json -> unit -> t 491 492 val collection_name : t -> string 493 494 val per_page : t -> int 495 496 val q : t -> string 497 498 val voice_query : t -> Jsont.json option 499 500 val jsont : t Jsont.t 501 end 502end 503 504module SearchHighlight : sig 505 module T : sig 506 type t 507 508 (** Construct a value 509 @param indices The indices property will be present only for string[] fields and will contain the corresponding indices of the snippets in the search field 510 @param snippet Present only for (non-array) string fields 511 @param snippets Present only for (array) string[] fields 512 @param value Full field value with highlighting, present only for (non-array) string fields 513 @param values Full field value with highlighting, present only for (array) string[] fields 514 *) 515 val v : ?field:string -> ?indices:int list -> ?matched_tokens:Jsont.json list -> ?snippet:string -> ?snippets:string list -> ?value:string -> ?values:string list -> unit -> t 516 517 val field : t -> string option 518 519 (** The indices property will be present only for string[] fields and will contain the corresponding indices of the snippets in the search field *) 520 val indices : t -> int list option 521 522 val matched_tokens : t -> Jsont.json list option 523 524 (** Present only for (non-array) string fields *) 525 val snippet : t -> string option 526 527 (** Present only for (array) string[] fields *) 528 val snippets : t -> string list option 529 530 (** Full field value with highlighting, present only for (non-array) string fields *) 531 val value : t -> string option 532 533 (** Full field value with highlighting, present only for (array) string[] fields *) 534 val values : t -> string list option 535 536 val jsont : t Jsont.t 537 end 538end 539 540module SearchResultHit : sig 541 module T : sig 542 type t 543 544 (** Construct a value 545 @param document Can be any key-value pair 546 @param geo_distance_meters Can be any key-value pair 547 @param highlight Highlighted version of the matching document 548 @param highlights (Deprecated) Contains highlighted portions of the search fields 549 @param hybrid_search_info Information about hybrid search scoring 550 @param search_index Returned only for union query response. Indicates the index of the query which this document matched to. 551 @param vector_distance Distance between the query vector and matching document's vector value 552 *) 553 val v : ?document:Jsont.json -> ?geo_distance_meters:Jsont.json -> ?highlight:Jsont.json -> ?highlights:SearchHighlight.T.t list -> ?hybrid_search_info:Jsont.json -> ?search_index:int -> ?text_match:int64 -> ?text_match_info:Jsont.json -> ?vector_distance:float -> unit -> t 554 555 (** Can be any key-value pair *) 556 val document : t -> Jsont.json option 557 558 (** Can be any key-value pair *) 559 val geo_distance_meters : t -> Jsont.json option 560 561 (** Highlighted version of the matching document *) 562 val highlight : t -> Jsont.json option 563 564 (** (Deprecated) Contains highlighted portions of the search fields *) 565 val highlights : t -> SearchHighlight.T.t list option 566 567 (** Information about hybrid search scoring *) 568 val hybrid_search_info : t -> Jsont.json option 569 570 (** Returned only for union query response. Indicates the index of the query which this document matched to. *) 571 val search_index : t -> int option 572 573 val text_match : t -> int64 option 574 575 val text_match_info : t -> Jsont.json option 576 577 (** Distance between the query vector and matching document's vector value *) 578 val vector_distance : t -> float option 579 580 val jsont : t Jsont.t 581 end 582end 583 584module SearchGroupedHit : sig 585 module T : sig 586 type t 587 588 (** Construct a value 589 @param hits The documents that matched the search query 590 *) 591 val v : group_key:Jsont.json list -> hits:SearchResultHit.T.t list -> ?found:int -> unit -> t 592 593 val found : t -> int option 594 595 val group_key : t -> Jsont.json list 596 597 (** The documents that matched the search query *) 598 val hits : t -> SearchResultHit.T.t list 599 600 val jsont : t Jsont.t 601 end 602end 603 604module SchemaChange : sig 605 module Status : sig 606 type t 607 608 (** Construct a value 609 @param altered_docs Number of documents that have been altered 610 @param collection Name of the collection being modified 611 @param validated_docs Number of documents that have been validated 612 *) 613 val v : ?altered_docs:int -> ?collection:string -> ?validated_docs:int -> unit -> t 614 615 (** Number of documents that have been altered *) 616 val altered_docs : t -> int option 617 618 (** Name of the collection being modified *) 619 val collection : t -> string option 620 621 (** Number of documents that have been validated *) 622 val validated_docs : t -> int option 623 624 val jsont : t Jsont.t 625 end 626 627 (** Get the status of in-progress schema change operations 628 629 Returns the status of any ongoing schema change operations. If no schema changes are in progress, returns an empty response. *) 630 val get_schema_changes : t -> unit -> Status.t 631end 632 633module PresetUpsertSchema : sig 634 module T : sig 635 type t 636 637 (** Construct a value *) 638 val v : value:Jsont.json -> unit -> t 639 640 val value : t -> Jsont.json 641 642 val jsont : t Jsont.t 643 end 644end 645 646module PresetSchema : sig 647 module T : sig 648 type t 649 650 (** Construct a value *) 651 val v : value:Jsont.json -> name:string -> unit -> t 652 653 val value : t -> Jsont.json 654 655 val name : t -> string 656 657 val jsont : t Jsont.t 658 end 659 660 (** Retrieves a preset. 661 662 Retrieve the details of a preset, given it's name. 663 @param preset_id The ID of the preset to retrieve. 664 *) 665 val retrieve_preset : preset_id:string -> t -> unit -> T.t 666 667 (** Upserts a preset. 668 669 Create or update an existing preset. 670 @param preset_id The name of the preset set to upsert. 671 *) 672 val upsert_preset : preset_id:string -> body:PresetUpsertSchema.T.t -> t -> unit -> T.t 673end 674 675module PresetsRetrieveSchema : sig 676 module T : sig 677 type t 678 679 (** Construct a value *) 680 val v : presets:PresetSchema.T.t list -> unit -> t 681 682 val presets : t -> PresetSchema.T.t list 683 684 val jsont : t Jsont.t 685 end 686 687 (** Retrieves all presets. 688 689 Retrieve the details of all presets *) 690 val retrieve_all_presets : t -> unit -> T.t 691end 692 693module PresetDeleteSchema : sig 694 module T : sig 695 type t 696 697 (** Construct a value *) 698 val v : name:string -> unit -> t 699 700 val name : t -> string 701 702 val jsont : t Jsont.t 703 end 704 705 (** Delete a preset. 706 707 Permanently deletes a preset, given it's name. 708 @param preset_id The ID of the preset to delete. 709 *) 710 val delete_preset : preset_id:string -> t -> unit -> T.t 711end 712 713module NlsearchModelDeleteSchema : sig 714 module T : sig 715 type t 716 717 (** Construct a value 718 @param id ID of the deleted NL search model 719 *) 720 val v : id:string -> unit -> t 721 722 (** ID of the deleted NL search model *) 723 val id : t -> string 724 725 val jsont : t Jsont.t 726 end 727 728 (** Delete a NL search model 729 730 Delete a specific NL search model by its ID. 731 @param model_id The ID of the NL search model to delete 732 *) 733 val delete_nlsearch_model : model_id:string -> t -> unit -> T.t 734end 735 736module NlsearchModelCreateSchema : sig 737 module T : sig 738 type t 739 740 (** Construct a value 741 @param access_token Access token for GCP Vertex AI 742 @param account_id Account ID for Cloudflare-specific models 743 @param api_key API key for the NL model service 744 @param api_url Custom API URL for the NL model service 745 @param api_version API version for the NL model service 746 @param client_id Client ID for GCP Vertex AI 747 @param client_secret Client secret for GCP Vertex AI 748 @param max_bytes Maximum number of bytes to process 749 @param max_output_tokens Maximum output tokens for GCP Vertex AI 750 @param model_name Name of the NL model to use 751 @param project_id Project ID for GCP Vertex AI 752 @param refresh_token Refresh token for GCP Vertex AI 753 @param region Region for GCP Vertex AI 754 @param stop_sequences Stop sequences for the NL model (Google-specific) 755 @param system_prompt System prompt for the NL model 756 @param temperature Temperature parameter for the NL model 757 @param top_k Top-k parameter for the NL model (Google-specific) 758 @param top_p Top-p parameter for the NL model (Google-specific) 759 @param id Optional ID for the NL search model 760 *) 761 val v : ?access_token:string -> ?account_id:string -> ?api_key:string -> ?api_url:string -> ?api_version:string -> ?client_id:string -> ?client_secret:string -> ?max_bytes:int -> ?max_output_tokens:int -> ?model_name:string -> ?project_id:string -> ?refresh_token:string -> ?region:string -> ?stop_sequences:string list -> ?system_prompt:string -> ?temperature:float -> ?top_k:int -> ?top_p:float -> ?id:string -> unit -> t 762 763 (** Access token for GCP Vertex AI *) 764 val access_token : t -> string option 765 766 (** Account ID for Cloudflare-specific models *) 767 val account_id : t -> string option 768 769 (** API key for the NL model service *) 770 val api_key : t -> string option 771 772 (** Custom API URL for the NL model service *) 773 val api_url : t -> string option 774 775 (** API version for the NL model service *) 776 val api_version : t -> string option 777 778 (** Client ID for GCP Vertex AI *) 779 val client_id : t -> string option 780 781 (** Client secret for GCP Vertex AI *) 782 val client_secret : t -> string option 783 784 (** Maximum number of bytes to process *) 785 val max_bytes : t -> int option 786 787 (** Maximum output tokens for GCP Vertex AI *) 788 val max_output_tokens : t -> int option 789 790 (** Name of the NL model to use *) 791 val model_name : t -> string option 792 793 (** Project ID for GCP Vertex AI *) 794 val project_id : t -> string option 795 796 (** Refresh token for GCP Vertex AI *) 797 val refresh_token : t -> string option 798 799 (** Region for GCP Vertex AI *) 800 val region : t -> string option 801 802 (** Stop sequences for the NL model (Google-specific) *) 803 val stop_sequences : t -> string list option 804 805 (** System prompt for the NL model *) 806 val system_prompt : t -> string option 807 808 (** Temperature parameter for the NL model *) 809 val temperature : t -> float option 810 811 (** Top-k parameter for the NL model (Google-specific) *) 812 val top_k : t -> int option 813 814 (** Top-p parameter for the NL model (Google-specific) *) 815 val top_p : t -> float option 816 817 (** Optional ID for the NL search model *) 818 val id : t -> string option 819 820 val jsont : t Jsont.t 821 end 822end 823 824module NlsearchModelSchema : sig 825 module T : sig 826 type t 827 828 (** Construct a value 829 @param id ID of the NL search model 830 @param access_token Access token for GCP Vertex AI 831 @param account_id Account ID for Cloudflare-specific models 832 @param api_key API key for the NL model service 833 @param api_url Custom API URL for the NL model service 834 @param api_version API version for the NL model service 835 @param client_id Client ID for GCP Vertex AI 836 @param client_secret Client secret for GCP Vertex AI 837 @param max_bytes Maximum number of bytes to process 838 @param max_output_tokens Maximum output tokens for GCP Vertex AI 839 @param model_name Name of the NL model to use 840 @param project_id Project ID for GCP Vertex AI 841 @param refresh_token Refresh token for GCP Vertex AI 842 @param region Region for GCP Vertex AI 843 @param stop_sequences Stop sequences for the NL model (Google-specific) 844 @param system_prompt System prompt for the NL model 845 @param temperature Temperature parameter for the NL model 846 @param top_k Top-k parameter for the NL model (Google-specific) 847 @param top_p Top-p parameter for the NL model (Google-specific) 848 *) 849 val v : id:string -> ?access_token:string -> ?account_id:string -> ?api_key:string -> ?api_url:string -> ?api_version:string -> ?client_id:string -> ?client_secret:string -> ?max_bytes:int -> ?max_output_tokens:int -> ?model_name:string -> ?project_id:string -> ?refresh_token:string -> ?region:string -> ?stop_sequences:string list -> ?system_prompt:string -> ?temperature:float -> ?top_k:int -> ?top_p:float -> unit -> t 850 851 (** Access token for GCP Vertex AI *) 852 val access_token : t -> string option 853 854 (** Account ID for Cloudflare-specific models *) 855 val account_id : t -> string option 856 857 (** API key for the NL model service *) 858 val api_key : t -> string option 859 860 (** Custom API URL for the NL model service *) 861 val api_url : t -> string option 862 863 (** API version for the NL model service *) 864 val api_version : t -> string option 865 866 (** Client ID for GCP Vertex AI *) 867 val client_id : t -> string option 868 869 (** Client secret for GCP Vertex AI *) 870 val client_secret : t -> string option 871 872 (** Maximum number of bytes to process *) 873 val max_bytes : t -> int option 874 875 (** Maximum output tokens for GCP Vertex AI *) 876 val max_output_tokens : t -> int option 877 878 (** Name of the NL model to use *) 879 val model_name : t -> string option 880 881 (** Project ID for GCP Vertex AI *) 882 val project_id : t -> string option 883 884 (** Refresh token for GCP Vertex AI *) 885 val refresh_token : t -> string option 886 887 (** Region for GCP Vertex AI *) 888 val region : t -> string option 889 890 (** Stop sequences for the NL model (Google-specific) *) 891 val stop_sequences : t -> string list option 892 893 (** System prompt for the NL model *) 894 val system_prompt : t -> string option 895 896 (** Temperature parameter for the NL model *) 897 val temperature : t -> float option 898 899 (** Top-k parameter for the NL model (Google-specific) *) 900 val top_k : t -> int option 901 902 (** Top-p parameter for the NL model (Google-specific) *) 903 val top_p : t -> float option 904 905 (** ID of the NL search model *) 906 val id : t -> string 907 908 val jsont : t Jsont.t 909 end 910 911 (** List all NL search models 912 913 Retrieve all NL search models. *) 914 val retrieve_all_nlsearch_models : t -> unit -> T.t 915 916 (** Create a NL search model 917 918 Create a new NL search model. *) 919 val create_nlsearch_model : body:NlsearchModelCreateSchema.T.t -> t -> unit -> T.t 920 921 (** Retrieve a NL search model 922 923 Retrieve a specific NL search model by its ID. 924 @param model_id The ID of the NL search model to retrieve 925 *) 926 val retrieve_nlsearch_model : model_id:string -> t -> unit -> T.t 927 928 (** Update a NL search model 929 930 Update an existing NL search model. 931 @param model_id The ID of the NL search model to update 932 *) 933 val update_nlsearch_model : model_id:string -> t -> unit -> T.t 934end 935 936module NlsearchModelBase : sig 937 module T : sig 938 type t 939 940 (** Construct a value 941 @param access_token Access token for GCP Vertex AI 942 @param account_id Account ID for Cloudflare-specific models 943 @param api_key API key for the NL model service 944 @param api_url Custom API URL for the NL model service 945 @param api_version API version for the NL model service 946 @param client_id Client ID for GCP Vertex AI 947 @param client_secret Client secret for GCP Vertex AI 948 @param max_bytes Maximum number of bytes to process 949 @param max_output_tokens Maximum output tokens for GCP Vertex AI 950 @param model_name Name of the NL model to use 951 @param project_id Project ID for GCP Vertex AI 952 @param refresh_token Refresh token for GCP Vertex AI 953 @param region Region for GCP Vertex AI 954 @param stop_sequences Stop sequences for the NL model (Google-specific) 955 @param system_prompt System prompt for the NL model 956 @param temperature Temperature parameter for the NL model 957 @param top_k Top-k parameter for the NL model (Google-specific) 958 @param top_p Top-p parameter for the NL model (Google-specific) 959 *) 960 val v : ?access_token:string -> ?account_id:string -> ?api_key:string -> ?api_url:string -> ?api_version:string -> ?client_id:string -> ?client_secret:string -> ?max_bytes:int -> ?max_output_tokens:int -> ?model_name:string -> ?project_id:string -> ?refresh_token:string -> ?region:string -> ?stop_sequences:string list -> ?system_prompt:string -> ?temperature:float -> ?top_k:int -> ?top_p:float -> unit -> t 961 962 (** Access token for GCP Vertex AI *) 963 val access_token : t -> string option 964 965 (** Account ID for Cloudflare-specific models *) 966 val account_id : t -> string option 967 968 (** API key for the NL model service *) 969 val api_key : t -> string option 970 971 (** Custom API URL for the NL model service *) 972 val api_url : t -> string option 973 974 (** API version for the NL model service *) 975 val api_version : t -> string option 976 977 (** Client ID for GCP Vertex AI *) 978 val client_id : t -> string option 979 980 (** Client secret for GCP Vertex AI *) 981 val client_secret : t -> string option 982 983 (** Maximum number of bytes to process *) 984 val max_bytes : t -> int option 985 986 (** Maximum output tokens for GCP Vertex AI *) 987 val max_output_tokens : t -> int option 988 989 (** Name of the NL model to use *) 990 val model_name : t -> string option 991 992 (** Project ID for GCP Vertex AI *) 993 val project_id : t -> string option 994 995 (** Refresh token for GCP Vertex AI *) 996 val refresh_token : t -> string option 997 998 (** Region for GCP Vertex AI *) 999 val region : t -> string option 1000 1001 (** Stop sequences for the NL model (Google-specific) *) 1002 val stop_sequences : t -> string list option 1003 1004 (** System prompt for the NL model *) 1005 val system_prompt : t -> string option 1006 1007 (** Temperature parameter for the NL model *) 1008 val temperature : t -> float option 1009 1010 (** Top-k parameter for the NL model (Google-specific) *) 1011 val top_k : t -> int option 1012 1013 (** Top-p parameter for the NL model (Google-specific) *) 1014 val top_p : t -> float option 1015 1016 val jsont : t Jsont.t 1017 end 1018end 1019 1020module IndexAction : sig 1021 module T : sig 1022 type t = [ 1023 | `Create 1024 | `Update 1025 | `Upsert 1026 | `Emplace 1027 ] 1028 1029 val jsont : t Jsont.t 1030 end 1031end 1032 1033module Health : sig 1034 module Status : sig 1035 type t 1036 1037 (** Construct a value *) 1038 val v : ok:bool -> unit -> t 1039 1040 val ok : t -> bool 1041 1042 val jsont : t Jsont.t 1043 end 1044 1045 (** Checks if Typesense server is ready to accept requests. 1046 1047 Checks if Typesense server is ready to accept requests. *) 1048 val health : t -> unit -> Status.t 1049end 1050 1051module Field : sig 1052 module T : sig 1053 type t 1054 1055 (** Construct a value 1056 @param symbols_to_index List of symbols or special characters to be indexed. 1057 1058 @param token_separators List of symbols or special characters to be used for splitting the text into individual words in addition to space and new-line characters. 1059 1060 @param async_reference Allow documents to be indexed successfully even when the referenced document doesn't exist yet. 1061 1062 @param range_index Enables an index optimized for range filtering on numerical fields (e.g. rating:>3.5). Default: false. 1063 1064 @param reference Name of a field in another collection that should be linked to this collection so that it can be joined during query. 1065 1066 @param stem Values are stemmed before indexing in-memory. Default: false. 1067 1068 @param stem_dictionary Name of the stemming dictionary to use for this field 1069 @param store When set to false, the field value will not be stored on disk. Default: true. 1070 1071 @param vec_dist The distance metric to be used for vector search. Default: `cosine`. You can also use `ip` for inner product. 1072 1073 *) 1074 val v : name:string -> type_:string -> ?index:bool -> ?infix:bool -> ?symbols_to_index:string list -> ?token_separators:string list -> ?async_reference:bool -> ?drop:bool -> ?embed:Jsont.json -> ?facet:bool -> ?locale:string -> ?num_dim:int -> ?optional:bool -> ?range_index:bool -> ?reference:string -> ?sort:bool -> ?stem:bool -> ?stem_dictionary:string -> ?store:bool -> ?vec_dist:string -> unit -> t 1075 1076 (** Allow documents to be indexed successfully even when the referenced document doesn't exist yet. 1077 *) 1078 val async_reference : t -> bool option 1079 1080 val drop : t -> bool option 1081 1082 val embed : t -> Jsont.json option 1083 1084 val facet : t -> bool option 1085 1086 val index : t -> bool 1087 1088 val infix : t -> bool 1089 1090 val locale : t -> string option 1091 1092 val name : t -> string 1093 1094 val num_dim : t -> int option 1095 1096 val optional : t -> bool option 1097 1098 (** Enables an index optimized for range filtering on numerical fields (e.g. rating:>3.5). Default: false. 1099 *) 1100 val range_index : t -> bool option 1101 1102 (** Name of a field in another collection that should be linked to this collection so that it can be joined during query. 1103 *) 1104 val reference : t -> string option 1105 1106 val sort : t -> bool option 1107 1108 (** Values are stemmed before indexing in-memory. Default: false. 1109 *) 1110 val stem : t -> bool option 1111 1112 (** Name of the stemming dictionary to use for this field *) 1113 val stem_dictionary : t -> string option 1114 1115 (** When set to false, the field value will not be stored on disk. Default: true. 1116 *) 1117 val store : t -> bool option 1118 1119 (** List of symbols or special characters to be indexed. 1120 *) 1121 val symbols_to_index : t -> string list 1122 1123 (** List of symbols or special characters to be used for splitting the text into individual words in addition to space and new-line characters. 1124 *) 1125 val token_separators : t -> string list 1126 1127 val type_ : t -> string 1128 1129 (** The distance metric to be used for vector search. Default: `cosine`. You can also use `ip` for inner product. 1130 *) 1131 val vec_dist : t -> string option 1132 1133 val jsont : t Jsont.t 1134 end 1135end 1136 1137module CollectionUpdateSchema : sig 1138 module T : sig 1139 type t 1140 1141 (** Construct a value 1142 @param fields A list of fields for querying, filtering and faceting 1143 @param metadata Optional details about the collection, e.g., when it was created, who created it etc. 1144 1145 @param synonym_sets List of synonym set names to associate with this collection 1146 *) 1147 val v : fields:Field.T.t list -> ?metadata:Jsont.json -> ?synonym_sets:string list -> unit -> t 1148 1149 (** A list of fields for querying, filtering and faceting *) 1150 val fields : t -> Field.T.t list 1151 1152 (** Optional details about the collection, e.g., when it was created, who created it etc. 1153 *) 1154 val metadata : t -> Jsont.json option 1155 1156 (** List of synonym set names to associate with this collection *) 1157 val synonym_sets : t -> string list option 1158 1159 val jsont : t Jsont.t 1160 end 1161 1162 (** Update a collection 1163 1164 Update a collection's schema to modify the fields and their types. 1165 @param collection_name The name of the collection to update 1166 *) 1167 val update_collection : collection_name:string -> body:T.t -> t -> unit -> T.t 1168end 1169 1170module CollectionSchema : sig 1171 module T : sig 1172 type t 1173 1174 (** Construct a value 1175 @param fields A list of fields for querying, filtering and faceting 1176 @param name Name of the collection 1177 @param default_sorting_field The name of an int32 / float field that determines the order in which the search results are ranked when a sort_by clause is not provided during searching. This field must indicate some kind of popularity. 1178 @param enable_nested_fields Enables experimental support at a collection level for nested object or object array fields. This field is only available if the Typesense server is version `0.24.0.rcn34` or later. 1179 @param symbols_to_index List of symbols or special characters to be indexed. 1180 1181 @param token_separators List of symbols or special characters to be used for splitting the text into individual words in addition to space and new-line characters. 1182 1183 @param metadata Optional details about the collection, e.g., when it was created, who created it etc. 1184 1185 @param synonym_sets List of synonym set names to associate with this collection 1186 *) 1187 val v : fields:Field.T.t list -> name:string -> ?default_sorting_field:string -> ?enable_nested_fields:bool -> ?symbols_to_index:string list -> ?token_separators:string list -> ?metadata:Jsont.json -> ?synonym_sets:string list -> ?voice_query_model:VoiceQueryModelCollection.Config.t -> unit -> t 1188 1189 (** The name of an int32 / float field that determines the order in which the search results are ranked when a sort_by clause is not provided during searching. This field must indicate some kind of popularity. *) 1190 val default_sorting_field : t -> string 1191 1192 (** Enables experimental support at a collection level for nested object or object array fields. This field is only available if the Typesense server is version `0.24.0.rcn34` or later. *) 1193 val enable_nested_fields : t -> bool 1194 1195 (** A list of fields for querying, filtering and faceting *) 1196 val fields : t -> Field.T.t list 1197 1198 (** Optional details about the collection, e.g., when it was created, who created it etc. 1199 *) 1200 val metadata : t -> Jsont.json option 1201 1202 (** Name of the collection *) 1203 val name : t -> string 1204 1205 (** List of symbols or special characters to be indexed. 1206 *) 1207 val symbols_to_index : t -> string list 1208 1209 (** List of synonym set names to associate with this collection *) 1210 val synonym_sets : t -> string list option 1211 1212 (** List of symbols or special characters to be used for splitting the text into individual words in addition to space and new-line characters. 1213 *) 1214 val token_separators : t -> string list 1215 1216 val voice_query_model : t -> VoiceQueryModelCollection.Config.t option 1217 1218 val jsont : t Jsont.t 1219 end 1220end 1221 1222module Collection : sig 1223 module Response : sig 1224 type t 1225 1226 (** Construct a value 1227 @param fields A list of fields for querying, filtering and faceting 1228 @param name Name of the collection 1229 @param num_documents Number of documents in the collection 1230 @param created_at Timestamp of when the collection was created (Unix epoch in seconds) 1231 @param default_sorting_field The name of an int32 / float field that determines the order in which the search results are ranked when a sort_by clause is not provided during searching. This field must indicate some kind of popularity. 1232 @param enable_nested_fields Enables experimental support at a collection level for nested object or object array fields. This field is only available if the Typesense server is version `0.24.0.rcn34` or later. 1233 @param symbols_to_index List of symbols or special characters to be indexed. 1234 1235 @param token_separators List of symbols or special characters to be used for splitting the text into individual words in addition to space and new-line characters. 1236 1237 @param metadata Optional details about the collection, e.g., when it was created, who created it etc. 1238 1239 @param synonym_sets List of synonym set names to associate with this collection 1240 *) 1241 val v : fields:Field.T.t list -> name:string -> num_documents:int64 -> created_at:int64 -> ?default_sorting_field:string -> ?enable_nested_fields:bool -> ?symbols_to_index:string list -> ?token_separators:string list -> ?metadata:Jsont.json -> ?synonym_sets:string list -> ?voice_query_model:VoiceQueryModelCollection.Config.t -> unit -> t 1242 1243 (** The name of an int32 / float field that determines the order in which the search results are ranked when a sort_by clause is not provided during searching. This field must indicate some kind of popularity. *) 1244 val default_sorting_field : t -> string 1245 1246 (** Enables experimental support at a collection level for nested object or object array fields. This field is only available if the Typesense server is version `0.24.0.rcn34` or later. *) 1247 val enable_nested_fields : t -> bool 1248 1249 (** A list of fields for querying, filtering and faceting *) 1250 val fields : t -> Field.T.t list 1251 1252 (** Optional details about the collection, e.g., when it was created, who created it etc. 1253 *) 1254 val metadata : t -> Jsont.json option 1255 1256 (** Name of the collection *) 1257 val name : t -> string 1258 1259 (** List of symbols or special characters to be indexed. 1260 *) 1261 val symbols_to_index : t -> string list 1262 1263 (** List of synonym set names to associate with this collection *) 1264 val synonym_sets : t -> string list option 1265 1266 (** List of symbols or special characters to be used for splitting the text into individual words in addition to space and new-line characters. 1267 *) 1268 val token_separators : t -> string list 1269 1270 val voice_query_model : t -> VoiceQueryModelCollection.Config.t option 1271 1272 (** Number of documents in the collection *) 1273 val num_documents : t -> int64 1274 1275 (** Timestamp of when the collection was created (Unix epoch in seconds) *) 1276 val created_at : t -> int64 1277 1278 val jsont : t Jsont.t 1279 end 1280 1281 (** List all collections 1282 1283 Returns a summary of all your collections. The collections are returned sorted by creation date, with the most recent collections appearing first. *) 1284 val get_collections : ?get_collections_parameters:string -> t -> unit -> Response.t 1285 1286 (** Create a new collection 1287 1288 When a collection is created, we give it a name and describe the fields that will be indexed from the documents added to the collection. *) 1289 val create_collection : body:CollectionSchema.T.t -> t -> unit -> Response.t 1290 1291 (** Retrieve a single collection 1292 1293 Retrieve the details of a collection, given its name. 1294 @param collection_name The name of the collection to retrieve 1295 *) 1296 val get_collection : collection_name:string -> t -> unit -> Response.t 1297 1298 (** Delete a collection 1299 1300 Permanently drops a collection. This action cannot be undone. For large collections, this might have an impact on read latencies. 1301 @param collection_name The name of the collection to delete 1302 *) 1303 val delete_collection : collection_name:string -> t -> unit -> Response.t 1304end 1305 1306module FacetCounts : sig 1307 module T : sig 1308 type t 1309 1310 (** Construct a value *) 1311 val v : ?counts:Jsont.json list -> ?field_name:string -> ?stats:Jsont.json -> unit -> t 1312 1313 val counts : t -> Jsont.json list option 1314 1315 val field_name : t -> string option 1316 1317 val stats : t -> Jsont.json option 1318 1319 val jsont : t Jsont.t 1320 end 1321end 1322 1323module Search : sig 1324 module Result : sig 1325 type t 1326 1327 (** Construct a value 1328 @param found The number of documents found 1329 @param hits The documents that matched the search query 1330 @param metadata Custom JSON object that can be returned in the search response 1331 @param out_of The total number of documents in the collection 1332 @param page The search result page number 1333 @param search_cutoff Whether the search was cut off 1334 @param search_time_ms The number of milliseconds the search took 1335 @param union_request_params Returned only for union query response. 1336 *) 1337 val v : ?conversation:SearchResultConversation.T.t -> ?facet_counts:FacetCounts.T.t list -> ?found:int -> ?found_docs:int -> ?grouped_hits:SearchGroupedHit.T.t list -> ?hits:SearchResultHit.T.t list -> ?metadata:Jsont.json -> ?out_of:int -> ?page:int -> ?request_params:SearchRequestParams.T.t -> ?search_cutoff:bool -> ?search_time_ms:int -> ?union_request_params:SearchRequestParams.T.t list -> unit -> t 1338 1339 val conversation : t -> SearchResultConversation.T.t option 1340 1341 val facet_counts : t -> FacetCounts.T.t list option 1342 1343 (** The number of documents found *) 1344 val found : t -> int option 1345 1346 val found_docs : t -> int option 1347 1348 val grouped_hits : t -> SearchGroupedHit.T.t list option 1349 1350 (** The documents that matched the search query *) 1351 val hits : t -> SearchResultHit.T.t list option 1352 1353 (** Custom JSON object that can be returned in the search response *) 1354 val metadata : t -> Jsont.json option 1355 1356 (** The total number of documents in the collection *) 1357 val out_of : t -> int option 1358 1359 (** The search result page number *) 1360 val page : t -> int option 1361 1362 val request_params : t -> SearchRequestParams.T.t option 1363 1364 (** Whether the search was cut off *) 1365 val search_cutoff : t -> bool option 1366 1367 (** The number of milliseconds the search took *) 1368 val search_time_ms : t -> int option 1369 1370 (** Returned only for union query response. *) 1371 val union_request_params : t -> SearchRequestParams.T.t list option 1372 1373 val jsont : t Jsont.t 1374 end 1375 1376 (** Search for documents in a collection 1377 1378 Search for documents in a collection that match the search criteria. 1379 @param collection_name The name of the collection to search for the document under 1380 *) 1381 val search_collection : collection_name:string -> search_parameters:string -> t -> unit -> Result.t 1382end 1383 1384module MultiSearchResult : sig 1385 module Item : sig 1386 type t 1387 1388 (** Construct a value 1389 @param found The number of documents found 1390 @param hits The documents that matched the search query 1391 @param metadata Custom JSON object that can be returned in the search response 1392 @param out_of The total number of documents in the collection 1393 @param page The search result page number 1394 @param search_cutoff Whether the search was cut off 1395 @param search_time_ms The number of milliseconds the search took 1396 @param union_request_params Returned only for union query response. 1397 @param code HTTP error code 1398 @param error Error description 1399 *) 1400 val v : ?conversation:SearchResultConversation.T.t -> ?facet_counts:FacetCounts.T.t list -> ?found:int -> ?found_docs:int -> ?grouped_hits:SearchGroupedHit.T.t list -> ?hits:SearchResultHit.T.t list -> ?metadata:Jsont.json -> ?out_of:int -> ?page:int -> ?request_params:SearchRequestParams.T.t -> ?search_cutoff:bool -> ?search_time_ms:int -> ?union_request_params:SearchRequestParams.T.t list -> ?code:int64 -> ?error:string -> unit -> t 1401 1402 val conversation : t -> SearchResultConversation.T.t option 1403 1404 val facet_counts : t -> FacetCounts.T.t list option 1405 1406 (** The number of documents found *) 1407 val found : t -> int option 1408 1409 val found_docs : t -> int option 1410 1411 val grouped_hits : t -> SearchGroupedHit.T.t list option 1412 1413 (** The documents that matched the search query *) 1414 val hits : t -> SearchResultHit.T.t list option 1415 1416 (** Custom JSON object that can be returned in the search response *) 1417 val metadata : t -> Jsont.json option 1418 1419 (** The total number of documents in the collection *) 1420 val out_of : t -> int option 1421 1422 (** The search result page number *) 1423 val page : t -> int option 1424 1425 val request_params : t -> SearchRequestParams.T.t option 1426 1427 (** Whether the search was cut off *) 1428 val search_cutoff : t -> bool option 1429 1430 (** The number of milliseconds the search took *) 1431 val search_time_ms : t -> int option 1432 1433 (** Returned only for union query response. *) 1434 val union_request_params : t -> SearchRequestParams.T.t list option 1435 1436 (** HTTP error code *) 1437 val code : t -> int64 option 1438 1439 (** Error description *) 1440 val error : t -> string option 1441 1442 val jsont : t Jsont.t 1443 end 1444end 1445 1446module DropTokensMode : sig 1447 module T : sig 1448 (** Dictates the direction in which the words in the query must be dropped when the original words in the query do not appear in any document. Values: right_to_left (default), left_to_right, both_sides:3 A note on both_sides:3 - for queries up to 3 tokens (words) in length, this mode will drop tokens from both sides and exhaustively rank all matching results. If query length is greater than 3 words, Typesense will just fallback to default behavior of right_to_left 1449 *) 1450 type t = [ 1451 | `Right_to_left 1452 | `Left_to_right 1453 | `Both_sides3 1454 ] 1455 1456 val jsont : t Jsont.t 1457 end 1458end 1459 1460module SearchParameters : sig 1461 module T : sig 1462 type t 1463 1464 (** Construct a value 1465 @param enable_analytics Flag for enabling/disabling analytics aggregation for specific search queries (for e.g. those originating from a test script). 1466 1467 @param enable_highlight_v1 Flag for enabling/disabling the deprecated, old highlight structure in the response. Default: true 1468 1469 @param enable_overrides If you have some overrides defined but want to disable all of them during query time, you can do that by setting this parameter to false 1470 1471 @param enable_typos_for_numerical_tokens Make Typesense disable typos for numerical tokens. 1472 1473 @param prioritize_exact_match Set this parameter to true to ensure that an exact match is ranked above the others 1474 1475 @param prioritize_num_matching_fields Make Typesense prioritize documents where the query words appear in more number of fields. 1476 1477 @param prioritize_token_position Make Typesense prioritize documents where the query words appear earlier in the text. 1478 1479 @param cache_ttl The duration (in seconds) that determines how long the search query is cached. This value can be set on a per-query basis. Default: 60. 1480 1481 @param conversation Enable conversational search. 1482 1483 @param conversation_id The Id of a previous conversation to continue, this tells Typesense to include prior context when communicating with the LLM. 1484 1485 @param conversation_model_id The Id of Conversation Model to be used. 1486 1487 @param drop_tokens_threshold If the number of results found for a specific query is less than this number, Typesense will attempt to drop the tokens in the query until enough results are found. Tokens that have the least individual hits are dropped first. Set to 0 to disable. Default: 10 1488 1489 @param enable_synonyms If you have some synonyms defined but want to disable all of them for a particular search query, set enable_synonyms to false. Default: true 1490 1491 @param enable_typos_for_alpha_numerical_tokens Set this parameter to false to disable typos on alphanumerical query tokens. Default: true. 1492 1493 @param exclude_fields List of fields from the document to exclude in the search result 1494 @param exhaustive_search Setting this to true will make Typesense consider all prefixes and typo corrections of the words in the query without stopping early when enough results are found (drop_tokens_threshold and typo_tokens_threshold configurations are ignored). 1495 1496 @param facet_by A list of fields that will be used for faceting your results on. Separate multiple fields with a comma. 1497 @param facet_query Facet values that are returned can now be filtered via this parameter. The matching facet text is also highlighted. For example, when faceting by `category`, you can set `facet_query=category:shoe` to return only facet values that contain the prefix "shoe". 1498 @param facet_return_parent Comma separated string of nested facet fields whose parent object should be returned in facet response. 1499 1500 @param facet_strategy Choose the underlying faceting strategy used. Comma separated string of allows values: exhaustive, top_values or automatic (default). 1501 1502 @param filter_by Filter conditions for refining your open api validator search results. Separate multiple conditions with &&. 1503 @param filter_curated_hits Whether the filter_by condition of the search query should be applicable to curated results (override definitions, pinned hits, hidden hits, etc.). Default: false 1504 1505 @param group_by You can aggregate search results into groups or buckets by specify one or more `group_by` fields. Separate multiple fields with a comma. To group on a particular field, it must be a faceted field. 1506 @param group_limit Maximum number of hits to be returned for every group. If the `group_limit` is set as `K` then only the top K hits in each group are returned in the response. Default: 3 1507 1508 @param group_missing_values Setting this parameter to true will place all documents that have a null value in the group_by field, into a single group. Setting this parameter to false, will cause each document with a null value in the group_by field to not be grouped with other documents. Default: true 1509 1510 @param hidden_hits A list of records to unconditionally hide from search results. A list of `record_id`s to hide. Eg: to hide records with IDs 123 and 456, you'd specify `123,456`. 1511 You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. 1512 1513 @param highlight_affix_num_tokens The number of tokens that should surround the highlighted text on each side. Default: 4 1514 1515 @param highlight_end_tag The end tag used for the highlighted snippets. Default: `</mark>` 1516 1517 @param highlight_fields A list of custom fields that must be highlighted even if you don't query for them 1518 1519 @param highlight_full_fields List of fields which should be highlighted fully without snippeting 1520 @param highlight_start_tag The start tag used for the highlighted snippets. Default: `<mark>` 1521 1522 @param include_fields List of fields from the document to include in the search result 1523 @param infix If infix index is enabled for this field, infix searching can be done on a per-field basis by sending a comma separated string parameter called infix to the search query. This parameter can have 3 values; `off` infix search is disabled, which is default `always` infix search is performed along with regular search `fallback` infix search is performed if regular search does not produce results 1524 @param limit Number of hits to fetch. Can be used as an alternative to the per_page parameter. Default: 10. 1525 1526 @param max_candidates Control the number of words that Typesense considers for typo and prefix searching. 1527 1528 @param max_extra_prefix There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query "K2100" has 2 extra symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match. 1529 @param max_extra_suffix There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query "K2100" has 2 extra symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match. 1530 @param max_facet_values Maximum number of facet values to be returned. 1531 @param max_filter_by_candidates Controls the number of similar words that Typesense considers during fuzzy search on filter_by values. Useful for controlling prefix matches like company_name:Acm*. 1532 @param min_len_1typo Minimum word length for 1-typo correction to be applied. The value of num_typos is still treated as the maximum allowed typos. 1533 1534 @param min_len_2typo Minimum word length for 2-typo correction to be applied. The value of num_typos is still treated as the maximum allowed typos. 1535 1536 @param nl_model_id The ID of the natural language model to use. 1537 @param nl_query Whether to use natural language processing to parse the query. 1538 @param num_typos The number of typographical errors (1 or 2) that would be tolerated. Default: 2 1539 1540 @param offset Identifies the starting point to return hits from a result set. Can be used as an alternative to the page parameter. 1541 @param override_tags Comma separated list of tags to trigger the curations rules that match the tags. 1542 @param page Results from this specific page number would be fetched. 1543 @param per_page Number of results to fetch per page. Default: 10 1544 @param pinned_hits A list of records to unconditionally include in the search results at specific positions. An example use case would be to feature or promote certain items on the top of search results. A list of `record_id:hit_position`. Eg: to include a record with ID 123 at Position 1 and another record with ID 456 at Position 5, you'd specify `123:1,456:5`. 1545 You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. 1546 1547 @param pre_segmented_query You can index content from any logographic language into Typesense if you are able to segment / split the text into space-separated words yourself before indexing and querying. 1548 Set this parameter to true to do the same 1549 1550 @param prefix Boolean field to indicate that the last word in the query should be treated as a prefix, and not as a whole word. This is used for building autocomplete and instant search interfaces. Defaults to true. 1551 @param preset Search using a bunch of search parameters by setting this parameter to the name of the existing Preset. 1552 1553 @param q The query text to search for in the collection. Use * as the search string to return all documents. This is typically useful when used in conjunction with filter_by. 1554 @param query_by A list of `string` fields that should be queried against. Multiple fields are separated with a comma. 1555 @param query_by_weights The relative weight to give each `query_by` field when ranking results. This can be used to boost fields in priority, when looking for matches. Multiple fields are separated with a comma. 1556 @param remote_embedding_num_tries Number of times to retry fetching remote embeddings. 1557 1558 @param remote_embedding_timeout_ms Timeout (in milliseconds) for fetching remote embeddings. 1559 1560 @param search_cutoff_ms Typesense will attempt to return results early if the cutoff time has elapsed. This is not a strict guarantee and facet computation is not bound by this parameter. 1561 1562 @param snippet_threshold Field values under this length will be fully highlighted, instead of showing a snippet of relevant portion. Default: 30 1563 1564 @param sort_by A list of numerical fields and their corresponding sort orders that will be used for ordering your results. Up to 3 sort fields can be specified. The text similarity score is exposed as a special `_text_match` field that you can use in the list of sorting fields. If no `sort_by` parameter is specified, results are sorted by `_text_match:desc,default_sorting_field:desc` 1565 @param split_join_tokens Treat space as typo: search for q=basket ball if q=basketball is not found or vice-versa. Splitting/joining of tokens will only be attempted if the original query produces no results. To always trigger this behavior, set value to `always``. To disable, set value to `off`. Default is `fallback`. 1566 1567 @param stopwords Name of the stopwords set to apply for this search, the keywords present in the set will be removed from the search query. 1568 1569 @param synonym_num_typos Allow synonym resolution on typo-corrected words in the query. Default: 0 1570 1571 @param synonym_prefix Allow synonym resolution on word prefixes in the query. Default: false 1572 1573 @param synonym_sets List of synonym set names to associate with this search query 1574 @param text_match_type In a multi-field matching context, this parameter determines how the representative text match score of a record is calculated. Possible values are max_score (default) or max_weight. 1575 @param typo_tokens_threshold If the number of results found for a specific query is less than this number, Typesense will attempt to look for tokens with more typos until enough results are found. Default: 100 1576 1577 @param use_cache Enable server side caching of search query results. By default, caching is disabled. 1578 1579 @param vector_query Vector query expression for fetching documents "closest" to a given query/document vector. 1580 1581 @param voice_query The base64 encoded audio file in 16 khz 16-bit WAV format. 1582 1583 *) 1584 val v : ?enable_analytics:bool -> ?enable_highlight_v1:bool -> ?enable_overrides:bool -> ?enable_typos_for_numerical_tokens:bool -> ?prioritize_exact_match:bool -> ?prioritize_num_matching_fields:bool -> ?prioritize_token_position:bool -> ?cache_ttl:int -> ?conversation:bool -> ?conversation_id:string -> ?conversation_model_id:string -> ?drop_tokens_mode:DropTokensMode.T.t -> ?drop_tokens_threshold:int -> ?enable_synonyms:bool -> ?enable_typos_for_alpha_numerical_tokens:bool -> ?exclude_fields:string -> ?exhaustive_search:bool -> ?facet_by:string -> ?facet_query:string -> ?facet_return_parent:string -> ?facet_strategy:string -> ?filter_by:string -> ?filter_curated_hits:bool -> ?group_by:string -> ?group_limit:int -> ?group_missing_values:bool -> ?hidden_hits:string -> ?highlight_affix_num_tokens:int -> ?highlight_end_tag:string -> ?highlight_fields:string -> ?highlight_full_fields:string -> ?highlight_start_tag:string -> ?include_fields:string -> ?infix:string -> ?limit:int -> ?max_candidates:int -> ?max_extra_prefix:int -> ?max_extra_suffix:int -> ?max_facet_values:int -> ?max_filter_by_candidates:int -> ?min_len_1typo:int -> ?min_len_2typo:int -> ?nl_model_id:string -> ?nl_query:bool -> ?num_typos:string -> ?offset:int -> ?override_tags:string -> ?page:int -> ?per_page:int -> ?pinned_hits:string -> ?pre_segmented_query:bool -> ?prefix:string -> ?preset:string -> ?q:string -> ?query_by:string -> ?query_by_weights:string -> ?remote_embedding_num_tries:int -> ?remote_embedding_timeout_ms:int -> ?search_cutoff_ms:int -> ?snippet_threshold:int -> ?sort_by:string -> ?split_join_tokens:string -> ?stopwords:string -> ?synonym_num_typos:int -> ?synonym_prefix:bool -> ?synonym_sets:string -> ?text_match_type:string -> ?typo_tokens_threshold:int -> ?use_cache:bool -> ?vector_query:string -> ?voice_query:string -> unit -> t 1585 1586 (** The duration (in seconds) that determines how long the search query is cached. This value can be set on a per-query basis. Default: 60. 1587 *) 1588 val cache_ttl : t -> int option 1589 1590 (** Enable conversational search. 1591 *) 1592 val conversation : t -> bool option 1593 1594 (** The Id of a previous conversation to continue, this tells Typesense to include prior context when communicating with the LLM. 1595 *) 1596 val conversation_id : t -> string option 1597 1598 (** The Id of Conversation Model to be used. 1599 *) 1600 val conversation_model_id : t -> string option 1601 1602 val drop_tokens_mode : t -> DropTokensMode.T.t option 1603 1604 (** If the number of results found for a specific query is less than this number, Typesense will attempt to drop the tokens in the query until enough results are found. Tokens that have the least individual hits are dropped first. Set to 0 to disable. Default: 10 1605 *) 1606 val drop_tokens_threshold : t -> int option 1607 1608 (** Flag for enabling/disabling analytics aggregation for specific search queries (for e.g. those originating from a test script). 1609 *) 1610 val enable_analytics : t -> bool 1611 1612 (** Flag for enabling/disabling the deprecated, old highlight structure in the response. Default: true 1613 *) 1614 val enable_highlight_v1 : t -> bool 1615 1616 (** If you have some overrides defined but want to disable all of them during query time, you can do that by setting this parameter to false 1617 *) 1618 val enable_overrides : t -> bool 1619 1620 (** If you have some synonyms defined but want to disable all of them for a particular search query, set enable_synonyms to false. Default: true 1621 *) 1622 val enable_synonyms : t -> bool option 1623 1624 (** Set this parameter to false to disable typos on alphanumerical query tokens. Default: true. 1625 *) 1626 val enable_typos_for_alpha_numerical_tokens : t -> bool option 1627 1628 (** Make Typesense disable typos for numerical tokens. 1629 *) 1630 val enable_typos_for_numerical_tokens : t -> bool 1631 1632 (** List of fields from the document to exclude in the search result *) 1633 val exclude_fields : t -> string option 1634 1635 (** Setting this to true will make Typesense consider all prefixes and typo corrections of the words in the query without stopping early when enough results are found (drop_tokens_threshold and typo_tokens_threshold configurations are ignored). 1636 *) 1637 val exhaustive_search : t -> bool option 1638 1639 (** A list of fields that will be used for faceting your results on. Separate multiple fields with a comma. *) 1640 val facet_by : t -> string option 1641 1642 (** Facet values that are returned can now be filtered via this parameter. The matching facet text is also highlighted. For example, when faceting by `category`, you can set `facet_query=category:shoe` to return only facet values that contain the prefix "shoe". *) 1643 val facet_query : t -> string option 1644 1645 (** Comma separated string of nested facet fields whose parent object should be returned in facet response. 1646 *) 1647 val facet_return_parent : t -> string option 1648 1649 (** Choose the underlying faceting strategy used. Comma separated string of allows values: exhaustive, top_values or automatic (default). 1650 *) 1651 val facet_strategy : t -> string option 1652 1653 (** Filter conditions for refining your open api validator search results. Separate multiple conditions with &&. *) 1654 val filter_by : t -> string option 1655 1656 (** Whether the filter_by condition of the search query should be applicable to curated results (override definitions, pinned hits, hidden hits, etc.). Default: false 1657 *) 1658 val filter_curated_hits : t -> bool option 1659 1660 (** You can aggregate search results into groups or buckets by specify one or more `group_by` fields. Separate multiple fields with a comma. To group on a particular field, it must be a faceted field. *) 1661 val group_by : t -> string option 1662 1663 (** Maximum number of hits to be returned for every group. If the `group_limit` is set as `K` then only the top K hits in each group are returned in the response. Default: 3 1664 *) 1665 val group_limit : t -> int option 1666 1667 (** Setting this parameter to true will place all documents that have a null value in the group_by field, into a single group. Setting this parameter to false, will cause each document with a null value in the group_by field to not be grouped with other documents. Default: true 1668 *) 1669 val group_missing_values : t -> bool option 1670 1671 (** A list of records to unconditionally hide from search results. A list of `record_id`s to hide. Eg: to hide records with IDs 123 and 456, you'd specify `123,456`. 1672 You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. 1673 *) 1674 val hidden_hits : t -> string option 1675 1676 (** The number of tokens that should surround the highlighted text on each side. Default: 4 1677 *) 1678 val highlight_affix_num_tokens : t -> int option 1679 1680 (** The end tag used for the highlighted snippets. Default: `</mark>` 1681 *) 1682 val highlight_end_tag : t -> string option 1683 1684 (** A list of custom fields that must be highlighted even if you don't query for them 1685 *) 1686 val highlight_fields : t -> string option 1687 1688 (** List of fields which should be highlighted fully without snippeting *) 1689 val highlight_full_fields : t -> string option 1690 1691 (** The start tag used for the highlighted snippets. Default: `<mark>` 1692 *) 1693 val highlight_start_tag : t -> string option 1694 1695 (** List of fields from the document to include in the search result *) 1696 val include_fields : t -> string option 1697 1698 (** If infix index is enabled for this field, infix searching can be done on a per-field basis by sending a comma separated string parameter called infix to the search query. This parameter can have 3 values; `off` infix search is disabled, which is default `always` infix search is performed along with regular search `fallback` infix search is performed if regular search does not produce results *) 1699 val infix : t -> string option 1700 1701 (** Number of hits to fetch. Can be used as an alternative to the per_page parameter. Default: 10. 1702 *) 1703 val limit : t -> int option 1704 1705 (** Control the number of words that Typesense considers for typo and prefix searching. 1706 *) 1707 val max_candidates : t -> int option 1708 1709 (** There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query "K2100" has 2 extra symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match. *) 1710 val max_extra_prefix : t -> int option 1711 1712 (** There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query "K2100" has 2 extra symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match. *) 1713 val max_extra_suffix : t -> int option 1714 1715 (** Maximum number of facet values to be returned. *) 1716 val max_facet_values : t -> int option 1717 1718 (** Controls the number of similar words that Typesense considers during fuzzy search on filter_by values. Useful for controlling prefix matches like company_name:Acm*. *) 1719 val max_filter_by_candidates : t -> int option 1720 1721 (** Minimum word length for 1-typo correction to be applied. The value of num_typos is still treated as the maximum allowed typos. 1722 *) 1723 val min_len_1typo : t -> int option 1724 1725 (** Minimum word length for 2-typo correction to be applied. The value of num_typos is still treated as the maximum allowed typos. 1726 *) 1727 val min_len_2typo : t -> int option 1728 1729 (** The ID of the natural language model to use. *) 1730 val nl_model_id : t -> string option 1731 1732 (** Whether to use natural language processing to parse the query. *) 1733 val nl_query : t -> bool option 1734 1735 (** The number of typographical errors (1 or 2) that would be tolerated. Default: 2 1736 *) 1737 val num_typos : t -> string option 1738 1739 (** Identifies the starting point to return hits from a result set. Can be used as an alternative to the page parameter. *) 1740 val offset : t -> int option 1741 1742 (** Comma separated list of tags to trigger the curations rules that match the tags. *) 1743 val override_tags : t -> string option 1744 1745 (** Results from this specific page number would be fetched. *) 1746 val page : t -> int option 1747 1748 (** Number of results to fetch per page. Default: 10 *) 1749 val per_page : t -> int option 1750 1751 (** A list of records to unconditionally include in the search results at specific positions. An example use case would be to feature or promote certain items on the top of search results. A list of `record_id:hit_position`. Eg: to include a record with ID 123 at Position 1 and another record with ID 456 at Position 5, you'd specify `123:1,456:5`. 1752 You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. 1753 *) 1754 val pinned_hits : t -> string option 1755 1756 (** You can index content from any logographic language into Typesense if you are able to segment / split the text into space-separated words yourself before indexing and querying. 1757 Set this parameter to true to do the same 1758 *) 1759 val pre_segmented_query : t -> bool option 1760 1761 (** Boolean field to indicate that the last word in the query should be treated as a prefix, and not as a whole word. This is used for building autocomplete and instant search interfaces. Defaults to true. *) 1762 val prefix : t -> string option 1763 1764 (** Search using a bunch of search parameters by setting this parameter to the name of the existing Preset. 1765 *) 1766 val preset : t -> string option 1767 1768 (** Set this parameter to true to ensure that an exact match is ranked above the others 1769 *) 1770 val prioritize_exact_match : t -> bool 1771 1772 (** Make Typesense prioritize documents where the query words appear in more number of fields. 1773 *) 1774 val prioritize_num_matching_fields : t -> bool 1775 1776 (** Make Typesense prioritize documents where the query words appear earlier in the text. 1777 *) 1778 val prioritize_token_position : t -> bool 1779 1780 (** The query text to search for in the collection. Use * as the search string to return all documents. This is typically useful when used in conjunction with filter_by. *) 1781 val q : t -> string option 1782 1783 (** A list of `string` fields that should be queried against. Multiple fields are separated with a comma. *) 1784 val query_by : t -> string option 1785 1786 (** The relative weight to give each `query_by` field when ranking results. This can be used to boost fields in priority, when looking for matches. Multiple fields are separated with a comma. *) 1787 val query_by_weights : t -> string option 1788 1789 (** Number of times to retry fetching remote embeddings. 1790 *) 1791 val remote_embedding_num_tries : t -> int option 1792 1793 (** Timeout (in milliseconds) for fetching remote embeddings. 1794 *) 1795 val remote_embedding_timeout_ms : t -> int option 1796 1797 (** Typesense will attempt to return results early if the cutoff time has elapsed. This is not a strict guarantee and facet computation is not bound by this parameter. 1798 *) 1799 val search_cutoff_ms : t -> int option 1800 1801 (** Field values under this length will be fully highlighted, instead of showing a snippet of relevant portion. Default: 30 1802 *) 1803 val snippet_threshold : t -> int option 1804 1805 (** A list of numerical fields and their corresponding sort orders that will be used for ordering your results. Up to 3 sort fields can be specified. The text similarity score is exposed as a special `_text_match` field that you can use in the list of sorting fields. If no `sort_by` parameter is specified, results are sorted by `_text_match:desc,default_sorting_field:desc` *) 1806 val sort_by : t -> string option 1807 1808 (** Treat space as typo: search for q=basket ball if q=basketball is not found or vice-versa. Splitting/joining of tokens will only be attempted if the original query produces no results. To always trigger this behavior, set value to `always``. To disable, set value to `off`. Default is `fallback`. 1809 *) 1810 val split_join_tokens : t -> string option 1811 1812 (** Name of the stopwords set to apply for this search, the keywords present in the set will be removed from the search query. 1813 *) 1814 val stopwords : t -> string option 1815 1816 (** Allow synonym resolution on typo-corrected words in the query. Default: 0 1817 *) 1818 val synonym_num_typos : t -> int option 1819 1820 (** Allow synonym resolution on word prefixes in the query. Default: false 1821 *) 1822 val synonym_prefix : t -> bool option 1823 1824 (** List of synonym set names to associate with this search query *) 1825 val synonym_sets : t -> string option 1826 1827 (** In a multi-field matching context, this parameter determines how the representative text match score of a record is calculated. Possible values are max_score (default) or max_weight. *) 1828 val text_match_type : t -> string option 1829 1830 (** If the number of results found for a specific query is less than this number, Typesense will attempt to look for tokens with more typos until enough results are found. Default: 100 1831 *) 1832 val typo_tokens_threshold : t -> int option 1833 1834 (** Enable server side caching of search query results. By default, caching is disabled. 1835 *) 1836 val use_cache : t -> bool option 1837 1838 (** Vector query expression for fetching documents "closest" to a given query/document vector. 1839 *) 1840 val vector_query : t -> string option 1841 1842 (** The base64 encoded audio file in 16 khz 16-bit WAV format. 1843 *) 1844 val voice_query : t -> string option 1845 1846 val jsont : t Jsont.t 1847 end 1848end 1849 1850module MultiSearchParameters : sig 1851 module T : sig 1852 (** Parameters for the multi search API. 1853 *) 1854 type t 1855 1856 (** Construct a value 1857 @param enable_analytics Flag for enabling/disabling analytics aggregation for specific search queries (for e.g. those originating from a test script). 1858 1859 @param enable_overrides If you have some overrides defined but want to disable all of them during query time, you can do that by setting this parameter to false 1860 1861 @param enable_typos_for_numerical_tokens Make Typesense disable typos for numerical tokens. 1862 1863 @param pre_segmented_query You can index content from any logographic language into Typesense if you are able to segment / split the text into space-separated words yourself before indexing and querying. 1864 Set this parameter to true to do the same 1865 1866 @param prioritize_exact_match Set this parameter to true to ensure that an exact match is ranked above the others 1867 1868 @param prioritize_num_matching_fields Make Typesense prioritize documents where the query words appear in more number of fields. 1869 1870 @param prioritize_token_position Make Typesense prioritize documents where the query words appear earlier in the text. 1871 1872 @param cache_ttl The duration (in seconds) that determines how long the search query is cached. This value can be set on a per-query basis. Default: 60. 1873 1874 @param conversation Enable conversational search. 1875 1876 @param conversation_id The Id of a previous conversation to continue, this tells Typesense to include prior context when communicating with the LLM. 1877 1878 @param conversation_model_id The Id of Conversation Model to be used. 1879 1880 @param drop_tokens_threshold If the number of results found for a specific query is less than this number, Typesense will attempt to drop the tokens in the query until enough results are found. Tokens that have the least individual hits are dropped first. Set to 0 to disable. Default: 10 1881 1882 @param enable_synonyms If you have some synonyms defined but want to disable all of them for a particular search query, set enable_synonyms to false. Default: true 1883 1884 @param enable_typos_for_alpha_numerical_tokens Set this parameter to false to disable typos on alphanumerical query tokens. Default: true. 1885 1886 @param exclude_fields List of fields from the document to exclude in the search result 1887 @param exhaustive_search Setting this to true will make Typesense consider all prefixes and typo corrections of the words in the query without stopping early when enough results are found (drop_tokens_threshold and typo_tokens_threshold configurations are ignored). 1888 1889 @param facet_by A list of fields that will be used for faceting your results on. Separate multiple fields with a comma. 1890 @param facet_query Facet values that are returned can now be filtered via this parameter. The matching facet text is also highlighted. For example, when faceting by `category`, you can set `facet_query=category:shoe` to return only facet values that contain the prefix "shoe". 1891 @param facet_return_parent Comma separated string of nested facet fields whose parent object should be returned in facet response. 1892 1893 @param facet_strategy Choose the underlying faceting strategy used. Comma separated string of allows values: exhaustive, top_values or automatic (default). 1894 1895 @param filter_by Filter conditions for refining youropen api validator search results. Separate multiple conditions with &&. 1896 @param filter_curated_hits Whether the filter_by condition of the search query should be applicable to curated results (override definitions, pinned hits, hidden hits, etc.). Default: false 1897 1898 @param group_by You can aggregate search results into groups or buckets by specify one or more `group_by` fields. Separate multiple fields with a comma. To group on a particular field, it must be a faceted field. 1899 @param group_limit Maximum number of hits to be returned for every group. If the `group_limit` is set as `K` then only the top K hits in each group are returned in the response. Default: 3 1900 1901 @param group_missing_values Setting this parameter to true will place all documents that have a null value in the group_by field, into a single group. Setting this parameter to false, will cause each document with a null value in the group_by field to not be grouped with other documents. Default: true 1902 1903 @param hidden_hits A list of records to unconditionally hide from search results. A list of `record_id`s to hide. Eg: to hide records with IDs 123 and 456, you'd specify `123,456`. 1904 You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. 1905 1906 @param highlight_affix_num_tokens The number of tokens that should surround the highlighted text on each side. Default: 4 1907 1908 @param highlight_end_tag The end tag used for the highlighted snippets. Default: `</mark>` 1909 1910 @param highlight_fields A list of custom fields that must be highlighted even if you don't query for them 1911 1912 @param highlight_full_fields List of fields which should be highlighted fully without snippeting 1913 @param highlight_start_tag The start tag used for the highlighted snippets. Default: `<mark>` 1914 1915 @param include_fields List of fields from the document to include in the search result 1916 @param infix If infix index is enabled for this field, infix searching can be done on a per-field basis by sending a comma separated string parameter called infix to the search query. This parameter can have 3 values; `off` infix search is disabled, which is default `always` infix search is performed along with regular search `fallback` infix search is performed if regular search does not produce results 1917 @param limit Number of hits to fetch. Can be used as an alternative to the per_page parameter. Default: 10. 1918 1919 @param max_extra_prefix There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query "K2100" has 2 extra symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match. 1920 @param max_extra_suffix There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query "K2100" has 2 extra symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match. 1921 @param max_facet_values Maximum number of facet values to be returned. 1922 @param min_len_1typo Minimum word length for 1-typo correction to be applied. The value of num_typos is still treated as the maximum allowed typos. 1923 1924 @param min_len_2typo Minimum word length for 2-typo correction to be applied. The value of num_typos is still treated as the maximum allowed typos. 1925 1926 @param num_typos The number of typographical errors (1 or 2) that would be tolerated. Default: 2 1927 1928 @param offset Identifies the starting point to return hits from a result set. Can be used as an alternative to the page parameter. 1929 @param override_tags Comma separated list of tags to trigger the curations rules that match the tags. 1930 @param page Results from this specific page number would be fetched. 1931 @param per_page Number of results to fetch per page. Default: 10 1932 @param pinned_hits A list of records to unconditionally include in the search results at specific positions. An example use case would be to feature or promote certain items on the top of search results. A list of `record_id:hit_position`. Eg: to include a record with ID 123 at Position 1 and another record with ID 456 at Position 5, you'd specify `123:1,456:5`. 1933 You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. 1934 1935 @param prefix Boolean field to indicate that the last word in the query should be treated as a prefix, and not as a whole word. This is used for building autocomplete and instant search interfaces. Defaults to true. 1936 @param preset Search using a bunch of search parameters by setting this parameter to the name of the existing Preset. 1937 1938 @param q The query text to search for in the collection. Use * as the search string to return all documents. This is typically useful when used in conjunction with filter_by. 1939 @param query_by A list of `string` fields that should be queried against. Multiple fields are separated with a comma. 1940 @param query_by_weights The relative weight to give each `query_by` field when ranking results. This can be used to boost fields in priority, when looking for matches. Multiple fields are separated with a comma. 1941 @param remote_embedding_num_tries Number of times to retry fetching remote embeddings. 1942 1943 @param remote_embedding_timeout_ms Timeout (in milliseconds) for fetching remote embeddings. 1944 1945 @param search_cutoff_ms Typesense will attempt to return results early if the cutoff time has elapsed. This is not a strict guarantee and facet computation is not bound by this parameter. 1946 1947 @param snippet_threshold Field values under this length will be fully highlighted, instead of showing a snippet of relevant portion. Default: 30 1948 1949 @param sort_by A list of numerical fields and their corresponding sort orders that will be used for ordering your results. Up to 3 sort fields can be specified. The text similarity score is exposed as a special `_text_match` field that you can use in the list of sorting fields. If no `sort_by` parameter is specified, results are sorted by `_text_match:desc,default_sorting_field:desc` 1950 @param stopwords Name of the stopwords set to apply for this search, the keywords present in the set will be removed from the search query. 1951 1952 @param synonym_num_typos Allow synonym resolution on typo-corrected words in the query. Default: 0 1953 1954 @param synonym_prefix Allow synonym resolution on word prefixes in the query. Default: false 1955 1956 @param text_match_type In a multi-field matching context, this parameter determines how the representative text match score of a record is calculated. Possible values are max_score (default) or max_weight. 1957 @param typo_tokens_threshold If the number of results found for a specific query is less than this number, Typesense will attempt to look for tokens with more typos until enough results are found. Default: 100 1958 1959 @param use_cache Enable server side caching of search query results. By default, caching is disabled. 1960 1961 @param vector_query Vector query expression for fetching documents "closest" to a given query/document vector. 1962 1963 @param voice_query The base64 encoded audio file in 16 khz 16-bit WAV format. 1964 1965 *) 1966 val v : ?enable_analytics:bool -> ?enable_overrides:bool -> ?enable_typos_for_numerical_tokens:bool -> ?pre_segmented_query:bool -> ?prioritize_exact_match:bool -> ?prioritize_num_matching_fields:bool -> ?prioritize_token_position:bool -> ?cache_ttl:int -> ?conversation:bool -> ?conversation_id:string -> ?conversation_model_id:string -> ?drop_tokens_mode:DropTokensMode.T.t -> ?drop_tokens_threshold:int -> ?enable_synonyms:bool -> ?enable_typos_for_alpha_numerical_tokens:bool -> ?exclude_fields:string -> ?exhaustive_search:bool -> ?facet_by:string -> ?facet_query:string -> ?facet_return_parent:string -> ?facet_strategy:string -> ?filter_by:string -> ?filter_curated_hits:bool -> ?group_by:string -> ?group_limit:int -> ?group_missing_values:bool -> ?hidden_hits:string -> ?highlight_affix_num_tokens:int -> ?highlight_end_tag:string -> ?highlight_fields:string -> ?highlight_full_fields:string -> ?highlight_start_tag:string -> ?include_fields:string -> ?infix:string -> ?limit:int -> ?max_extra_prefix:int -> ?max_extra_suffix:int -> ?max_facet_values:int -> ?min_len_1typo:int -> ?min_len_2typo:int -> ?num_typos:string -> ?offset:int -> ?override_tags:string -> ?page:int -> ?per_page:int -> ?pinned_hits:string -> ?prefix:string -> ?preset:string -> ?q:string -> ?query_by:string -> ?query_by_weights:string -> ?remote_embedding_num_tries:int -> ?remote_embedding_timeout_ms:int -> ?search_cutoff_ms:int -> ?snippet_threshold:int -> ?sort_by:string -> ?stopwords:string -> ?synonym_num_typos:int -> ?synonym_prefix:bool -> ?text_match_type:string -> ?typo_tokens_threshold:int -> ?use_cache:bool -> ?vector_query:string -> ?voice_query:string -> unit -> t 1967 1968 (** The duration (in seconds) that determines how long the search query is cached. This value can be set on a per-query basis. Default: 60. 1969 *) 1970 val cache_ttl : t -> int option 1971 1972 (** Enable conversational search. 1973 *) 1974 val conversation : t -> bool option 1975 1976 (** The Id of a previous conversation to continue, this tells Typesense to include prior context when communicating with the LLM. 1977 *) 1978 val conversation_id : t -> string option 1979 1980 (** The Id of Conversation Model to be used. 1981 *) 1982 val conversation_model_id : t -> string option 1983 1984 val drop_tokens_mode : t -> DropTokensMode.T.t option 1985 1986 (** If the number of results found for a specific query is less than this number, Typesense will attempt to drop the tokens in the query until enough results are found. Tokens that have the least individual hits are dropped first. Set to 0 to disable. Default: 10 1987 *) 1988 val drop_tokens_threshold : t -> int option 1989 1990 (** Flag for enabling/disabling analytics aggregation for specific search queries (for e.g. those originating from a test script). 1991 *) 1992 val enable_analytics : t -> bool 1993 1994 (** If you have some overrides defined but want to disable all of them during query time, you can do that by setting this parameter to false 1995 *) 1996 val enable_overrides : t -> bool 1997 1998 (** If you have some synonyms defined but want to disable all of them for a particular search query, set enable_synonyms to false. Default: true 1999 *) 2000 val enable_synonyms : t -> bool option 2001 2002 (** Set this parameter to false to disable typos on alphanumerical query tokens. Default: true. 2003 *) 2004 val enable_typos_for_alpha_numerical_tokens : t -> bool option 2005 2006 (** Make Typesense disable typos for numerical tokens. 2007 *) 2008 val enable_typos_for_numerical_tokens : t -> bool 2009 2010 (** List of fields from the document to exclude in the search result *) 2011 val exclude_fields : t -> string option 2012 2013 (** Setting this to true will make Typesense consider all prefixes and typo corrections of the words in the query without stopping early when enough results are found (drop_tokens_threshold and typo_tokens_threshold configurations are ignored). 2014 *) 2015 val exhaustive_search : t -> bool option 2016 2017 (** A list of fields that will be used for faceting your results on. Separate multiple fields with a comma. *) 2018 val facet_by : t -> string option 2019 2020 (** Facet values that are returned can now be filtered via this parameter. The matching facet text is also highlighted. For example, when faceting by `category`, you can set `facet_query=category:shoe` to return only facet values that contain the prefix "shoe". *) 2021 val facet_query : t -> string option 2022 2023 (** Comma separated string of nested facet fields whose parent object should be returned in facet response. 2024 *) 2025 val facet_return_parent : t -> string option 2026 2027 (** Choose the underlying faceting strategy used. Comma separated string of allows values: exhaustive, top_values or automatic (default). 2028 *) 2029 val facet_strategy : t -> string option 2030 2031 (** Filter conditions for refining youropen api validator search results. Separate multiple conditions with &&. *) 2032 val filter_by : t -> string option 2033 2034 (** Whether the filter_by condition of the search query should be applicable to curated results (override definitions, pinned hits, hidden hits, etc.). Default: false 2035 *) 2036 val filter_curated_hits : t -> bool option 2037 2038 (** You can aggregate search results into groups or buckets by specify one or more `group_by` fields. Separate multiple fields with a comma. To group on a particular field, it must be a faceted field. *) 2039 val group_by : t -> string option 2040 2041 (** Maximum number of hits to be returned for every group. If the `group_limit` is set as `K` then only the top K hits in each group are returned in the response. Default: 3 2042 *) 2043 val group_limit : t -> int option 2044 2045 (** Setting this parameter to true will place all documents that have a null value in the group_by field, into a single group. Setting this parameter to false, will cause each document with a null value in the group_by field to not be grouped with other documents. Default: true 2046 *) 2047 val group_missing_values : t -> bool option 2048 2049 (** A list of records to unconditionally hide from search results. A list of `record_id`s to hide. Eg: to hide records with IDs 123 and 456, you'd specify `123,456`. 2050 You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. 2051 *) 2052 val hidden_hits : t -> string option 2053 2054 (** The number of tokens that should surround the highlighted text on each side. Default: 4 2055 *) 2056 val highlight_affix_num_tokens : t -> int option 2057 2058 (** The end tag used for the highlighted snippets. Default: `</mark>` 2059 *) 2060 val highlight_end_tag : t -> string option 2061 2062 (** A list of custom fields that must be highlighted even if you don't query for them 2063 *) 2064 val highlight_fields : t -> string option 2065 2066 (** List of fields which should be highlighted fully without snippeting *) 2067 val highlight_full_fields : t -> string option 2068 2069 (** The start tag used for the highlighted snippets. Default: `<mark>` 2070 *) 2071 val highlight_start_tag : t -> string option 2072 2073 (** List of fields from the document to include in the search result *) 2074 val include_fields : t -> string option 2075 2076 (** If infix index is enabled for this field, infix searching can be done on a per-field basis by sending a comma separated string parameter called infix to the search query. This parameter can have 3 values; `off` infix search is disabled, which is default `always` infix search is performed along with regular search `fallback` infix search is performed if regular search does not produce results *) 2077 val infix : t -> string option 2078 2079 (** Number of hits to fetch. Can be used as an alternative to the per_page parameter. Default: 10. 2080 *) 2081 val limit : t -> int option 2082 2083 (** There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query "K2100" has 2 extra symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match. *) 2084 val max_extra_prefix : t -> int option 2085 2086 (** There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query "K2100" has 2 extra symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match. *) 2087 val max_extra_suffix : t -> int option 2088 2089 (** Maximum number of facet values to be returned. *) 2090 val max_facet_values : t -> int option 2091 2092 (** Minimum word length for 1-typo correction to be applied. The value of num_typos is still treated as the maximum allowed typos. 2093 *) 2094 val min_len_1typo : t -> int option 2095 2096 (** Minimum word length for 2-typo correction to be applied. The value of num_typos is still treated as the maximum allowed typos. 2097 *) 2098 val min_len_2typo : t -> int option 2099 2100 (** The number of typographical errors (1 or 2) that would be tolerated. Default: 2 2101 *) 2102 val num_typos : t -> string option 2103 2104 (** Identifies the starting point to return hits from a result set. Can be used as an alternative to the page parameter. *) 2105 val offset : t -> int option 2106 2107 (** Comma separated list of tags to trigger the curations rules that match the tags. *) 2108 val override_tags : t -> string option 2109 2110 (** Results from this specific page number would be fetched. *) 2111 val page : t -> int option 2112 2113 (** Number of results to fetch per page. Default: 10 *) 2114 val per_page : t -> int option 2115 2116 (** A list of records to unconditionally include in the search results at specific positions. An example use case would be to feature or promote certain items on the top of search results. A list of `record_id:hit_position`. Eg: to include a record with ID 123 at Position 1 and another record with ID 456 at Position 5, you'd specify `123:1,456:5`. 2117 You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. 2118 *) 2119 val pinned_hits : t -> string option 2120 2121 (** You can index content from any logographic language into Typesense if you are able to segment / split the text into space-separated words yourself before indexing and querying. 2122 Set this parameter to true to do the same 2123 *) 2124 val pre_segmented_query : t -> bool 2125 2126 (** Boolean field to indicate that the last word in the query should be treated as a prefix, and not as a whole word. This is used for building autocomplete and instant search interfaces. Defaults to true. *) 2127 val prefix : t -> string option 2128 2129 (** Search using a bunch of search parameters by setting this parameter to the name of the existing Preset. 2130 *) 2131 val preset : t -> string option 2132 2133 (** Set this parameter to true to ensure that an exact match is ranked above the others 2134 *) 2135 val prioritize_exact_match : t -> bool 2136 2137 (** Make Typesense prioritize documents where the query words appear in more number of fields. 2138 *) 2139 val prioritize_num_matching_fields : t -> bool 2140 2141 (** Make Typesense prioritize documents where the query words appear earlier in the text. 2142 *) 2143 val prioritize_token_position : t -> bool 2144 2145 (** The query text to search for in the collection. Use * as the search string to return all documents. This is typically useful when used in conjunction with filter_by. *) 2146 val q : t -> string option 2147 2148 (** A list of `string` fields that should be queried against. Multiple fields are separated with a comma. *) 2149 val query_by : t -> string option 2150 2151 (** The relative weight to give each `query_by` field when ranking results. This can be used to boost fields in priority, when looking for matches. Multiple fields are separated with a comma. *) 2152 val query_by_weights : t -> string option 2153 2154 (** Number of times to retry fetching remote embeddings. 2155 *) 2156 val remote_embedding_num_tries : t -> int option 2157 2158 (** Timeout (in milliseconds) for fetching remote embeddings. 2159 *) 2160 val remote_embedding_timeout_ms : t -> int option 2161 2162 (** Typesense will attempt to return results early if the cutoff time has elapsed. This is not a strict guarantee and facet computation is not bound by this parameter. 2163 *) 2164 val search_cutoff_ms : t -> int option 2165 2166 (** Field values under this length will be fully highlighted, instead of showing a snippet of relevant portion. Default: 30 2167 *) 2168 val snippet_threshold : t -> int option 2169 2170 (** A list of numerical fields and their corresponding sort orders that will be used for ordering your results. Up to 3 sort fields can be specified. The text similarity score is exposed as a special `_text_match` field that you can use in the list of sorting fields. If no `sort_by` parameter is specified, results are sorted by `_text_match:desc,default_sorting_field:desc` *) 2171 val sort_by : t -> string option 2172 2173 (** Name of the stopwords set to apply for this search, the keywords present in the set will be removed from the search query. 2174 *) 2175 val stopwords : t -> string option 2176 2177 (** Allow synonym resolution on typo-corrected words in the query. Default: 0 2178 *) 2179 val synonym_num_typos : t -> int option 2180 2181 (** Allow synonym resolution on word prefixes in the query. Default: false 2182 *) 2183 val synonym_prefix : t -> bool option 2184 2185 (** In a multi-field matching context, this parameter determines how the representative text match score of a record is calculated. Possible values are max_score (default) or max_weight. *) 2186 val text_match_type : t -> string option 2187 2188 (** If the number of results found for a specific query is less than this number, Typesense will attempt to look for tokens with more typos until enough results are found. Default: 100 2189 *) 2190 val typo_tokens_threshold : t -> int option 2191 2192 (** Enable server side caching of search query results. By default, caching is disabled. 2193 *) 2194 val use_cache : t -> bool option 2195 2196 (** Vector query expression for fetching documents "closest" to a given query/document vector. 2197 *) 2198 val vector_query : t -> string option 2199 2200 (** The base64 encoded audio file in 16 khz 16-bit WAV format. 2201 *) 2202 val voice_query : t -> string option 2203 2204 val jsont : t Jsont.t 2205 end 2206end 2207 2208module MultiSearchCollectionParameters : sig 2209 module T : sig 2210 type t 2211 2212 (** Construct a value 2213 @param enable_analytics Flag for enabling/disabling analytics aggregation for specific search queries (for e.g. those originating from a test script). 2214 2215 @param enable_overrides If you have some overrides defined but want to disable all of them during query time, you can do that by setting this parameter to false 2216 2217 @param enable_typos_for_numerical_tokens Make Typesense disable typos for numerical tokens. 2218 2219 @param pre_segmented_query You can index content from any logographic language into Typesense if you are able to segment / split the text into space-separated words yourself before indexing and querying. 2220 Set this parameter to true to do the same 2221 2222 @param prioritize_exact_match Set this parameter to true to ensure that an exact match is ranked above the others 2223 2224 @param prioritize_num_matching_fields Make Typesense prioritize documents where the query words appear in more number of fields. 2225 2226 @param prioritize_token_position Make Typesense prioritize documents where the query words appear earlier in the text. 2227 2228 @param rerank_hybrid_matches When true, computes both text match and vector distance scores for all matches in hybrid search. Documents found only through keyword search will get a vector distance score, and documents found only through vector search will get a text match score. 2229 2230 @param cache_ttl The duration (in seconds) that determines how long the search query is cached. This value can be set on a per-query basis. Default: 60. 2231 2232 @param conversation Enable conversational search. 2233 2234 @param conversation_id The Id of a previous conversation to continue, this tells Typesense to include prior context when communicating with the LLM. 2235 2236 @param conversation_model_id The Id of Conversation Model to be used. 2237 2238 @param drop_tokens_threshold If the number of results found for a specific query is less than this number, Typesense will attempt to drop the tokens in the query until enough results are found. Tokens that have the least individual hits are dropped first. Set to 0 to disable. Default: 10 2239 2240 @param enable_synonyms If you have some synonyms defined but want to disable all of them for a particular search query, set enable_synonyms to false. Default: true 2241 2242 @param enable_typos_for_alpha_numerical_tokens Set this parameter to false to disable typos on alphanumerical query tokens. Default: true. 2243 2244 @param exclude_fields List of fields from the document to exclude in the search result 2245 @param exhaustive_search Setting this to true will make Typesense consider all prefixes and typo corrections of the words in the query without stopping early when enough results are found (drop_tokens_threshold and typo_tokens_threshold configurations are ignored). 2246 2247 @param facet_by A list of fields that will be used for faceting your results on. Separate multiple fields with a comma. 2248 @param facet_query Facet values that are returned can now be filtered via this parameter. The matching facet text is also highlighted. For example, when faceting by `category`, you can set `facet_query=category:shoe` to return only facet values that contain the prefix "shoe". 2249 @param facet_return_parent Comma separated string of nested facet fields whose parent object should be returned in facet response. 2250 2251 @param facet_strategy Choose the underlying faceting strategy used. Comma separated string of allows values: exhaustive, top_values or automatic (default). 2252 2253 @param filter_by Filter conditions for refining youropen api validator search results. Separate multiple conditions with &&. 2254 @param filter_curated_hits Whether the filter_by condition of the search query should be applicable to curated results (override definitions, pinned hits, hidden hits, etc.). Default: false 2255 2256 @param group_by You can aggregate search results into groups or buckets by specify one or more `group_by` fields. Separate multiple fields with a comma. To group on a particular field, it must be a faceted field. 2257 @param group_limit Maximum number of hits to be returned for every group. If the `group_limit` is set as `K` then only the top K hits in each group are returned in the response. Default: 3 2258 2259 @param group_missing_values Setting this parameter to true will place all documents that have a null value in the group_by field, into a single group. Setting this parameter to false, will cause each document with a null value in the group_by field to not be grouped with other documents. Default: true 2260 2261 @param hidden_hits A list of records to unconditionally hide from search results. A list of `record_id`s to hide. Eg: to hide records with IDs 123 and 456, you'd specify `123,456`. 2262 You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. 2263 2264 @param highlight_affix_num_tokens The number of tokens that should surround the highlighted text on each side. Default: 4 2265 2266 @param highlight_end_tag The end tag used for the highlighted snippets. Default: `</mark>` 2267 2268 @param highlight_fields A list of custom fields that must be highlighted even if you don't query for them 2269 2270 @param highlight_full_fields List of fields which should be highlighted fully without snippeting 2271 @param highlight_start_tag The start tag used for the highlighted snippets. Default: `<mark>` 2272 2273 @param include_fields List of fields from the document to include in the search result 2274 @param infix If infix index is enabled for this field, infix searching can be done on a per-field basis by sending a comma separated string parameter called infix to the search query. This parameter can have 3 values; `off` infix search is disabled, which is default `always` infix search is performed along with regular search `fallback` infix search is performed if regular search does not produce results 2275 @param limit Number of hits to fetch. Can be used as an alternative to the per_page parameter. Default: 10. 2276 2277 @param max_extra_prefix There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query "K2100" has 2 extra symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match. 2278 @param max_extra_suffix There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query "K2100" has 2 extra symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match. 2279 @param max_facet_values Maximum number of facet values to be returned. 2280 @param min_len_1typo Minimum word length for 1-typo correction to be applied. The value of num_typos is still treated as the maximum allowed typos. 2281 2282 @param min_len_2typo Minimum word length for 2-typo correction to be applied. The value of num_typos is still treated as the maximum allowed typos. 2283 2284 @param num_typos The number of typographical errors (1 or 2) that would be tolerated. Default: 2 2285 2286 @param offset Identifies the starting point to return hits from a result set. Can be used as an alternative to the page parameter. 2287 @param override_tags Comma separated list of tags to trigger the curations rules that match the tags. 2288 @param page Results from this specific page number would be fetched. 2289 @param per_page Number of results to fetch per page. Default: 10 2290 @param pinned_hits A list of records to unconditionally include in the search results at specific positions. An example use case would be to feature or promote certain items on the top of search results. A list of `record_id:hit_position`. Eg: to include a record with ID 123 at Position 1 and another record with ID 456 at Position 5, you'd specify `123:1,456:5`. 2291 You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. 2292 2293 @param prefix Boolean field to indicate that the last word in the query should be treated as a prefix, and not as a whole word. This is used for building autocomplete and instant search interfaces. Defaults to true. 2294 @param preset Search using a bunch of search parameters by setting this parameter to the name of the existing Preset. 2295 2296 @param q The query text to search for in the collection. Use * as the search string to return all documents. This is typically useful when used in conjunction with filter_by. 2297 @param query_by A list of `string` fields that should be queried against. Multiple fields are separated with a comma. 2298 @param query_by_weights The relative weight to give each `query_by` field when ranking results. This can be used to boost fields in priority, when looking for matches. Multiple fields are separated with a comma. 2299 @param remote_embedding_num_tries Number of times to retry fetching remote embeddings. 2300 2301 @param remote_embedding_timeout_ms Timeout (in milliseconds) for fetching remote embeddings. 2302 2303 @param search_cutoff_ms Typesense will attempt to return results early if the cutoff time has elapsed. This is not a strict guarantee and facet computation is not bound by this parameter. 2304 2305 @param snippet_threshold Field values under this length will be fully highlighted, instead of showing a snippet of relevant portion. Default: 30 2306 2307 @param sort_by A list of numerical fields and their corresponding sort orders that will be used for ordering your results. Up to 3 sort fields can be specified. The text similarity score is exposed as a special `_text_match` field that you can use in the list of sorting fields. If no `sort_by` parameter is specified, results are sorted by `_text_match:desc,default_sorting_field:desc` 2308 @param stopwords Name of the stopwords set to apply for this search, the keywords present in the set will be removed from the search query. 2309 2310 @param synonym_num_typos Allow synonym resolution on typo-corrected words in the query. Default: 0 2311 2312 @param synonym_prefix Allow synonym resolution on word prefixes in the query. Default: false 2313 2314 @param text_match_type In a multi-field matching context, this parameter determines how the representative text match score of a record is calculated. Possible values are max_score (default) or max_weight. 2315 @param typo_tokens_threshold If the number of results found for a specific query is less than this number, Typesense will attempt to look for tokens with more typos until enough results are found. Default: 100 2316 2317 @param use_cache Enable server side caching of search query results. By default, caching is disabled. 2318 2319 @param vector_query Vector query expression for fetching documents "closest" to a given query/document vector. 2320 2321 @param voice_query The base64 encoded audio file in 16 khz 16-bit WAV format. 2322 2323 @param collection The collection to search in. 2324 2325 @param x_typesense_api_key A separate search API key for each search within a multi_search request 2326 *) 2327 val v : ?enable_analytics:bool -> ?enable_overrides:bool -> ?enable_typos_for_numerical_tokens:bool -> ?pre_segmented_query:bool -> ?prioritize_exact_match:bool -> ?prioritize_num_matching_fields:bool -> ?prioritize_token_position:bool -> ?rerank_hybrid_matches:bool -> ?cache_ttl:int -> ?conversation:bool -> ?conversation_id:string -> ?conversation_model_id:string -> ?drop_tokens_mode:DropTokensMode.T.t -> ?drop_tokens_threshold:int -> ?enable_synonyms:bool -> ?enable_typos_for_alpha_numerical_tokens:bool -> ?exclude_fields:string -> ?exhaustive_search:bool -> ?facet_by:string -> ?facet_query:string -> ?facet_return_parent:string -> ?facet_strategy:string -> ?filter_by:string -> ?filter_curated_hits:bool -> ?group_by:string -> ?group_limit:int -> ?group_missing_values:bool -> ?hidden_hits:string -> ?highlight_affix_num_tokens:int -> ?highlight_end_tag:string -> ?highlight_fields:string -> ?highlight_full_fields:string -> ?highlight_start_tag:string -> ?include_fields:string -> ?infix:string -> ?limit:int -> ?max_extra_prefix:int -> ?max_extra_suffix:int -> ?max_facet_values:int -> ?min_len_1typo:int -> ?min_len_2typo:int -> ?num_typos:string -> ?offset:int -> ?override_tags:string -> ?page:int -> ?per_page:int -> ?pinned_hits:string -> ?prefix:string -> ?preset:string -> ?q:string -> ?query_by:string -> ?query_by_weights:string -> ?remote_embedding_num_tries:int -> ?remote_embedding_timeout_ms:int -> ?search_cutoff_ms:int -> ?snippet_threshold:int -> ?sort_by:string -> ?stopwords:string -> ?synonym_num_typos:int -> ?synonym_prefix:bool -> ?text_match_type:string -> ?typo_tokens_threshold:int -> ?use_cache:bool -> ?vector_query:string -> ?voice_query:string -> ?collection:string -> ?x_typesense_api_key:string -> unit -> t 2328 2329 (** The duration (in seconds) that determines how long the search query is cached. This value can be set on a per-query basis. Default: 60. 2330 *) 2331 val cache_ttl : t -> int option 2332 2333 (** Enable conversational search. 2334 *) 2335 val conversation : t -> bool option 2336 2337 (** The Id of a previous conversation to continue, this tells Typesense to include prior context when communicating with the LLM. 2338 *) 2339 val conversation_id : t -> string option 2340 2341 (** The Id of Conversation Model to be used. 2342 *) 2343 val conversation_model_id : t -> string option 2344 2345 val drop_tokens_mode : t -> DropTokensMode.T.t option 2346 2347 (** If the number of results found for a specific query is less than this number, Typesense will attempt to drop the tokens in the query until enough results are found. Tokens that have the least individual hits are dropped first. Set to 0 to disable. Default: 10 2348 *) 2349 val drop_tokens_threshold : t -> int option 2350 2351 (** Flag for enabling/disabling analytics aggregation for specific search queries (for e.g. those originating from a test script). 2352 *) 2353 val enable_analytics : t -> bool 2354 2355 (** If you have some overrides defined but want to disable all of them during query time, you can do that by setting this parameter to false 2356 *) 2357 val enable_overrides : t -> bool 2358 2359 (** If you have some synonyms defined but want to disable all of them for a particular search query, set enable_synonyms to false. Default: true 2360 *) 2361 val enable_synonyms : t -> bool option 2362 2363 (** Set this parameter to false to disable typos on alphanumerical query tokens. Default: true. 2364 *) 2365 val enable_typos_for_alpha_numerical_tokens : t -> bool option 2366 2367 (** Make Typesense disable typos for numerical tokens. 2368 *) 2369 val enable_typos_for_numerical_tokens : t -> bool 2370 2371 (** List of fields from the document to exclude in the search result *) 2372 val exclude_fields : t -> string option 2373 2374 (** Setting this to true will make Typesense consider all prefixes and typo corrections of the words in the query without stopping early when enough results are found (drop_tokens_threshold and typo_tokens_threshold configurations are ignored). 2375 *) 2376 val exhaustive_search : t -> bool option 2377 2378 (** A list of fields that will be used for faceting your results on. Separate multiple fields with a comma. *) 2379 val facet_by : t -> string option 2380 2381 (** Facet values that are returned can now be filtered via this parameter. The matching facet text is also highlighted. For example, when faceting by `category`, you can set `facet_query=category:shoe` to return only facet values that contain the prefix "shoe". *) 2382 val facet_query : t -> string option 2383 2384 (** Comma separated string of nested facet fields whose parent object should be returned in facet response. 2385 *) 2386 val facet_return_parent : t -> string option 2387 2388 (** Choose the underlying faceting strategy used. Comma separated string of allows values: exhaustive, top_values or automatic (default). 2389 *) 2390 val facet_strategy : t -> string option 2391 2392 (** Filter conditions for refining youropen api validator search results. Separate multiple conditions with &&. *) 2393 val filter_by : t -> string option 2394 2395 (** Whether the filter_by condition of the search query should be applicable to curated results (override definitions, pinned hits, hidden hits, etc.). Default: false 2396 *) 2397 val filter_curated_hits : t -> bool option 2398 2399 (** You can aggregate search results into groups or buckets by specify one or more `group_by` fields. Separate multiple fields with a comma. To group on a particular field, it must be a faceted field. *) 2400 val group_by : t -> string option 2401 2402 (** Maximum number of hits to be returned for every group. If the `group_limit` is set as `K` then only the top K hits in each group are returned in the response. Default: 3 2403 *) 2404 val group_limit : t -> int option 2405 2406 (** Setting this parameter to true will place all documents that have a null value in the group_by field, into a single group. Setting this parameter to false, will cause each document with a null value in the group_by field to not be grouped with other documents. Default: true 2407 *) 2408 val group_missing_values : t -> bool option 2409 2410 (** A list of records to unconditionally hide from search results. A list of `record_id`s to hide. Eg: to hide records with IDs 123 and 456, you'd specify `123,456`. 2411 You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. 2412 *) 2413 val hidden_hits : t -> string option 2414 2415 (** The number of tokens that should surround the highlighted text on each side. Default: 4 2416 *) 2417 val highlight_affix_num_tokens : t -> int option 2418 2419 (** The end tag used for the highlighted snippets. Default: `</mark>` 2420 *) 2421 val highlight_end_tag : t -> string option 2422 2423 (** A list of custom fields that must be highlighted even if you don't query for them 2424 *) 2425 val highlight_fields : t -> string option 2426 2427 (** List of fields which should be highlighted fully without snippeting *) 2428 val highlight_full_fields : t -> string option 2429 2430 (** The start tag used for the highlighted snippets. Default: `<mark>` 2431 *) 2432 val highlight_start_tag : t -> string option 2433 2434 (** List of fields from the document to include in the search result *) 2435 val include_fields : t -> string option 2436 2437 (** If infix index is enabled for this field, infix searching can be done on a per-field basis by sending a comma separated string parameter called infix to the search query. This parameter can have 3 values; `off` infix search is disabled, which is default `always` infix search is performed along with regular search `fallback` infix search is performed if regular search does not produce results *) 2438 val infix : t -> string option 2439 2440 (** Number of hits to fetch. Can be used as an alternative to the per_page parameter. Default: 10. 2441 *) 2442 val limit : t -> int option 2443 2444 (** There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query "K2100" has 2 extra symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match. *) 2445 val max_extra_prefix : t -> int option 2446 2447 (** There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query "K2100" has 2 extra symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match. *) 2448 val max_extra_suffix : t -> int option 2449 2450 (** Maximum number of facet values to be returned. *) 2451 val max_facet_values : t -> int option 2452 2453 (** Minimum word length for 1-typo correction to be applied. The value of num_typos is still treated as the maximum allowed typos. 2454 *) 2455 val min_len_1typo : t -> int option 2456 2457 (** Minimum word length for 2-typo correction to be applied. The value of num_typos is still treated as the maximum allowed typos. 2458 *) 2459 val min_len_2typo : t -> int option 2460 2461 (** The number of typographical errors (1 or 2) that would be tolerated. Default: 2 2462 *) 2463 val num_typos : t -> string option 2464 2465 (** Identifies the starting point to return hits from a result set. Can be used as an alternative to the page parameter. *) 2466 val offset : t -> int option 2467 2468 (** Comma separated list of tags to trigger the curations rules that match the tags. *) 2469 val override_tags : t -> string option 2470 2471 (** Results from this specific page number would be fetched. *) 2472 val page : t -> int option 2473 2474 (** Number of results to fetch per page. Default: 10 *) 2475 val per_page : t -> int option 2476 2477 (** A list of records to unconditionally include in the search results at specific positions. An example use case would be to feature or promote certain items on the top of search results. A list of `record_id:hit_position`. Eg: to include a record with ID 123 at Position 1 and another record with ID 456 at Position 5, you'd specify `123:1,456:5`. 2478 You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`. 2479 *) 2480 val pinned_hits : t -> string option 2481 2482 (** You can index content from any logographic language into Typesense if you are able to segment / split the text into space-separated words yourself before indexing and querying. 2483 Set this parameter to true to do the same 2484 *) 2485 val pre_segmented_query : t -> bool 2486 2487 (** Boolean field to indicate that the last word in the query should be treated as a prefix, and not as a whole word. This is used for building autocomplete and instant search interfaces. Defaults to true. *) 2488 val prefix : t -> string option 2489 2490 (** Search using a bunch of search parameters by setting this parameter to the name of the existing Preset. 2491 *) 2492 val preset : t -> string option 2493 2494 (** Set this parameter to true to ensure that an exact match is ranked above the others 2495 *) 2496 val prioritize_exact_match : t -> bool 2497 2498 (** Make Typesense prioritize documents where the query words appear in more number of fields. 2499 *) 2500 val prioritize_num_matching_fields : t -> bool 2501 2502 (** Make Typesense prioritize documents where the query words appear earlier in the text. 2503 *) 2504 val prioritize_token_position : t -> bool 2505 2506 (** The query text to search for in the collection. Use * as the search string to return all documents. This is typically useful when used in conjunction with filter_by. *) 2507 val q : t -> string option 2508 2509 (** A list of `string` fields that should be queried against. Multiple fields are separated with a comma. *) 2510 val query_by : t -> string option 2511 2512 (** The relative weight to give each `query_by` field when ranking results. This can be used to boost fields in priority, when looking for matches. Multiple fields are separated with a comma. *) 2513 val query_by_weights : t -> string option 2514 2515 (** Number of times to retry fetching remote embeddings. 2516 *) 2517 val remote_embedding_num_tries : t -> int option 2518 2519 (** Timeout (in milliseconds) for fetching remote embeddings. 2520 *) 2521 val remote_embedding_timeout_ms : t -> int option 2522 2523 (** Typesense will attempt to return results early if the cutoff time has elapsed. This is not a strict guarantee and facet computation is not bound by this parameter. 2524 *) 2525 val search_cutoff_ms : t -> int option 2526 2527 (** Field values under this length will be fully highlighted, instead of showing a snippet of relevant portion. Default: 30 2528 *) 2529 val snippet_threshold : t -> int option 2530 2531 (** A list of numerical fields and their corresponding sort orders that will be used for ordering your results. Up to 3 sort fields can be specified. The text similarity score is exposed as a special `_text_match` field that you can use in the list of sorting fields. If no `sort_by` parameter is specified, results are sorted by `_text_match:desc,default_sorting_field:desc` *) 2532 val sort_by : t -> string option 2533 2534 (** Name of the stopwords set to apply for this search, the keywords present in the set will be removed from the search query. 2535 *) 2536 val stopwords : t -> string option 2537 2538 (** Allow synonym resolution on typo-corrected words in the query. Default: 0 2539 *) 2540 val synonym_num_typos : t -> int option 2541 2542 (** Allow synonym resolution on word prefixes in the query. Default: false 2543 *) 2544 val synonym_prefix : t -> bool option 2545 2546 (** In a multi-field matching context, this parameter determines how the representative text match score of a record is calculated. Possible values are max_score (default) or max_weight. *) 2547 val text_match_type : t -> string option 2548 2549 (** If the number of results found for a specific query is less than this number, Typesense will attempt to look for tokens with more typos until enough results are found. Default: 100 2550 *) 2551 val typo_tokens_threshold : t -> int option 2552 2553 (** Enable server side caching of search query results. By default, caching is disabled. 2554 *) 2555 val use_cache : t -> bool option 2556 2557 (** Vector query expression for fetching documents "closest" to a given query/document vector. 2558 *) 2559 val vector_query : t -> string option 2560 2561 (** The base64 encoded audio file in 16 khz 16-bit WAV format. 2562 *) 2563 val voice_query : t -> string option 2564 2565 (** The collection to search in. 2566 *) 2567 val collection : t -> string option 2568 2569 (** A separate search API key for each search within a multi_search request *) 2570 val x_typesense_api_key : t -> string option 2571 2572 (** When true, computes both text match and vector distance scores for all matches in hybrid search. Documents found only through keyword search will get a vector distance score, and documents found only through vector search will get a text match score. 2573 *) 2574 val rerank_hybrid_matches : t -> bool 2575 2576 val jsont : t Jsont.t 2577 end 2578end 2579 2580module MultiSearchSearchesParameter : sig 2581 module T : sig 2582 type t 2583 2584 (** Construct a value 2585 @param union When true, merges the search results from each search query into a single ordered set of hits. 2586 *) 2587 val v : searches:MultiSearchCollectionParameters.T.t list -> ?union:bool -> unit -> t 2588 2589 val searches : t -> MultiSearchCollectionParameters.T.t list 2590 2591 (** When true, merges the search results from each search query into a single ordered set of hits. *) 2592 val union : t -> bool 2593 2594 val jsont : t Jsont.t 2595 end 2596end 2597 2598module MultiSearch : sig 2599 module Result : sig 2600 type t 2601 2602 (** Construct a value *) 2603 val v : results:MultiSearchResult.Item.t list -> ?conversation:SearchResultConversation.T.t -> unit -> t 2604 2605 val conversation : t -> SearchResultConversation.T.t option 2606 2607 val results : t -> MultiSearchResult.Item.t list 2608 2609 val jsont : t Jsont.t 2610 end 2611 2612 (** send multiple search requests in a single HTTP request 2613 2614 This is especially useful to avoid round-trip network latencies incurred otherwise if each of these requests are sent in separate HTTP requests. You can also use this feature to do a federated search across multiple collections in a single HTTP request. *) 2615 val multi_search : multi_search_parameters:string -> body:MultiSearchSearchesParameter.T.t -> t -> unit -> Result.t 2616end 2617 2618module DirtyValues : sig 2619 module T : sig 2620 type t = [ 2621 | `Coerce_or_reject 2622 | `Coerce_or_drop 2623 | `Drop 2624 | `Reject 2625 ] 2626 2627 val jsont : t Jsont.t 2628 end 2629end 2630 2631module CurationSetDeleteSchema : sig 2632 module T : sig 2633 type t 2634 2635 (** Construct a value 2636 @param name Name of the deleted curation set 2637 *) 2638 val v : name:string -> unit -> t 2639 2640 (** Name of the deleted curation set *) 2641 val name : t -> string 2642 2643 val jsont : t Jsont.t 2644 end 2645 2646 (** Delete a curation set 2647 2648 Delete a specific curation set by its name 2649 @param curation_set_name The name of the curation set to delete 2650 *) 2651 val delete_curation_set : curation_set_name:string -> t -> unit -> T.t 2652end 2653 2654module CurationRule : sig 2655 module T : sig 2656 type t 2657 2658 (** Construct a value 2659 @param filter_by Indicates that the curation should apply when the filter_by parameter in a search query exactly matches the string specified here (including backticks, spaces, brackets, etc). 2660 2661 @param match_ Indicates whether the match on the query term should be `exact` or `contains`. If we want to match all queries that contained the word `apple`, we will use the `contains` match instead. 2662 2663 @param query Indicates what search queries should be curated 2664 @param tags List of tag values to associate with this curation rule. 2665 *) 2666 val v : ?filter_by:string -> ?match_:string -> ?query:string -> ?tags:string list -> unit -> t 2667 2668 (** Indicates that the curation should apply when the filter_by parameter in a search query exactly matches the string specified here (including backticks, spaces, brackets, etc). 2669 *) 2670 val filter_by : t -> string option 2671 2672 (** Indicates whether the match on the query term should be `exact` or `contains`. If we want to match all queries that contained the word `apple`, we will use the `contains` match instead. 2673 *) 2674 val match_ : t -> string option 2675 2676 (** Indicates what search queries should be curated *) 2677 val query : t -> string option 2678 2679 (** List of tag values to associate with this curation rule. *) 2680 val tags : t -> string list option 2681 2682 val jsont : t Jsont.t 2683 end 2684end 2685 2686module CurationItemDeleteSchema : sig 2687 module T : sig 2688 type t 2689 2690 (** Construct a value 2691 @param id ID of the deleted curation item 2692 *) 2693 val v : id:string -> unit -> t 2694 2695 (** ID of the deleted curation item *) 2696 val id : t -> string 2697 2698 val jsont : t Jsont.t 2699 end 2700 2701 (** Delete a curation set item 2702 2703 Delete a specific curation item by its id 2704 @param curation_set_name The name of the curation set 2705 @param item_id The id of the curation item to delete 2706 *) 2707 val delete_curation_set_item : curation_set_name:string -> item_id:string -> t -> unit -> T.t 2708end 2709 2710module CurationInclude : sig 2711 module T : sig 2712 type t 2713 2714 (** Construct a value 2715 @param id document id that should be included 2716 @param position position number where document should be included in the search results 2717 *) 2718 val v : id:string -> position:int -> unit -> t 2719 2720 (** document id that should be included *) 2721 val id : t -> string 2722 2723 (** position number where document should be included in the search results *) 2724 val position : t -> int 2725 2726 val jsont : t Jsont.t 2727 end 2728end 2729 2730module CurationExclude : sig 2731 module T : sig 2732 type t 2733 2734 (** Construct a value 2735 @param id document id that should be excluded from the search results. 2736 *) 2737 val v : id:string -> unit -> t 2738 2739 (** document id that should be excluded from the search results. *) 2740 val id : t -> string 2741 2742 val jsont : t Jsont.t 2743 end 2744end 2745 2746module CurationItemCreateSchema : sig 2747 module T : sig 2748 type t 2749 2750 (** Construct a value 2751 @param effective_from_ts A Unix timestamp that indicates the date/time from which the curation will be active. You can use this to create rules that start applying from a future point in time. 2752 2753 @param effective_to_ts A Unix timestamp that indicates the date/time until which the curation will be active. You can use this to create rules that stop applying after a period of time. 2754 2755 @param excludes List of document `id`s that should be excluded from the search results. 2756 @param filter_by A filter by clause that is applied to any search query that matches the curation rule. 2757 2758 @param filter_curated_hits When set to true, the filter conditions of the query is applied to the curated records as well. Default: false. 2759 2760 @param id ID of the curation item 2761 @param includes List of document `id`s that should be included in the search results with their corresponding `position`s. 2762 @param metadata Return a custom JSON object in the Search API response, when this rule is triggered. This can can be used to display a pre-defined message (eg: a promotion banner) on the front-end when a particular rule is triggered. 2763 2764 @param remove_matched_tokens Indicates whether search query tokens that exist in the curation's rule should be removed from the search query. 2765 2766 @param replace_query Replaces the current search query with this value, when the search query matches the curation rule. 2767 2768 @param sort_by A sort by clause that is applied to any search query that matches the curation rule. 2769 2770 @param stop_processing When set to true, curation processing will stop at the first matching rule. When set to false curation processing will continue and multiple curation actions will be triggered in sequence. Curations are processed in the lexical sort order of their id field. 2771 2772 *) 2773 val v : rule:CurationRule.T.t -> ?effective_from_ts:int -> ?effective_to_ts:int -> ?excludes:CurationExclude.T.t list -> ?filter_by:string -> ?filter_curated_hits:bool -> ?id:string -> ?includes:CurationInclude.T.t list -> ?metadata:Jsont.json -> ?remove_matched_tokens:bool -> ?replace_query:string -> ?sort_by:string -> ?stop_processing:bool -> unit -> t 2774 2775 (** A Unix timestamp that indicates the date/time from which the curation will be active. You can use this to create rules that start applying from a future point in time. 2776 *) 2777 val effective_from_ts : t -> int option 2778 2779 (** A Unix timestamp that indicates the date/time until which the curation will be active. You can use this to create rules that stop applying after a period of time. 2780 *) 2781 val effective_to_ts : t -> int option 2782 2783 (** List of document `id`s that should be excluded from the search results. *) 2784 val excludes : t -> CurationExclude.T.t list option 2785 2786 (** A filter by clause that is applied to any search query that matches the curation rule. 2787 *) 2788 val filter_by : t -> string option 2789 2790 (** When set to true, the filter conditions of the query is applied to the curated records as well. Default: false. 2791 *) 2792 val filter_curated_hits : t -> bool option 2793 2794 (** ID of the curation item *) 2795 val id : t -> string option 2796 2797 (** List of document `id`s that should be included in the search results with their corresponding `position`s. *) 2798 val includes : t -> CurationInclude.T.t list option 2799 2800 (** Return a custom JSON object in the Search API response, when this rule is triggered. This can can be used to display a pre-defined message (eg: a promotion banner) on the front-end when a particular rule is triggered. 2801 *) 2802 val metadata : t -> Jsont.json option 2803 2804 (** Indicates whether search query tokens that exist in the curation's rule should be removed from the search query. 2805 *) 2806 val remove_matched_tokens : t -> bool option 2807 2808 (** Replaces the current search query with this value, when the search query matches the curation rule. 2809 *) 2810 val replace_query : t -> string option 2811 2812 val rule : t -> CurationRule.T.t 2813 2814 (** A sort by clause that is applied to any search query that matches the curation rule. 2815 *) 2816 val sort_by : t -> string option 2817 2818 (** When set to true, curation processing will stop at the first matching rule. When set to false curation processing will continue and multiple curation actions will be triggered in sequence. Curations are processed in the lexical sort order of their id field. 2819 *) 2820 val stop_processing : t -> bool option 2821 2822 val jsont : t Jsont.t 2823 end 2824end 2825 2826module CurationSetCreateSchema : sig 2827 module T : sig 2828 type t 2829 2830 (** Construct a value 2831 @param items Array of curation items 2832 @param description Optional description for the curation set 2833 *) 2834 val v : items:CurationItemCreateSchema.T.t list -> ?description:string -> unit -> t 2835 2836 (** Optional description for the curation set *) 2837 val description : t -> string option 2838 2839 (** Array of curation items *) 2840 val items : t -> CurationItemCreateSchema.T.t list 2841 2842 val jsont : t Jsont.t 2843 end 2844end 2845 2846module CurationSetSchema : sig 2847 module T : sig 2848 type t 2849 2850 (** Construct a value 2851 @param items Array of curation items 2852 @param description Optional description for the curation set 2853 *) 2854 val v : items:CurationItemCreateSchema.T.t list -> name:string -> ?description:string -> unit -> t 2855 2856 (** Optional description for the curation set *) 2857 val description : t -> string option 2858 2859 (** Array of curation items *) 2860 val items : t -> CurationItemCreateSchema.T.t list 2861 2862 val name : t -> string 2863 2864 val jsont : t Jsont.t 2865 end 2866 2867 (** List all curation sets 2868 2869 Retrieve all curation sets *) 2870 val retrieve_curation_sets : t -> unit -> T.t 2871 2872 (** Retrieve a curation set 2873 2874 Retrieve a specific curation set by its name 2875 @param curation_set_name The name of the curation set to retrieve 2876 *) 2877 val retrieve_curation_set : curation_set_name:string -> t -> unit -> T.t 2878 2879 (** Create or update a curation set 2880 2881 Create or update a curation set with the given name 2882 @param curation_set_name The name of the curation set to create/update 2883 *) 2884 val upsert_curation_set : curation_set_name:string -> body:CurationSetCreateSchema.T.t -> t -> unit -> T.t 2885end 2886 2887module CurationItemSchema : sig 2888 module T : sig 2889 type t 2890 2891 (** Construct a value 2892 @param effective_from_ts A Unix timestamp that indicates the date/time from which the curation will be active. You can use this to create rules that start applying from a future point in time. 2893 2894 @param effective_to_ts A Unix timestamp that indicates the date/time until which the curation will be active. You can use this to create rules that stop applying after a period of time. 2895 2896 @param excludes List of document `id`s that should be excluded from the search results. 2897 @param filter_by A filter by clause that is applied to any search query that matches the curation rule. 2898 2899 @param filter_curated_hits When set to true, the filter conditions of the query is applied to the curated records as well. Default: false. 2900 2901 @param includes List of document `id`s that should be included in the search results with their corresponding `position`s. 2902 @param metadata Return a custom JSON object in the Search API response, when this rule is triggered. This can can be used to display a pre-defined message (eg: a promotion banner) on the front-end when a particular rule is triggered. 2903 2904 @param remove_matched_tokens Indicates whether search query tokens that exist in the curation's rule should be removed from the search query. 2905 2906 @param replace_query Replaces the current search query with this value, when the search query matches the curation rule. 2907 2908 @param sort_by A sort by clause that is applied to any search query that matches the curation rule. 2909 2910 @param stop_processing When set to true, curation processing will stop at the first matching rule. When set to false curation processing will continue and multiple curation actions will be triggered in sequence. Curations are processed in the lexical sort order of their id field. 2911 2912 *) 2913 val v : rule:CurationRule.T.t -> id:string -> ?effective_from_ts:int -> ?effective_to_ts:int -> ?excludes:CurationExclude.T.t list -> ?filter_by:string -> ?filter_curated_hits:bool -> ?includes:CurationInclude.T.t list -> ?metadata:Jsont.json -> ?remove_matched_tokens:bool -> ?replace_query:string -> ?sort_by:string -> ?stop_processing:bool -> unit -> t 2914 2915 (** A Unix timestamp that indicates the date/time from which the curation will be active. You can use this to create rules that start applying from a future point in time. 2916 *) 2917 val effective_from_ts : t -> int option 2918 2919 (** A Unix timestamp that indicates the date/time until which the curation will be active. You can use this to create rules that stop applying after a period of time. 2920 *) 2921 val effective_to_ts : t -> int option 2922 2923 (** List of document `id`s that should be excluded from the search results. *) 2924 val excludes : t -> CurationExclude.T.t list option 2925 2926 (** A filter by clause that is applied to any search query that matches the curation rule. 2927 *) 2928 val filter_by : t -> string option 2929 2930 (** When set to true, the filter conditions of the query is applied to the curated records as well. Default: false. 2931 *) 2932 val filter_curated_hits : t -> bool option 2933 2934 (** List of document `id`s that should be included in the search results with their corresponding `position`s. *) 2935 val includes : t -> CurationInclude.T.t list option 2936 2937 (** Return a custom JSON object in the Search API response, when this rule is triggered. This can can be used to display a pre-defined message (eg: a promotion banner) on the front-end when a particular rule is triggered. 2938 *) 2939 val metadata : t -> Jsont.json option 2940 2941 (** Indicates whether search query tokens that exist in the curation's rule should be removed from the search query. 2942 *) 2943 val remove_matched_tokens : t -> bool option 2944 2945 (** Replaces the current search query with this value, when the search query matches the curation rule. 2946 *) 2947 val replace_query : t -> string option 2948 2949 val rule : t -> CurationRule.T.t 2950 2951 (** A sort by clause that is applied to any search query that matches the curation rule. 2952 *) 2953 val sort_by : t -> string option 2954 2955 (** When set to true, curation processing will stop at the first matching rule. When set to false curation processing will continue and multiple curation actions will be triggered in sequence. Curations are processed in the lexical sort order of their id field. 2956 *) 2957 val stop_processing : t -> bool option 2958 2959 val id : t -> string 2960 2961 val jsont : t Jsont.t 2962 end 2963 2964 (** List items in a curation set 2965 2966 Retrieve all curation items in a set 2967 @param curation_set_name The name of the curation set to retrieve items for 2968 *) 2969 val retrieve_curation_set_items : curation_set_name:string -> t -> unit -> T.t 2970 2971 (** Retrieve a curation set item 2972 2973 Retrieve a specific curation item by its id 2974 @param curation_set_name The name of the curation set 2975 @param item_id The id of the curation item to retrieve 2976 *) 2977 val retrieve_curation_set_item : curation_set_name:string -> item_id:string -> t -> unit -> T.t 2978 2979 (** Create or update a curation set item 2980 2981 Create or update a curation set item with the given id 2982 @param curation_set_name The name of the curation set 2983 @param item_id The id of the curation item to upsert 2984 *) 2985 val upsert_curation_set_item : curation_set_name:string -> item_id:string -> body:CurationItemCreateSchema.T.t -> t -> unit -> T.t 2986end 2987 2988module ConversationModelUpdateSchema : sig 2989 module T : sig 2990 type t 2991 2992 (** Construct a value 2993 @param account_id LLM service's account ID (only applicable for Cloudflare) 2994 @param api_key The LLM service's API Key 2995 @param history_collection Typesense collection that stores the historical conversations 2996 @param id An explicit id for the model, otherwise the API will return a response with an auto-generated conversation model id. 2997 @param max_bytes The maximum number of bytes to send to the LLM in every API call. Consult the LLM's documentation on the number of bytes supported in the context window. 2998 2999 @param model_name Name of the LLM model offered by OpenAI, Cloudflare or vLLM 3000 @param system_prompt The system prompt that contains special instructions to the LLM 3001 @param ttl Time interval in seconds after which the messages would be deleted. Default: 86400 (24 hours) 3002 3003 @param vllm_url URL of vLLM service 3004 *) 3005 val v : ?account_id:string -> ?api_key:string -> ?history_collection:string -> ?id:string -> ?max_bytes:int -> ?model_name:string -> ?system_prompt:string -> ?ttl:int -> ?vllm_url:string -> unit -> t 3006 3007 (** LLM service's account ID (only applicable for Cloudflare) *) 3008 val account_id : t -> string option 3009 3010 (** The LLM service's API Key *) 3011 val api_key : t -> string option 3012 3013 (** Typesense collection that stores the historical conversations *) 3014 val history_collection : t -> string option 3015 3016 (** An explicit id for the model, otherwise the API will return a response with an auto-generated conversation model id. *) 3017 val id : t -> string option 3018 3019 (** The maximum number of bytes to send to the LLM in every API call. Consult the LLM's documentation on the number of bytes supported in the context window. 3020 *) 3021 val max_bytes : t -> int option 3022 3023 (** Name of the LLM model offered by OpenAI, Cloudflare or vLLM *) 3024 val model_name : t -> string option 3025 3026 (** The system prompt that contains special instructions to the LLM *) 3027 val system_prompt : t -> string option 3028 3029 (** Time interval in seconds after which the messages would be deleted. Default: 86400 (24 hours) 3030 *) 3031 val ttl : t -> int option 3032 3033 (** URL of vLLM service *) 3034 val vllm_url : t -> string option 3035 3036 val jsont : t Jsont.t 3037 end 3038end 3039 3040module ConversationModelCreateSchema : sig 3041 module T : sig 3042 type t 3043 3044 (** Construct a value 3045 @param model_name Name of the LLM model offered by OpenAI, Cloudflare or vLLM 3046 @param max_bytes The maximum number of bytes to send to the LLM in every API call. Consult the LLM's documentation on the number of bytes supported in the context window. 3047 3048 @param history_collection Typesense collection that stores the historical conversations 3049 @param account_id LLM service's account ID (only applicable for Cloudflare) 3050 @param api_key The LLM service's API Key 3051 @param id An explicit id for the model, otherwise the API will return a response with an auto-generated conversation model id. 3052 @param system_prompt The system prompt that contains special instructions to the LLM 3053 @param ttl Time interval in seconds after which the messages would be deleted. Default: 86400 (24 hours) 3054 3055 @param vllm_url URL of vLLM service 3056 *) 3057 val v : model_name:string -> max_bytes:int -> history_collection:string -> ?account_id:string -> ?api_key:string -> ?id:string -> ?system_prompt:string -> ?ttl:int -> ?vllm_url:string -> unit -> t 3058 3059 (** LLM service's account ID (only applicable for Cloudflare) *) 3060 val account_id : t -> string option 3061 3062 (** The LLM service's API Key *) 3063 val api_key : t -> string option 3064 3065 (** An explicit id for the model, otherwise the API will return a response with an auto-generated conversation model id. *) 3066 val id : t -> string option 3067 3068 (** The system prompt that contains special instructions to the LLM *) 3069 val system_prompt : t -> string option 3070 3071 (** Time interval in seconds after which the messages would be deleted. Default: 86400 (24 hours) 3072 *) 3073 val ttl : t -> int option 3074 3075 (** URL of vLLM service *) 3076 val vllm_url : t -> string option 3077 3078 (** Name of the LLM model offered by OpenAI, Cloudflare or vLLM *) 3079 val model_name : t -> string 3080 3081 (** The maximum number of bytes to send to the LLM in every API call. Consult the LLM's documentation on the number of bytes supported in the context window. 3082 *) 3083 val max_bytes : t -> int 3084 3085 (** Typesense collection that stores the historical conversations *) 3086 val history_collection : t -> string 3087 3088 val jsont : t Jsont.t 3089 end 3090end 3091 3092module ConversationModelSchema : sig 3093 module T : sig 3094 type t 3095 3096 (** Construct a value 3097 @param model_name Name of the LLM model offered by OpenAI, Cloudflare or vLLM 3098 @param max_bytes The maximum number of bytes to send to the LLM in every API call. Consult the LLM's documentation on the number of bytes supported in the context window. 3099 3100 @param history_collection Typesense collection that stores the historical conversations 3101 @param id An explicit id for the model, otherwise the API will return a response with an auto-generated conversation model id. 3102 @param account_id LLM service's account ID (only applicable for Cloudflare) 3103 @param api_key The LLM service's API Key 3104 @param system_prompt The system prompt that contains special instructions to the LLM 3105 @param ttl Time interval in seconds after which the messages would be deleted. Default: 86400 (24 hours) 3106 3107 @param vllm_url URL of vLLM service 3108 *) 3109 val v : model_name:string -> max_bytes:int -> history_collection:string -> id:string -> ?account_id:string -> ?api_key:string -> ?system_prompt:string -> ?ttl:int -> ?vllm_url:string -> unit -> t 3110 3111 (** LLM service's account ID (only applicable for Cloudflare) *) 3112 val account_id : t -> string option 3113 3114 (** The LLM service's API Key *) 3115 val api_key : t -> string option 3116 3117 (** The system prompt that contains special instructions to the LLM *) 3118 val system_prompt : t -> string option 3119 3120 (** Time interval in seconds after which the messages would be deleted. Default: 86400 (24 hours) 3121 *) 3122 val ttl : t -> int option 3123 3124 (** URL of vLLM service *) 3125 val vllm_url : t -> string option 3126 3127 (** Name of the LLM model offered by OpenAI, Cloudflare or vLLM *) 3128 val model_name : t -> string 3129 3130 (** The maximum number of bytes to send to the LLM in every API call. Consult the LLM's documentation on the number of bytes supported in the context window. 3131 *) 3132 val max_bytes : t -> int 3133 3134 (** Typesense collection that stores the historical conversations *) 3135 val history_collection : t -> string 3136 3137 (** An explicit id for the model, otherwise the API will return a response with an auto-generated conversation model id. *) 3138 val id : t -> string 3139 3140 val jsont : t Jsont.t 3141 end 3142 3143 (** List all conversation models 3144 3145 Retrieve all conversation models *) 3146 val retrieve_all_conversation_models : t -> unit -> T.t 3147 3148 (** Create a conversation model 3149 3150 Create a Conversation Model *) 3151 val create_conversation_model : body:ConversationModelCreateSchema.T.t -> t -> unit -> T.t 3152 3153 (** Retrieve a conversation model 3154 3155 Retrieve a conversation model 3156 @param model_id The id of the conversation model to retrieve 3157 *) 3158 val retrieve_conversation_model : model_id:string -> t -> unit -> T.t 3159 3160 (** Update a conversation model 3161 3162 Update a conversation model 3163 @param model_id The id of the conversation model to update 3164 *) 3165 val update_conversation_model : model_id:string -> body:ConversationModelUpdateSchema.T.t -> t -> unit -> T.t 3166 3167 (** Delete a conversation model 3168 3169 Delete a conversation model 3170 @param model_id The id of the conversation model to delete 3171 *) 3172 val delete_conversation_model : model_id:string -> t -> unit -> T.t 3173end 3174 3175module CollectionAliasSchema : sig 3176 module T : sig 3177 type t 3178 3179 (** Construct a value 3180 @param collection_name Name of the collection you wish to map the alias to 3181 *) 3182 val v : collection_name:string -> unit -> t 3183 3184 (** Name of the collection you wish to map the alias to *) 3185 val collection_name : t -> string 3186 3187 val jsont : t Jsont.t 3188 end 3189end 3190 3191module CollectionAlias : sig 3192 module T : sig 3193 type t 3194 3195 (** Construct a value 3196 @param collection_name Name of the collection the alias mapped to 3197 @param name Name of the collection alias 3198 *) 3199 val v : collection_name:string -> name:string -> unit -> t 3200 3201 (** Name of the collection the alias mapped to *) 3202 val collection_name : t -> string 3203 3204 (** Name of the collection alias *) 3205 val name : t -> string 3206 3207 val jsont : t Jsont.t 3208 end 3209 3210 (** Retrieve an alias 3211 3212 Find out which collection an alias points to by fetching it 3213 @param alias_name The name of the alias to retrieve 3214 *) 3215 val get_alias : alias_name:string -> t -> unit -> T.t 3216 3217 (** Create or update a collection alias 3218 3219 Create or update a collection alias. An alias is a virtual collection name that points to a real collection. If you're familiar with symbolic links on Linux, it's very similar to that. Aliases are useful when you want to reindex your data in the background on a new collection and switch your application to it without any changes to your code. 3220 @param alias_name The name of the alias to create/update 3221 *) 3222 val upsert_alias : alias_name:string -> body:CollectionAliasSchema.T.t -> t -> unit -> T.t 3223 3224 (** Delete an alias 3225 @param alias_name The name of the alias to delete 3226 *) 3227 val delete_alias : alias_name:string -> t -> unit -> T.t 3228end 3229 3230module CollectionAliases : sig 3231 module Response : sig 3232 type t 3233 3234 (** Construct a value *) 3235 val v : aliases:CollectionAlias.T.t list -> unit -> t 3236 3237 val aliases : t -> CollectionAlias.T.t list 3238 3239 val jsont : t Jsont.t 3240 end 3241 3242 (** List all aliases 3243 3244 List all aliases and the corresponding collections that they map to. *) 3245 val get_aliases : t -> unit -> Response.t 3246end 3247 3248module Client : sig 3249 (** Create analytics rule(s) 3250 3251 Create one or more analytics rules. You can send a single rule object or an array of rule objects. *) 3252 val create_analytics_rule : t -> unit -> Jsont.json 3253 3254 (** Index a document 3255 3256 A document to be indexed in a given collection must conform to the schema of the collection. 3257 @param collection_name The name of the collection to add the document to 3258 @param action Additional action to perform 3259 @param dirty_values Dealing with Dirty Data 3260 *) 3261 val index_document : collection_name:string -> ?action:string -> ?dirty_values:string -> t -> unit -> Jsont.json 3262 3263 (** Delete a bunch of documents 3264 3265 Delete a bunch of documents that match a specific filter condition. Use the `batch_size` parameter to control the number of documents that should deleted at a time. A larger value will speed up deletions, but will impact performance of other operations running on the server. 3266 @param collection_name The name of the collection to delete documents from 3267 *) 3268 val delete_documents : collection_name:string -> ?delete_documents_parameters:string -> t -> unit -> Jsont.json 3269 3270 (** Update documents with conditional query 3271 3272 The filter_by query parameter is used to filter to specify a condition against which the documents are matched. The request body contains the fields that should be updated for any documents that match the filter condition. This endpoint is only available if the Typesense server is version `0.25.0.rc12` or later. 3273 @param collection_name The name of the collection to update documents in 3274 *) 3275 val update_documents : collection_name:string -> ?update_documents_parameters:string -> t -> unit -> Jsont.json 3276 3277 (** Export all documents in a collection 3278 3279 Export all documents in a collection in JSON lines format. 3280 @param collection_name The name of the collection 3281 *) 3282 val export_documents : collection_name:string -> ?export_documents_parameters:string -> t -> unit -> Jsont.json 3283 3284 (** Import documents into a collection 3285 3286 The documents to be imported must be formatted in a newline delimited JSON structure. You can feed the output file from a Typesense export operation directly as import. 3287 @param collection_name The name of the collection 3288 *) 3289 val import_documents : collection_name:string -> ?import_documents_parameters:string -> t -> unit -> Jsont.json 3290 3291 (** Retrieve a document 3292 3293 Fetch an individual document from a collection by using its ID. 3294 @param collection_name The name of the collection to search for the document under 3295 @param document_id The Document ID 3296 *) 3297 val get_document : collection_name:string -> document_id:string -> t -> unit -> Jsont.json 3298 3299 (** Delete a document 3300 3301 Delete an individual document from a collection by using its ID. 3302 @param collection_name The name of the collection to search for the document under 3303 @param document_id The Document ID 3304 *) 3305 val delete_document : collection_name:string -> document_id:string -> t -> unit -> Jsont.json 3306 3307 (** Update a document 3308 3309 Update an individual document from a collection by using its ID. The update can be partial. 3310 @param collection_name The name of the collection to search for the document under 3311 @param document_id The Document ID 3312 @param dirty_values Dealing with Dirty Data 3313 *) 3314 val update_document : collection_name:string -> document_id:string -> ?dirty_values:string -> t -> unit -> Jsont.json 3315 3316 (** Print debugging information 3317 3318 Print debugging information *) 3319 val debug : t -> unit -> Jsont.json 3320 3321 (** Get current RAM, CPU, Disk & Network usage metrics. 3322 3323 Retrieve the metrics. *) 3324 val retrieve_metrics : t -> unit -> Jsont.json 3325 3326 (** List all stemming dictionaries 3327 3328 Retrieve a list of all available stemming dictionaries. *) 3329 val list_stemming_dictionaries : t -> unit -> Jsont.json 3330 3331 (** Import a stemming dictionary 3332 3333 Upload a JSONL file containing word mappings to create or update a stemming dictionary. 3334 @param id The ID to assign to the dictionary 3335 *) 3336 val import_stemming_dictionary : id:string -> t -> unit -> Jsont.json 3337 3338 (** Delete a stopwords set. 3339 3340 Permanently deletes a stopwords set, given it's name. 3341 @param set_id The ID of the stopwords set to delete. 3342 *) 3343 val delete_stopwords_set : set_id:string -> t -> unit -> Jsont.json 3344end 3345 3346module Apistats : sig 3347 module Response : sig 3348 type t 3349 3350 (** Construct a value *) 3351 val v : ?delete_latency_ms:float -> ?delete_requests_per_second:float -> ?import_latency_ms:float -> ?import_requests_per_second:float -> ?latency_ms:Jsont.json -> ?overloaded_requests_per_second:float -> ?pending_write_batches:float -> ?requests_per_second:Jsont.json -> ?search_latency_ms:float -> ?search_requests_per_second:float -> ?total_requests_per_second:float -> ?write_latency_ms:float -> ?write_requests_per_second:float -> unit -> t 3352 3353 val delete_latency_ms : t -> float option 3354 3355 val delete_requests_per_second : t -> float option 3356 3357 val import_latency_ms : t -> float option 3358 3359 val import_requests_per_second : t -> float option 3360 3361 val latency_ms : t -> Jsont.json option 3362 3363 val overloaded_requests_per_second : t -> float option 3364 3365 val pending_write_batches : t -> float option 3366 3367 val requests_per_second : t -> Jsont.json option 3368 3369 val search_latency_ms : t -> float option 3370 3371 val search_requests_per_second : t -> float option 3372 3373 val total_requests_per_second : t -> float option 3374 3375 val write_latency_ms : t -> float option 3376 3377 val write_requests_per_second : t -> float option 3378 3379 val jsont : t Jsont.t 3380 end 3381 3382 (** Get stats about API endpoints. 3383 3384 Retrieve the stats about API endpoints. *) 3385 val retrieve_apistats : t -> unit -> Response.t 3386end 3387 3388module ApiKeySchema : sig 3389 module T : sig 3390 type t 3391 3392 (** Construct a value *) 3393 val v : actions:string list -> collections:string list -> description:string -> ?expires_at:int64 -> ?value:string -> unit -> t 3394 3395 val actions : t -> string list 3396 3397 val collections : t -> string list 3398 3399 val description : t -> string 3400 3401 val expires_at : t -> int64 option 3402 3403 val value : t -> string option 3404 3405 val jsont : t Jsont.t 3406 end 3407end 3408 3409module ApiKey : sig 3410 module T : sig 3411 type t 3412 3413 (** Construct a value *) 3414 val v : actions:string list -> collections:string list -> description:string -> ?expires_at:int64 -> ?value:string -> ?id:int64 -> ?value_prefix:string -> unit -> t 3415 3416 val actions : t -> string list 3417 3418 val collections : t -> string list 3419 3420 val description : t -> string 3421 3422 val expires_at : t -> int64 option 3423 3424 val value : t -> string option 3425 3426 val id : t -> int64 option 3427 3428 val value_prefix : t -> string option 3429 3430 val jsont : t Jsont.t 3431 end 3432 3433 (** Create an API Key 3434 3435 Create an API Key with fine-grain access control. You can restrict access on both a per-collection and per-action level. The generated key is returned only during creation. You want to store this key carefully in a secure place. *) 3436 val create_key : body:ApiKeySchema.T.t -> t -> unit -> T.t 3437 3438 (** Retrieve (metadata about) a key 3439 3440 Retrieve (metadata about) a key. Only the key prefix is returned when you retrieve a key. Due to security reasons, only the create endpoint returns the full API key. 3441 @param key_id The ID of the key to retrieve 3442 *) 3443 val get_key : key_id:string -> t -> unit -> T.t 3444end 3445 3446module ApiKeys : sig 3447 module Response : sig 3448 type t 3449 3450 (** Construct a value *) 3451 val v : keys:ApiKey.T.t list -> unit -> t 3452 3453 val keys : t -> ApiKey.T.t list 3454 3455 val jsont : t Jsont.t 3456 end 3457 3458 (** Retrieve (metadata about) all keys. *) 3459 val get_keys : t -> unit -> Response.t 3460end 3461 3462module ApiKeyDelete : sig 3463 module Response : sig 3464 type t 3465 3466 (** Construct a value 3467 @param id The id of the API key that was deleted 3468 *) 3469 val v : id:int64 -> unit -> t 3470 3471 (** The id of the API key that was deleted *) 3472 val id : t -> int64 3473 3474 val jsont : t Jsont.t 3475 end 3476 3477 (** Delete an API key given its ID. 3478 @param key_id The ID of the key to delete 3479 *) 3480 val delete_key : key_id:string -> t -> unit -> Response.t 3481end 3482 3483module Api : sig 3484 module Response : sig 3485 type t 3486 3487 (** Construct a value *) 3488 val v : message:string -> unit -> t 3489 3490 val message : t -> string 3491 3492 val jsont : t Jsont.t 3493 end 3494end 3495 3496module AnalyticsRule : sig 3497 module Update : sig 3498 (** Fields allowed to update on an analytics rule *) 3499 type t 3500 3501 (** Construct a value *) 3502 val v : ?name:string -> ?params:Jsont.json -> ?rule_tag:string -> unit -> t 3503 3504 val name : t -> string option 3505 3506 val params : t -> Jsont.json option 3507 3508 val rule_tag : t -> string option 3509 3510 val jsont : t Jsont.t 3511 end 3512 3513 module Type : sig 3514 type t = [ 3515 | `Popular_queries 3516 | `Nohits_queries 3517 | `Counter 3518 | `Log 3519 ] 3520 3521 val jsont : t Jsont.t 3522 end 3523 3524 module Create : sig 3525 type t 3526 3527 (** Construct a value *) 3528 val v : collection:string -> event_type:string -> name:string -> type_:Type.t -> ?params:Jsont.json -> ?rule_tag:string -> unit -> t 3529 3530 val collection : t -> string 3531 3532 val event_type : t -> string 3533 3534 val name : t -> string 3535 3536 val params : t -> Jsont.json option 3537 3538 val rule_tag : t -> string option 3539 3540 val type_ : t -> Type.t 3541 3542 val jsont : t Jsont.t 3543 end 3544 3545 module T : sig 3546 type t 3547 3548 (** Construct a value *) 3549 val v : collection:string -> event_type:string -> name:string -> type_:Type.t -> ?params:Jsont.json -> ?rule_tag:string -> unit -> t 3550 3551 val collection : t -> string 3552 3553 val event_type : t -> string 3554 3555 val name : t -> string 3556 3557 val params : t -> Jsont.json option 3558 3559 val rule_tag : t -> string option 3560 3561 val type_ : t -> Type.t 3562 3563 val jsont : t Jsont.t 3564 end 3565 3566 (** Retrieve analytics rules 3567 3568 Retrieve all analytics rules. Use the optional rule_tag filter to narrow down results. 3569 @param rule_tag Filter rules by rule_tag 3570 *) 3571 val retrieve_analytics_rules : ?rule_tag:string -> t -> unit -> T.t 3572 3573 (** Retrieves an analytics rule 3574 3575 Retrieve the details of an analytics rule, given it's name 3576 @param rule_name The name of the analytics rule to retrieve 3577 *) 3578 val retrieve_analytics_rule : rule_name:string -> t -> unit -> T.t 3579 3580 (** Upserts an analytics rule 3581 3582 Upserts an analytics rule with the given name. 3583 @param rule_name The name of the analytics rule to upsert 3584 *) 3585 val upsert_analytics_rule : rule_name:string -> body:Update.t -> t -> unit -> T.t 3586 3587 (** Delete an analytics rule 3588 3589 Permanently deletes an analytics rule, given it's name 3590 @param rule_name The name of the analytics rule to delete 3591 *) 3592 val delete_analytics_rule : rule_name:string -> t -> unit -> T.t 3593end 3594 3595module AnalyticsEvents : sig 3596 module Response : sig 3597 type t 3598 3599 (** Construct a value *) 3600 val v : events:Jsont.json list -> unit -> t 3601 3602 val events : t -> Jsont.json list 3603 3604 val jsont : t Jsont.t 3605 end 3606 3607 (** Retrieve analytics events 3608 3609 Retrieve the most recent events for a user and rule. 3610 @param name Analytics rule name 3611 @param n Number of events to return (max 1000) 3612 *) 3613 val get_analytics_events : user_id:string -> name:string -> n:string -> t -> unit -> Response.t 3614end 3615 3616module AnalyticsEvent : sig 3617 module T : sig 3618 type t 3619 3620 (** Construct a value 3621 @param data Event payload 3622 @param event_type Type of event (e.g., click, conversion, query, visit) 3623 @param name Name of the analytics rule this event corresponds to 3624 *) 3625 val v : data:Jsont.json -> event_type:string -> name:string -> unit -> t 3626 3627 (** Event payload *) 3628 val data : t -> Jsont.json 3629 3630 (** Type of event (e.g., click, conversion, query, visit) *) 3631 val event_type : t -> string 3632 3633 (** Name of the analytics rule this event corresponds to *) 3634 val name : t -> string 3635 3636 val jsont : t Jsont.t 3637 end 3638end 3639 3640module AnalyticsEventCreate : sig 3641 module Response : sig 3642 type t 3643 3644 (** Construct a value *) 3645 val v : ok:bool -> unit -> t 3646 3647 val ok : t -> bool 3648 3649 val jsont : t Jsont.t 3650 end 3651 3652 (** Create an analytics event 3653 3654 Submit a single analytics event. The event must correspond to an existing analytics rule by name. *) 3655 val create_analytics_event : body:AnalyticsEvent.T.t -> t -> unit -> Response.t 3656 3657 (** Flush in-memory analytics to disk 3658 3659 Triggers a flush of analytics data to persistent storage. *) 3660 val flush_analytics : t -> unit -> Response.t 3661end 3662 3663module Analytics : sig 3664 module Status : sig 3665 type t 3666 3667 (** Construct a value *) 3668 val v : ?doc_counter_events:int -> ?doc_log_events:int -> ?log_prefix_queries:int -> ?nohits_prefix_queries:int -> ?popular_prefix_queries:int -> ?query_counter_events:int -> ?query_log_events:int -> unit -> t 3669 3670 val doc_counter_events : t -> int option 3671 3672 val doc_log_events : t -> int option 3673 3674 val log_prefix_queries : t -> int option 3675 3676 val nohits_prefix_queries : t -> int option 3677 3678 val popular_prefix_queries : t -> int option 3679 3680 val query_counter_events : t -> int option 3681 3682 val query_log_events : t -> int option 3683 3684 val jsont : t Jsont.t 3685 end 3686 3687 (** Get analytics subsystem status 3688 3689 Returns sizes of internal analytics buffers and queues. *) 3690 val get_analytics_status : t -> unit -> Status.t 3691end