module Sphinx:sig
..end
typenum =
int32
val max_packet_size : int32
type
status =
| |
Ok |
| |
Error |
| |
Retry |
| |
Warning |
val show_status : status -> string
type
matching =
| |
MATCH_ALL |
| |
MATCH_ANY |
| |
MATCH_PHRASE |
| |
MATCH_BOOLEAN |
| |
MATCH_EXTENDED |
| |
MATCH_FULLSCAN |
| |
MATCH_EXTENDED2 |
val show_matching : matching -> string
type
ranking =
| |
RANK_PROXIMITY_BM25 |
(* |
default mode, phrase proximity major factor and BM25 minor one
| *) |
| |
RANK_BM25 |
(* |
statistical mode, BM25 ranking only (faster but worse quality)
| *) |
| |
RANK_NONE |
(* |
no ranking, all matches get a weight of 1
| *) |
| |
RANK_WORDCOUNT |
(* |
simple word-count weighting, rank is a weighted sum of per-field keyword occurence counts
| *) |
| |
RANK_PROXIMITY |
|||
| |
RANK_MATCHANY |
|||
| |
RANK_FIELDMASK |
|||
| |
RANK_SPH04 |
val show_ranking : ranking -> string
type
sort =
| |
SORT_RELEVANCE |
| |
SORT_ATTR_DESC |
| |
SORT_ATTR_ASC |
| |
SORT_TIME_SEGMENTS |
| |
SORT_EXTENDED |
| |
SORT_EXPR |
val show_sort : sort -> string
type
filter =
| |
FILTER_VALUES of |
| |
FILTER_RANGE of |
| |
FILTER_FLOATRANGE of |
val show_filter : filter -> string
type
attr1 =
| |
ATTR_NONE |
(* |
not an attribute (unknown)
| *) |
| |
ATTR_INTEGER |
|||
| |
ATTR_TIMESTAMP |
|||
| |
ATTR_ORDINAL |
(* |
ordinal string number
| *) |
| |
ATTR_BOOL |
(* |
boolean bit field
| *) |
| |
ATTR_FLOAT |
|||
| |
ATTR_BIGINT |
|||
| |
ATTR_STRING |
|||
| |
ATTR_WORDCOUNT |
(* |
string word count
| *) |
typeattr_type =
attr1 * bool
val show_attr_type : attr_type -> string
type
attr_value =
| |
F of |
| |
L of |
| |
Q of |
| |
MVA of |
| |
S of |
val show_attr : attr_value -> string
type
grouping =
| |
GROUPBY_DAY |
| |
GROUPBY_WEEK |
| |
GROUPBY_MONTH |
| |
GROUPBY_YEAR |
| |
GROUPBY_ATTR |
| |
GROUPBY_ATTRPAIR |
val show_grouping : grouping -> string
type
query = {
|
mutable offset : |
(* |
how much records to seek from result-set start (default is 0)
| *) |
|
mutable limit : |
(* |
how much records to return from result-set starting at offset (default is 20)
| *) |
|
mutable mode : |
(* |
query matching mode (default is MATCH_ALL)
| *) |
|
mutable sort : |
(* |
match sorting mode (default is SORT_RELEVANCE)
| *) |
|
mutable sortby : |
(* |
attribute to sort by (default is "")
| *) |
|
mutable min_id : |
(* |
min ID to match (default is 0)
| *) |
|
mutable max_id : |
(* |
max ID to match (default is UINT_MAX)
| *) |
|
mutable filters : |
(* |
search filters : attribute * filter * exclude
| *) |
|
mutable groupby : |
(* |
group-by attribute name
| *) |
|
mutable groupfunc : |
(* |
group-by function (to pre-process group-by attribute value with)
| *) |
|
mutable groupsort : |
(* |
group-by sorting clause (to sort groups in result set with)
| *) |
|
mutable groupdistinct : |
(* |
group-by count-distinct attribute
| *) |
|
mutable maxmatches : |
(* |
max matches to retrieve (default is 1000)
| *) |
|
mutable cutoff : |
(* |
cutoff to stop searching at
| *) |
|
mutable retrycount : |
(* |
distributed retry count
| *) |
|
mutable retrydelay : |
(* |
distributed retry delay
| *) |
|
mutable anchor : |
(* |
geographical anchor point
| *) |
|
mutable indexweights : |
(* |
per-index weights
| *) |
|
mutable ranker : |
(* |
ranking mode (default is RANK_PROXIMITY_BM25)
| *) |
|
mutable maxquerytime : |
(* |
max query time, milliseconds (default is 0, do not limit)
| *) |
|
mutable fieldweights : |
(* |
per-field-name weights (default is 1 for all fields)
| *) |
|
mutable overrides : |
(* |
per-query attribute values overrides
| *) |
|
mutable select : |
(* |
select-list (attributes or expressions, with optional aliases)
| *) |
type
result = {
|
fields : |
|||
|
attrs : |
|||
|
matches : |
(* |
matches: (document id, weight, attributes)
| *) |
|
total : |
|||
|
total_found : |
|||
|
time : |
(* |
query execution time, in milliseconds
| *) |
|
words : |
(* |
words statistics: (word, (documents, hits))
| *) |
|
warning : |
(* |
warning message
| *) |
val default : unit -> query
exception Fail of string
val parse_sockaddr : string -> Unix.sockaddr
typeconn = private
Unix.file_descr
val connect : ?addr:Unix.sockaddr -> ?persist:bool -> unit -> conn
connect ?addr ?persist ()
addr
: searchd socket (default 127.0.0.1:9312
)persist
: persistent connection (default false
- connection is closed by the server after the first request)val close : conn -> unit
val set_limits : query ->
?maxmatches:int -> ?cutoff:int -> offset:int -> limit:int -> unit
val set_id_range : query -> int64 -> int64 -> unit
id1
and id2
(inclusive).val add_filter : query -> string -> filter -> bool -> unit
add_filter query a filter exclude
adds filter
on attribute a
to query
.
If exclude
is true then rows with matching attribute are excluded from resultset.val build_query : query -> ?index:string -> ?comment:string -> string -> string
val run_queries : conn ->
string list ->
[> `Err of string | `Ok of result ] list * string option
val query : conn ->
query ->
?index:string -> ?comment:string -> string -> result * string option
Fail
on protocol and query errorsval flush_attrs : conn -> int32
val update_attrs : conn ->
string -> string list -> (int64 * int list) list -> int * string option
update_attrs conn index attrs values
updates given attribute values on given documents in given indexes.