forked from singularperturbation/sphinx
-
Notifications
You must be signed in to change notification settings - Fork 1
/
constants.go
124 lines (104 loc) · 2.38 KB
/
constants.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
package sphinx
const DefaultIndex = "*"
// Sent to / received from server to ensure same version.
const MAJOR_PROTOCOL_VERSION = 1
// Command versions from sphinxclient.c
const (
VER_COMMAND_EXCERPT = 0x103
VER_COMMAND_UPDATE = 0x102
VER_COMMAND_KEYWORDS = 0x100
VER_COMMAND_STATUS = 0x100
// Version of the sphinx client as of 2.0.8 release
VER_COMMAND_SEARCH = 0x119
)
type MatchMode int
// Matching modes from sphinxclient.h
const (
SPH_MATCH_ALL MatchMode = iota
SPH_MATCH_ANY
SPH_MATCH_PHRASE
SPH_MATCH_BOOLEAN
SPH_MATCH_EXTENDED
SPH_MATCH_FULLSCAN
SPH_MATCH_EXTENDED2
)
type RankMode int
// Ranking modes from sphinxclient.h
const (
SPH_RANK_PROXIMITY_BM25 RankMode = iota // Default mode, phrase proximity major factor and BM25 minor one
SPH_RANK_BM25
SPH_RANK_NONE
SPH_RANK_WORDCOUNT
SPH_RANK_PROXIMITY
SPH_RANK_MATCHANY
SPH_RANK_FIELDMASK
SPH_RANK_SPH04
_ // Don't support SPH_RANK_EXPR since PHP driver does not
SPH_RANK_TOTAL
SPH_RANK_DEFAULT = SPH_RANK_PROXIMITY_BM25
)
type SortMode int
// Sorting modes, also from sphinxclient.h
const (
SPH_SORT_RELEVANCE SortMode = iota
SPH_SORT_ATTR_DESC
SPH_SORT_ATTR_ASC
SPH_SORT_TIME_SEGMENTS
SPH_SORT_EXTENDED
SPH_SORT_EXPR // Deprecated, never use it.
)
// Grouping functions from sphinxclient.h
const (
SPH_GROUPBY_DAY = iota
SPH_GROUPBY_WEEK
SPH_GROUPBY_MONTH
SPH_GROUPBY_YEAR
SPH_GROUPBY_ATTR
SPH_GROUPBY_ATTRPAIR
// Default Groupby option and function
SPH_GROUPBY_FUNC_DEFAULT = SPH_GROUPBY_ATTR
SPH_GROUPBY_DEFAULT = ""
SPH_GROUPBY_SORT_DEFAULT = "@groupby desc"
)
// Searchd status codes from sphinxclient.h
const (
SEARCHD_OK = iota
SEARCHD_ERROR
SEARCHD_RETRY
SEARCHD_WARNING
)
// Attribute types from sphinxclient.h
const (
_ = iota // Starts at 1, so ignore 0
SPH_ATTR_INTEGER
SPH_ATTR_TIMESTAMP
SPH_ATTR_ORDINAL
SPH_ATTR_BOOL
SPH_ATTR_FLOAT
SPH_ATTR_BIGINT
SPH_ATTR_STRING
SPH_ATTR_MULTI = 0x40000001
SPH_ATTR_MULTI64 = 0x40000002
)
type Command int
// Searchd commands from sphinxclient.c
const (
SEARCHD_COMMAND_SEARCH Command = iota
SEARCHD_COMMAND_EXCERPT
SEARCHD_COMMAND_UPDATE
SEARCHD_COMMAND_KEYWORDS
SEARCHD_COMMAND_PERSIST
SEARCHD_COMMAND_STATUS
)
type Filter int
// Filter values from sphinxclient.h
const (
SPH_FILTER_VALUES Filter = iota
SPH_FILTER_RANGE
SPH_FILTER_FLOATRANGE
)
// Define true/false values from sphinxclient.h
const (
SPH_FALSE = iota
SPH_TRUE
)