From b54f9a54233eb44755208f3fefca75ae9a0f69cb Mon Sep 17 00:00:00 2001 From: Antonio Nikishaev Date: Wed, 20 Mar 2019 17:11:14 +0400 Subject: [PATCH 1/3] generalised search req/resp --- src/riak_search.proto | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/src/riak_search.proto b/src/riak_search.proto index 97541feb..c70af2f4 100644 --- a/src/riak_search.proto +++ b/src/riak_search.proto @@ -22,9 +22,11 @@ */ /* -** Revision: 1.4 +** Revision: 1.5 */ +syntax = "proto3"; + import "riak.proto"; // java package specifiers @@ -53,3 +55,33 @@ message RpbSearchQueryResp { optional float max_score = 2; // Maximum score optional uint32 num_found = 3; // Number of results } + +message RpbSearch2QueryReq { + // query, in any solr syntax + oneof query { + string str = 1; + string json = 3; + } + + required string index = 2; + + // optional features, automatically turned on if any kv is present + map stats = 4; // e. g. { fields: foo } + map facet = 5; + map group = 6; +} + +message RpbSearch2QueryResp { + // "response" + repeated RpbSearchDoc docs = 1; + optional float max_score = 2; // Maximum score + optional uint32 num_found = 3; // Number of results + + // everything below is raw json, because the shape is not fixed + optional string stats = 4; + optional string facets = 5; + optional string facet_counts = 6; + optional string grouped = 7; + optional string more_like_this = 8; +} + From 9cf69767ddc94d267572c745626fcf7e472d9482 Mon Sep 17 00:00:00 2001 From: Antonio Nikishaev Date: Wed, 20 Mar 2019 18:08:54 +0400 Subject: [PATCH 2/3] RpbSearch2Query{Req,Resp} can be backward-compatible --- src/riak_search.proto | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/src/riak_search.proto b/src/riak_search.proto index c70af2f4..28c3a8e7 100644 --- a/src/riak_search.proto +++ b/src/riak_search.proto @@ -38,8 +38,14 @@ message RpbSearchDoc { } message RpbSearchQueryReq { - required bytes q = 1; // Query string - required bytes index = 2; // Index + // query, in any solr syntax + oneof query { + string str = 1; + string json = 11; + } + + required string index = 2; // Index + optional uint32 rows = 3; // Limit rows optional uint32 start = 4; // Starting offset optional bytes sort = 5; // Sort order @@ -48,34 +54,18 @@ message RpbSearchQueryReq { optional bytes op = 8; // Default op repeated bytes fl = 9; // Return fields limit (for ids only, generally) optional bytes presort = 10; // Presort (key / score) + + // optional features, automatically turned on if any kv is present + map stats = 12; // e. g. { fields: foo } + map facet = 13; + map group = 14; + } message RpbSearchQueryResp { repeated RpbSearchDoc docs = 1; // Result documents optional float max_score = 2; // Maximum score optional uint32 num_found = 3; // Number of results -} - -message RpbSearch2QueryReq { - // query, in any solr syntax - oneof query { - string str = 1; - string json = 3; - } - - required string index = 2; - - // optional features, automatically turned on if any kv is present - map stats = 4; // e. g. { fields: foo } - map facet = 5; - map group = 6; -} - -message RpbSearch2QueryResp { - // "response" - repeated RpbSearchDoc docs = 1; - optional float max_score = 2; // Maximum score - optional uint32 num_found = 3; // Number of results // everything below is raw json, because the shape is not fixed optional string stats = 4; From a6cfdfe619331f78cd950cb064107e5f1190dfdf Mon Sep 17 00:00:00 2001 From: Antonio Nikishaev Date: Wed, 20 Mar 2019 18:39:17 +0400 Subject: [PATCH 3/3] RpbSearchQueryReq per-field params --- src/riak_search.proto | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/riak_search.proto b/src/riak_search.proto index 28c3a8e7..6d167069 100644 --- a/src/riak_search.proto +++ b/src/riak_search.proto @@ -55,8 +55,11 @@ message RpbSearchQueryReq { repeated bytes fl = 9; // Return fields limit (for ids only, generally) optional bytes presort = 10; // Presort (key / score) + // per-field parameters + map per_field = 15; // e. g. { ts.range.gap: 2 MINUTES } + // optional features, automatically turned on if any kv is present - map stats = 12; // e. g. { fields: foo } + map stats = 12; // e. g. { fields: foo } map facet = 13; map group = 14;