forked from tjake/thrudb-java
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Thrudex.thrift
104 lines (84 loc) · 2.73 KB
/
Thrudex.thrift
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
namespace cpp thrudex
namespace java org.thrudb.thrudex
namespace php Thrudex
namespace rb Thrudex
namespace perl Thrudex
exception ThrudexException
{
1: string what
}
enum Analyzer
{
STANDARD = 1, # org.apache.lucene.analysis.standard.StandardAnalyzer
KEYWORD = 2, # org.apache.lucene.analysis.KeywordAnalyzer
SIMPLE = 3, # org.apache.lucene.analysis.SimpleAnalyzer
STOP = 4, # org.apache.lucene.analysis.StopAnalyzer
WHITESPACE = 5 # org.apache.lucene.analysis.WhitespaceAnalyzer
}
enum SortType # see types in org.apache.lucene.search.SortField
{
AUTO = 1,
DOUBLE = 2,
FLOAT = 3,
INT = 4,
LONG = 5,
SHORT = 6,
STRING = 7
}
struct Field
{
1: string key,
2: string value,
3: bool store = 1,
4: i32 weight = 1,
5: bool sortable = 0,
6: Analyzer analyzer = STANDARD
}
struct Document
{
1: string index
2: string key,
3: list<Field> fields,
4: string payload,
5: i32 weight = 1
}
struct Element
{
1:string index,
2:string key,
3:string payload
}
struct SearchQuery
{
1: string index,
2: string query,
3: string sortby,
4: i32 limit = 10,
5: i32 offset = 0,
6: bool desc = 0,
7: bool randomize = 0,
8: bool payload = 0,
9: Analyzer defaultAnalyzer = STANDARD,
10: map<string, Analyzer> fieldAnalyzers = {},
11: SortType sortType = AUTO
}
struct SearchResponse
{
1: i32 total = -1, #total across the entire index
2: list<Element> elements,
3: ThrudexException ex
}
service Thrudex
{
void ping(),
list<string> getIndices(),
void put (1:Document d) throws(1:ThrudexException ex),
void remove(1:Element e) throws(1:ThrudexException ex),
SearchResponse search(1:SearchQuery s) throws(1:ThrudexException ex),
list<ThrudexException> putList (1:list<Document> documents) throws(1:ThrudexException ex),
list<ThrudexException> removeList(1:list<Element> elements) throws(1:ThrudexException ex),
list<SearchResponse> searchList(1:list<SearchQuery> q) throws(1:ThrudexException ex)
# the following is protected api, it us only to be used by administrative
# programs and people who really know what they're doing.
string admin(1:string op, 2:string data) throws(1:ThrudexException ex)
}