Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions api/seqproxyapi/v1/seq_proxy_api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ service SeqProxyApi {
body: "*"
};
}

rpc OnePhaseSearch(SearchRequest) returns (ComplexSearchResponse) {
option (google.api.http) = {
post: "/one-phase-search"
body: "*"
};
}
}

// Custom error code, returned by seq-db proxy.
Expand Down
71 changes: 66 additions & 5 deletions api/storeapi/store_api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ service StoreApi {
rpc Fetch(FetchRequest) returns (stream BinaryData) {}

rpc Status(StatusRequest) returns (StatusResponse) {}

rpc OnePhaseSearch(OnePhaseSearchRequest) returns (stream OnePhaseSearchResponse) {}
}

message BulkRequest {
Expand Down Expand Up @@ -145,6 +147,7 @@ enum SearchErrorCode {
TOO_MANY_FRACTION_TOKENS = 6;
TOO_MANY_FIELD_VALUES = 7;
MEMORY_LIMIT_EXCEEDED = 8;
DISABLED = 9;
}

message StartAsyncSearchRequest {
Expand Down Expand Up @@ -244,12 +247,13 @@ message IdWithHint {
string hint = 2;
}

message FieldsFilter {
repeated string fields = 1;
// see seqproxyapi.FetchRequest.FieldsFilter.allow_list for details.
bool allow_list = 2;
}

message FetchRequest {
message FieldsFilter {
repeated string fields = 1;
// see seqproxyapi.FetchRequest.FieldsFilter.allow_list for details.
bool allow_list = 2;
}
repeated string ids = 1;
bool explain = 3;
repeated IdWithHint ids_with_hints = 4;
Expand All @@ -264,3 +268,60 @@ message StatusRequest {}
message StatusResponse {
google.protobuf.Timestamp oldest_time = 1;
}

message OnePhaseSearchRequest {
string query = 1;
google.protobuf.Timestamp from = 2;
google.protobuf.Timestamp to = 3;
int64 size = 4;
int64 offset = 5;
bool explain = 6;
bool with_total = 7;
Order order = 8;
string offset_id = 9;
FieldsFilter fields_filter = 10;
}

message OnePhaseSearchResponse {
oneof ResponseType {
Header header = 1;
RecordsBatch batch = 2;
}
}

message Header {
Metadata metadata = 1;
repeated Typing typing = 2;
}

message Metadata {
uint64 total = 1;
SearchErrorCode code = 2;
repeated string errors = 3;
optional ExplainEntry explain = 4;
}

enum DataType {
BYTES = 0;
RAW_DOCUMENT = 1;
STRING = 2;
UINT32 = 3;
UINT64 = 4;
INT32 = 5;
INT64 = 6;
FLOAT64 = 7;
// TODO: array data types: StringArray, Uin64Array, Float64Array etc.
}

message Typing {
string title = 1;
DataType type = 2;
}

message RecordsBatch {
repeated Record records = 1;
}

message Record {
repeated bytes raw_data = 1;
}
4 changes: 4 additions & 0 deletions cmd/seq-db/seq-db.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ func startProxy(
EsVersion: cfg.API.ESVersion,
GatewayAddr: cfg.Address.GRPC,
AsyncSearchMaxDocumentsPerRequest: cfg.AsyncSearch.MaxDocumentsPerRequest,
EnableOnePhaseSearch: cfg.Experimental.EnableOnePhaseSearch,
},
Search: search.Config{
HotStores: hotStores,
Expand Down Expand Up @@ -318,6 +319,9 @@ func startStore(
To: cfg.Filtering.To,
From: cfg.Filtering.From,
},
OnePhaseSearch: storeapi.OnePhaseSearchConfig{
Enabled: cfg.Experimental.EnableOnePhaseSearch,
},
},
SkipMaskManagerConfig: skipmaskmanager.Config{
DataDir: cfg.SkipMaskManager.DataDir,
Expand Down
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,8 @@ type Config struct {
// Specify how many tokens can be checked using regular expressions.
// If zero then there is no limit.
MaxRegexTokensCheck int `config:"max_regex_tokens_check" default:"0"`
// EnableOnePhaseSearch enanles experimental one phase search method that supports new query engine.
EnableOnePhaseSearch bool `config:"enable_one_phase_search"`
} `config:"experimental"`
}

Expand Down
1 change: 1 addition & 0 deletions consts/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,5 @@ var (
ErrTooManyFractionTokens = errors.New("aggregation has too many fraction tokens")
ErrTooManyFractionsHit = errors.New("too many fractions hit")
ErrMemoryLimitExceeded = errors.New("memory limit exceeded")
ErrResourceDisabled = errors.New("resource is disabled")
)
Loading
Loading