@@ -14,60 +14,32 @@ namespace nebula {
14
14
class TextSearchArgument final {
15
15
public:
16
16
static TextSearchArgument* make (ObjectPool* pool,
17
- const std::string& from ,
18
- const std::string& prop ,
19
- const std::string& val ) {
20
- return pool->makeAndAdd <TextSearchArgument>(from, prop, val );
17
+ const std::string& index ,
18
+ const std::string& query ,
19
+ const std::vector<std:: string>& props ) {
20
+ return pool->makeAndAdd <TextSearchArgument>(index , query, props );
21
21
}
22
22
23
23
~TextSearchArgument () = default ;
24
24
25
- void setVal ( const std::string& val ) {
26
- val_ = val ;
25
+ std::string& index ( ) {
26
+ return index_ ;
27
27
}
28
28
29
- const std::string& from () {
30
- return from_ ;
29
+ std::string& query () {
30
+ return query_ ;
31
31
}
32
32
33
- const std::string& prop () {
34
- return prop_ ;
33
+ std::vector<std:: string>& props () {
34
+ return props_ ;
35
35
}
36
36
37
- const std::string& val () const {
38
- return val_ ;
37
+ int64_t & offset () {
38
+ return offset_ ;
39
39
}
40
40
41
- void setOP (const std::string& op) {
42
- op_ = op;
43
- }
44
-
45
- const std::string& op () const {
46
- return op_;
47
- }
48
-
49
- void setFuzziness (int32_t fuzz) {
50
- fuzziness_ = fuzz;
51
- }
52
-
53
- int32_t fuzziness () {
54
- return fuzziness_;
55
- }
56
-
57
- void setLimit (int32_t limit) {
58
- limit_ = limit;
59
- }
60
-
61
- int32_t limit () {
62
- return limit_;
63
- }
64
-
65
- void setTimeout (int32_t timeout) {
66
- timeout_ = timeout;
67
- }
68
-
69
- int32_t timeout () {
70
- return timeout_;
41
+ int64_t & count () {
42
+ return count_;
71
43
}
72
44
73
45
bool operator ==(const TextSearchArgument& rhs) const ;
@@ -76,35 +48,23 @@ class TextSearchArgument final {
76
48
77
49
private:
78
50
friend ObjectPool;
79
- TextSearchArgument (const std::string& from, const std::string& prop, const std::string& val)
80
- : from_(from), prop_(prop), val_(val) {}
51
+ TextSearchArgument (const std::string& index,
52
+ const std::string& query,
53
+ const std::vector<std::string>& props)
54
+ : index_(index), query_(query), props_(props) {}
81
55
82
56
private:
83
- std::string from_;
84
- std::string prop_;
85
- std::string val_;
86
- std::string op_;
87
- int32_t fuzziness_{-2 };
88
- int32_t limit_{10000 };
89
- int32_t timeout_{-1 };
57
+ std::string index_;
58
+ std::string query_;
59
+ std::vector<std::string> props_;
60
+ int64_t count_ = 0 ;
61
+ int64_t offset_ = 0 ;
90
62
};
91
63
92
64
class TextSearchExpression : public Expression {
93
65
public:
94
- static TextSearchExpression* makePrefix (ObjectPool* pool, TextSearchArgument* arg) {
95
- return pool->makeAndAdd <TextSearchExpression>(pool, Kind::kTSPrefix , arg);
96
- }
97
-
98
- static TextSearchExpression* makeWildcard (ObjectPool* pool, TextSearchArgument* arg) {
99
- return pool->makeAndAdd <TextSearchExpression>(pool, Kind::kTSWildcard , arg);
100
- }
101
-
102
- static TextSearchExpression* makeRegexp (ObjectPool* pool, TextSearchArgument* arg) {
103
- return pool->makeAndAdd <TextSearchExpression>(pool, Kind::kTSRegexp , arg);
104
- }
105
-
106
- static TextSearchExpression* makeFuzzy (ObjectPool* pool, TextSearchArgument* arg) {
107
- return pool->makeAndAdd <TextSearchExpression>(pool, Kind::kTSFuzzy , arg);
66
+ static TextSearchExpression* makeQuery (ObjectPool* pool, TextSearchArgument* arg) {
67
+ return pool->makeAndAdd <TextSearchExpression>(pool, Kind::kESQUERY , arg);
108
68
}
109
69
110
70
static TextSearchExpression* make (ObjectPool* pool, Kind kind, TextSearchArgument* arg) {
@@ -125,7 +85,9 @@ class TextSearchExpression : public Expression {
125
85
std::string toString () const override ;
126
86
127
87
Expression* clone () const override {
128
- auto arg = TextSearchArgument::make (pool_, arg_->from (), arg_->prop (), arg_->val ());
88
+ auto arg = TextSearchArgument::make (pool_, arg_->index (), arg_->query (), arg_->props ());
89
+ arg->count () = arg_->count ();
90
+ arg->offset () = arg_->offset ();
129
91
return TextSearchExpression::make (pool_, kind_, arg);
130
92
}
131
93
0 commit comments