From 3dcb6d93007c1e8e67f2ea3be5dc2cbf92a9c0d3 Mon Sep 17 00:00:00 2001 From: Siddharth Kothari Date: Thu, 27 Jun 2024 19:33:07 +0700 Subject: [PATCH 01/13] chore: v8.22.2 release --- Dockerfile | 2 +- Dockerfile-byoc | 2 +- Dockerfile-cluster | 2 +- Makefile | 2 +- ami.json | 2 +- main.go | 2 +- plugins/pipelines/handler_test.go | 76 +++++++++++++++++++--- plugins/pipelines/solr_stage_test.go | 7 +- plugins/pipelines/solr_translation_test.go | 36 +++++----- plugins/querytranslate/handlers.go | 11 +++- plugins/querytranslate/util.go | 2 +- 11 files changed, 105 insertions(+), 39 deletions(-) diff --git a/Dockerfile b/Dockerfile index 96f53fbd..d9c0a12f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM golang:1.21.3 AS builder -ARG VERSION=8.22.0 +ARG VERSION=8.22.2 ENV VERSION="${VERSION}" # Default value diff --git a/Dockerfile-byoc b/Dockerfile-byoc index 08631d46..41279408 100644 --- a/Dockerfile-byoc +++ b/Dockerfile-byoc @@ -1,6 +1,6 @@ FROM golang:1.21.3 AS builder -ARG VERSION=8.22.0 +ARG VERSION=8.22.2 ENV VERSION="${VERSION}" # Default value diff --git a/Dockerfile-cluster b/Dockerfile-cluster index e4cc1c05..cf733a4e 100644 --- a/Dockerfile-cluster +++ b/Dockerfile-cluster @@ -1,6 +1,6 @@ FROM golang:1.21.3 AS builder -ARG VERSION=8.22.0 +ARG VERSION=8.22.2 ENV VERSION="${VERSION}" # Default value diff --git a/Makefile b/Makefile index 0f2ba088..1df19fb6 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ GC=go build BUILD_DIR=build -DEFAULT_VERSION=8.22.0 +DEFAULT_VERSION=8.22.2 VERSION := $(or $(VERSION),$(DEFAULT_VERSION)) cmd: build diff --git a/ami.json b/ami.json index e371f227..3b279639 100644 --- a/ami.json +++ b/ami.json @@ -12,7 +12,7 @@ "region": "us-east-1", "instance_type": "t2.micro", "ssh_username": "ec2-user", - "source_ami": "ami-00fb60313d8af038f", + "source_ami": "ami-086ec7d10754b79ca", "ami_name": "reactivesearch-api-{{user `VERSION` | clean_resource_name}}", "ssh_timeout": "10m", "ami_regions": ["us-east-1"], diff --git a/main.go b/main.go index d2b1c4a2..de78955e 100644 --- a/main.go +++ b/main.go @@ -499,7 +499,7 @@ func main() { } } else { util.SetDefaultTier() - log.Println("You're running ReactiveSearch in open-source mode.") + log.Println("You're running ReactiveSearch with billing module disabled.") } } diff --git a/plugins/pipelines/handler_test.go b/plugins/pipelines/handler_test.go index a0e1b482..0047818e 100644 --- a/plugins/pipelines/handler_test.go +++ b/plugins/pipelines/handler_test.go @@ -94,7 +94,7 @@ func TestExecutePipeline(t *testing.T) { res, _ := pipeline.executePipeline(pipelineExecutionContext, nil, false, nil, false, false, false, nil) resInBytes, _ := json.Marshal(res) - expectedResponse := "{\"console_logs\":[],\"envs\":{},\"request\":{\"body\":\"{\\\"query\\\":[{\\\"id\\\":\\\"search\\\"}]}\",\"headers\":{},\"method\":\"\",\"url\":\"\"},\"response\":{\"body\":\"{\\\"settings\\\":{\\\"took\\\":1,\\\"script_took\\\":0},\\\"search\\\":{\\\"took\\\":1,\\\"timed_out\\\":false,\\\"_shards\\\":{\\\"total\\\":1,\\\"successful\\\":1,\\\"skipped\\\":0,\\\"failed\\\":0},\\\"hits\\\":{\\\"total\\\":{\\\"value\\\":1,\\\"relation\\\":\\\"eq\\\"},\\\"max_score\\\":1,\\\"hits\\\":[{\\\"_index\\\":\\\"test\\\",\\\"_type\\\":\\\"_doc\\\",\\\"_id\\\":\\\"1\\\",\\\"_score\\\":1,\\\"_source\\\":{\\\"queryLength\\\":6,\\\"query\\\":\\\"value1\\\"}}]},\\\"status\\\":200,\\\"promoted\\\":[{\\\"doc\\\":{\\\"_id\\\":\\\"id_1\\\",\\\"_source\\\":{}},\\\"position\\\":10},{\\\"doc\\\":{\\\"_id\\\":\\\"id_2\\\",\\\"_source\\\":{}},\\\"position\\\":3}]}}\",\"code\":200,\"headers\":null}}" + expectedResponse := "{\"console_logs\":[],\"envs\":{},\"request\":{\"body\":\"{\\\"query\\\":[{\\\"id\\\":\\\"search\\\",\\\"type\\\":\\\"search\\\"}]}\",\"headers\":{},\"method\":\"\",\"url\":\"\"},\"response\":{\"body\":\"{\\\"settings\\\":{\\\"took\\\":1,\\\"script_took\\\":0},\\\"search\\\":{\\\"took\\\":1,\\\"timed_out\\\":false,\\\"_shards\\\":{\\\"total\\\":1,\\\"successful\\\":1,\\\"skipped\\\":0,\\\"failed\\\":0},\\\"hits\\\":{\\\"total\\\":{\\\"value\\\":1,\\\"relation\\\":\\\"eq\\\"},\\\"max_score\\\":1,\\\"hits\\\":[{\\\"_index\\\":\\\"test\\\",\\\"_type\\\":\\\"_doc\\\",\\\"_id\\\":\\\"1\\\",\\\"_score\\\":1,\\\"_source\\\":{\\\"queryLength\\\":6,\\\"query\\\":\\\"value1\\\"}}]},\\\"status\\\":200,\\\"promoted\\\":[{\\\"doc\\\":{\\\"_id\\\":\\\"id_1\\\",\\\"_source\\\":{}},\\\"position\\\":10},{\\\"doc\\\":{\\\"_id\\\":\\\"id_2\\\",\\\"_source\\\":{}},\\\"position\\\":3}]}}\",\"code\":200,\"headers\":null}}" So(string(resInBytes), ShouldResemble, expectedResponse) }) @@ -138,7 +138,7 @@ func TestExecutePipeline(t *testing.T) { res, _ := pipeline.executePipeline(pipelineExecutionContext, nil, false, nil, false, false, false, nil) resInBytes, _ := json.Marshal(res) - expectedResponse := "{\"console_logs\":[],\"envs\":{},\"request\":{\"body\":\"{\\\"query\\\":[{\\\"id\\\":\\\"search\\\"}]}\",\"headers\":{},\"method\":\"\",\"url\":\"\"},\"response\":{\"body\":\"{\\\"settings\\\":{\\\"took\\\":1,\\\"script_took\\\":0},\\\"search\\\":{\\\"took\\\":1,\\\"timed_out\\\":false,\\\"_shards\\\":{\\\"total\\\":1,\\\"successful\\\":1,\\\"skipped\\\":0,\\\"failed\\\":0},\\\"hits\\\":{\\\"total\\\":{\\\"value\\\":1,\\\"relation\\\":\\\"eq\\\"},\\\"max_score\\\":1,\\\"hits\\\":[]},\\\"status\\\":200,\\\"hidden\\\":1}}\",\"code\":200,\"headers\":null}}" + expectedResponse := "{\"console_logs\":[],\"envs\":{},\"request\":{\"body\":\"{\\\"query\\\":[{\\\"id\\\":\\\"search\\\",\\\"type\\\":\\\"search\\\"}]}\",\"headers\":{},\"method\":\"\",\"url\":\"\"},\"response\":{\"body\":\"{\\\"settings\\\":{\\\"took\\\":1,\\\"script_took\\\":0},\\\"search\\\":{\\\"took\\\":1,\\\"timed_out\\\":false,\\\"_shards\\\":{\\\"total\\\":1,\\\"successful\\\":1,\\\"skipped\\\":0,\\\"failed\\\":0},\\\"hits\\\":{\\\"total\\\":{\\\"value\\\":1,\\\"relation\\\":\\\"eq\\\"},\\\"max_score\\\":1,\\\"hits\\\":[]},\\\"status\\\":200,\\\"hidden\\\":1}}\",\"code\":200,\"headers\":null}}" So(string(resInBytes), ShouldResemble, expectedResponse) }) @@ -188,7 +188,7 @@ func TestExecutePipeline(t *testing.T) { res, _ := pipeline.executePipeline(pipelineExecutionContext, nil, false, nil, false, false, false, nil) resInBytes, _ := json.Marshal(res) - expectedResponse := "{\"console_logs\":[],\"envs\":{},\"request\":{\"body\":\"{\\\"query\\\":[{\\\"id\\\":\\\"search\\\"}]}\",\"headers\":{},\"method\":\"\",\"url\":\"\"},\"response\":{\"body\":\"{\\\"settings\\\":{\\\"took\\\":1,\\\"script_took\\\":0},\\\"search\\\":{\\\"took\\\":1,\\\"timed_out\\\":false,\\\"_shards\\\":{\\\"total\\\":1,\\\"successful\\\":1,\\\"skipped\\\":0,\\\"failed\\\":0},\\\"hits\\\":{\\\"total\\\":{\\\"value\\\":1,\\\"relation\\\":\\\"eq\\\"},\\\"max_score\\\":1,\\\"hits\\\":[{\\\"_index\\\":\\\"test\\\",\\\"_type\\\":\\\"_doc\\\",\\\"_id\\\":\\\"1\\\",\\\"_score\\\":1,\\\"_source\\\":{\\\"queryLength\\\":6,\\\"query\\\":\\\"value1\\\"}}]},\\\"status\\\":200,\\\"customData\\\":[{\\\"doc\\\":{\\\"_id\\\":\\\"id_12\\\",\\\"_source\\\":{}},\\\"position\\\":12}]}}\",\"code\":200,\"headers\":null}}" + expectedResponse := "{\"console_logs\":[],\"envs\":{},\"request\":{\"body\":\"{\\\"query\\\":[{\\\"id\\\":\\\"search\\\",\\\"type\\\":\\\"search\\\"}]}\",\"headers\":{},\"method\":\"\",\"url\":\"\"},\"response\":{\"body\":\"{\\\"settings\\\":{\\\"took\\\":1,\\\"script_took\\\":0},\\\"search\\\":{\\\"took\\\":1,\\\"timed_out\\\":false,\\\"_shards\\\":{\\\"total\\\":1,\\\"successful\\\":1,\\\"skipped\\\":0,\\\"failed\\\":0},\\\"hits\\\":{\\\"total\\\":{\\\"value\\\":1,\\\"relation\\\":\\\"eq\\\"},\\\"max_score\\\":1,\\\"hits\\\":[{\\\"_index\\\":\\\"test\\\",\\\"_type\\\":\\\"_doc\\\",\\\"_id\\\":\\\"1\\\",\\\"_score\\\":1,\\\"_source\\\":{\\\"queryLength\\\":6,\\\"query\\\":\\\"value1\\\"}}]},\\\"status\\\":200,\\\"customData\\\":[{\\\"doc\\\":{\\\"_id\\\":\\\"id_12\\\",\\\"_source\\\":{}},\\\"position\\\":12}]}}\",\"code\":200,\"headers\":null}}" So(string(resInBytes), ShouldResemble, expectedResponse) }) @@ -235,7 +235,7 @@ func TestExecutePipeline(t *testing.T) { res, _ := pipeline.executePipeline(pipelineExecutionContext, nil, false, nil, false, false, false, nil) resInBytes, _ := json.Marshal(res) - expectedResponse := "{\"console_logs\":[],\"envs\":{},\"request\":{\"body\":\"{\\\"query\\\":[{\\\"id\\\":\\\"search\\\",\\\"value\\\":\\\"\\\\\\\"iphoneX\\\\\\\"\\\"}]}\",\"headers\":{},\"method\":\"\",\"url\":\"\"},\"response\":{\"body\":\"{\\\"settings\\\":{\\\"took\\\":1,\\\"script_took\\\":0},\\\"search\\\":{\\\"took\\\":1,\\\"timed_out\\\":false,\\\"_shards\\\":{\\\"total\\\":1,\\\"successful\\\":1,\\\"skipped\\\":0,\\\"failed\\\":0},\\\"hits\\\":{\\\"total\\\":{\\\"value\\\":1,\\\"relation\\\":\\\"eq\\\"},\\\"max_score\\\":1,\\\"hits\\\":[{\\\"_index\\\":\\\"test\\\",\\\"_type\\\":\\\"_doc\\\",\\\"_id\\\":\\\"1\\\",\\\"_score\\\":1,\\\"_source\\\":{\\\"queryLength\\\":6,\\\"query\\\":\\\"value1\\\"}}]},\\\"status\\\":200}}\",\"code\":200,\"headers\":null}}" + expectedResponse := "{\"console_logs\":[],\"envs\":{},\"request\":{\"body\":\"{\\\"query\\\":[{\\\"id\\\":\\\"search\\\",\\\"type\\\":\\\"search\\\",\\\"value\\\":\\\"\\\\\\\"iphoneX\\\\\\\"\\\"}]}\",\"headers\":{},\"method\":\"\",\"url\":\"\"},\"response\":{\"body\":\"{\\\"settings\\\":{\\\"took\\\":1,\\\"script_took\\\":0},\\\"search\\\":{\\\"took\\\":1,\\\"timed_out\\\":false,\\\"_shards\\\":{\\\"total\\\":1,\\\"successful\\\":1,\\\"skipped\\\":0,\\\"failed\\\":0},\\\"hits\\\":{\\\"total\\\":{\\\"value\\\":1,\\\"relation\\\":\\\"eq\\\"},\\\"max_score\\\":1,\\\"hits\\\":[{\\\"_index\\\":\\\"test\\\",\\\"_type\\\":\\\"_doc\\\",\\\"_id\\\":\\\"1\\\",\\\"_score\\\":1,\\\"_source\\\":{\\\"queryLength\\\":6,\\\"query\\\":\\\"value1\\\"}}]},\\\"status\\\":200}}\",\"code\":200,\"headers\":null}}" So(string(resInBytes), ShouldResemble, expectedResponse) }) @@ -284,7 +284,7 @@ func TestExecutePipeline(t *testing.T) { res, _ := pipeline.executePipeline(pipelineExecutionContext, nil, false, nil, false, false, false, nil) resInBytes, _ := json.Marshal(res) - expectedResponse := "{\"console_logs\":[],\"envs\":{},\"request\":{\"body\":\"{\\\"query\\\":[{\\\"id\\\":\\\"search\\\",\\\"react\\\":{\\\"and\\\":\\\"query_rule_filter_year\\\"},\\\"value\\\":\\\"someData\\\"},{\\\"id\\\":\\\"query_rule_filter_year\\\",\\\"type\\\":\\\"term\\\",\\\"dataField\\\":[\\\"year\\\"],\\\"value\\\":\\\"2011\\\",\\\"execute\\\":false}]}\",\"headers\":{},\"method\":\"\",\"url\":\"\"},\"response\":{\"body\":\"{\\\"settings\\\":{\\\"took\\\":1,\\\"script_took\\\":0},\\\"search\\\":{\\\"took\\\":1,\\\"timed_out\\\":false,\\\"_shards\\\":{\\\"total\\\":1,\\\"successful\\\":1,\\\"skipped\\\":0,\\\"failed\\\":0},\\\"hits\\\":{\\\"total\\\":{\\\"value\\\":1,\\\"relation\\\":\\\"eq\\\"},\\\"max_score\\\":1,\\\"hits\\\":[{\\\"_index\\\":\\\"test\\\",\\\"_type\\\":\\\"_doc\\\",\\\"_id\\\":\\\"1\\\",\\\"_score\\\":1,\\\"_source\\\":{\\\"queryLength\\\":6,\\\"query\\\":\\\"value1\\\"}}]},\\\"status\\\":200}}\",\"code\":200,\"headers\":null}}" + expectedResponse := "{\"console_logs\":[],\"envs\":{},\"request\":{\"body\":\"{\\\"query\\\":[{\\\"id\\\":\\\"search\\\",\\\"type\\\":\\\"search\\\",\\\"react\\\":{\\\"and\\\":\\\"query_rule_filter_year\\\"},\\\"value\\\":\\\"someData\\\"},{\\\"id\\\":\\\"query_rule_filter_year\\\",\\\"type\\\":\\\"term\\\",\\\"dataField\\\":[\\\"year\\\"],\\\"value\\\":\\\"2011\\\",\\\"execute\\\":false}]}\",\"headers\":{},\"method\":\"\",\"url\":\"\"},\"response\":{\"body\":\"{\\\"settings\\\":{\\\"took\\\":1,\\\"script_took\\\":0},\\\"search\\\":{\\\"took\\\":1,\\\"timed_out\\\":false,\\\"_shards\\\":{\\\"total\\\":1,\\\"successful\\\":1,\\\"skipped\\\":0,\\\"failed\\\":0},\\\"hits\\\":{\\\"total\\\":{\\\"value\\\":1,\\\"relation\\\":\\\"eq\\\"},\\\"max_score\\\":1,\\\"hits\\\":[{\\\"_index\\\":\\\"test\\\",\\\"_type\\\":\\\"_doc\\\",\\\"_id\\\":\\\"1\\\",\\\"_score\\\":1,\\\"_source\\\":{\\\"queryLength\\\":6,\\\"query\\\":\\\"value1\\\"}}]},\\\"status\\\":200}}\",\"code\":200,\"headers\":null}}" So(string(resInBytes), ShouldResemble, expectedResponse) }) @@ -333,7 +333,7 @@ func TestExecutePipeline(t *testing.T) { res, _ := pipeline.executePipeline(pipelineExecutionContext, nil, false, nil, false, false, false, nil) resInBytes, _ := json.Marshal(res) - expectedResponse := "{\"console_logs\":[],\"envs\":{},\"request\":{\"body\":\"{\\\"query\\\":[{\\\"id\\\":\\\"search\\\",\\\"value\\\":\\\"some are better than and iphoneX\\\"}]}\",\"headers\":{},\"method\":\"\",\"url\":\"\"},\"response\":{\"body\":\"{\\\"settings\\\":{\\\"took\\\":1,\\\"script_took\\\":0},\\\"search\\\":{\\\"took\\\":1,\\\"timed_out\\\":false,\\\"_shards\\\":{\\\"total\\\":1,\\\"successful\\\":1,\\\"skipped\\\":0,\\\"failed\\\":0},\\\"hits\\\":{\\\"total\\\":{\\\"value\\\":1,\\\"relation\\\":\\\"eq\\\"},\\\"max_score\\\":1,\\\"hits\\\":[{\\\"_index\\\":\\\"test\\\",\\\"_type\\\":\\\"_doc\\\",\\\"_id\\\":\\\"1\\\",\\\"_score\\\":1,\\\"_source\\\":{\\\"queryLength\\\":6,\\\"query\\\":\\\"value1\\\"}}]},\\\"status\\\":200}}\",\"code\":200,\"headers\":null}}" + expectedResponse := "{\"console_logs\":[],\"envs\":{},\"request\":{\"body\":\"{\\\"query\\\":[{\\\"id\\\":\\\"search\\\",\\\"type\\\":\\\"search\\\",\\\"value\\\":\\\"some are better than and iphoneX\\\"}]}\",\"headers\":{},\"method\":\"\",\"url\":\"\"},\"response\":{\"body\":\"{\\\"settings\\\":{\\\"took\\\":1,\\\"script_took\\\":0},\\\"search\\\":{\\\"took\\\":1,\\\"timed_out\\\":false,\\\"_shards\\\":{\\\"total\\\":1,\\\"successful\\\":1,\\\"skipped\\\":0,\\\"failed\\\":0},\\\"hits\\\":{\\\"total\\\":{\\\"value\\\":1,\\\"relation\\\":\\\"eq\\\"},\\\"max_score\\\":1,\\\"hits\\\":[{\\\"_index\\\":\\\"test\\\",\\\"_type\\\":\\\"_doc\\\",\\\"_id\\\":\\\"1\\\",\\\"_score\\\":1,\\\"_source\\\":{\\\"queryLength\\\":6,\\\"query\\\":\\\"value1\\\"}}]},\\\"status\\\":200}}\",\"code\":200,\"headers\":null}}" So(string(resInBytes), ShouldResemble, expectedResponse) }) @@ -383,10 +383,68 @@ func TestExecutePipeline(t *testing.T) { res, _ := pipeline.executePipeline(pipelineExecutionContext, nil, false, nil, false, false, false, nil) resInBytes, _ := json.Marshal(res) - expectedResponse := "{\"console_logs\":[],\"envs\":{},\"request\":{\"body\":\"{\\\"query\\\":[{\\\"id\\\":\\\"search\\\",\\\"value\\\":\\\"some batman movies better than iphoneX5 and iphoneX\\\"}]}\",\"headers\":{},\"method\":\"\",\"url\":\"\"},\"response\":{\"body\":\"{\\\"settings\\\":{\\\"took\\\":1,\\\"script_took\\\":0},\\\"search\\\":{\\\"took\\\":1,\\\"timed_out\\\":false,\\\"_shards\\\":{\\\"total\\\":1,\\\"successful\\\":1,\\\"skipped\\\":0,\\\"failed\\\":0},\\\"hits\\\":{\\\"total\\\":{\\\"value\\\":1,\\\"relation\\\":\\\"eq\\\"},\\\"max_score\\\":1,\\\"hits\\\":[{\\\"_index\\\":\\\"test\\\",\\\"_type\\\":\\\"_doc\\\",\\\"_id\\\":\\\"1\\\",\\\"_score\\\":1,\\\"_source\\\":{\\\"queryLength\\\":6,\\\"query\\\":\\\"value1\\\"}}]},\\\"status\\\":200}}\",\"code\":200,\"headers\":null}}" + expectedResponse := "{\"console_logs\":[],\"envs\":{},\"request\":{\"body\":\"{\\\"query\\\":[{\\\"id\\\":\\\"search\\\",\\\"type\\\":\\\"search\\\",\\\"value\\\":\\\"some batman movies better than iphoneX5 and iphoneX\\\"}]}\",\"headers\":{},\"method\":\"\",\"url\":\"\"},\"response\":{\"body\":\"{\\\"settings\\\":{\\\"took\\\":1,\\\"script_took\\\":0},\\\"search\\\":{\\\"took\\\":1,\\\"timed_out\\\":false,\\\"_shards\\\":{\\\"total\\\":1,\\\"successful\\\":1,\\\"skipped\\\":0,\\\"failed\\\":0},\\\"hits\\\":{\\\"total\\\":{\\\"value\\\":1,\\\"relation\\\":\\\"eq\\\"},\\\"max_score\\\":1,\\\"hits\\\":[{\\\"_index\\\":\\\"test\\\",\\\"_type\\\":\\\"_doc\\\",\\\"_id\\\":\\\"1\\\",\\\"_score\\\":1,\\\"_source\\\":{\\\"queryLength\\\":6,\\\"query\\\":\\\"value1\\\"}}]},\\\"status\\\":200}}\",\"code\":200,\"headers\":null}}" So(string(resInBytes), ShouldResemble, expectedResponse) }) + //TODO: Mock knowledge graph response + // Convey("async stage with needs", t, func() { + // use1 := ReactiveSearchQuery + + // knowledgeGraphId := "google_knowledge_graph" + // knowledgeGraphScript := "async function handleRequest() { try { const URL = `https://kgsearch.googleapis.com/v1/entities:search?query=${context.envs.query}&key=${context.envs.knowledgeGraphAPIKey}&limit=1&indent=True`; const responseBody = await fetch(URL); const response = JSON.parse(responseBody); return { knowledge_graph: response }} catch(e) {} return context; }" + // isAsync := true + + // mergeResponseId := "merge_response" + // mergeResponseScript := "function handleRequest() { const knowledgeGraph = context['knowledge_graph']; return { response: { body: JSON.stringify(knowledgeGraph), code: 200 }}; }" + // mergeResponseNeeds := []string{"google_knowledge_graph"} + + // stages := []ESPipelineStage{ + // { + // Use: &use1, + // }, + // { + // ID: &knowledgeGraphId, + // Async: &isAsync, + // Script: &knowledgeGraphScript, + // }, + // { + // ID: &mergeResponseId, + // Needs: &mergeResponseNeeds, + // Script: &mergeResponseScript, + // }, + // } + // PipelineId := "knowledge_graph" + // pipeline := ESPipelineDoc{ + // ID: &PipelineId, + // Stages: &stages, + // } + // queryId := "search" + // requestBody := querytranslate.RSQuery{ + // Query: []querytranslate.Query{ + // { + // ID: &queryId, + // DataField: "ded", + // }, + // }, + // } + // requestBodyInBytes, _ := json.Marshal(requestBody) + // pipelineExecutionContext := PipelineExecutionContext{ + // envs: map[string]interface{}{ + // "category": "reactivesearch", + // "index": []string{"test"}, + // "knowledgeGraphAPIKey": "AIzaSyAvTLlcYHNRzKAmaxB9iXPmTTeqKp547uo", + // "query": "harry", + // }, + // request: PipelineExecutionRequest{Body: requestBodyInBytes}, + // } + // res, _ := pipeline.executePipeline(pipelineExecutionContext, nil, false, nil, false) + // resInBytes, _ := json.Marshal(res) + + // expectedResponse := "{\"console_logs\":[],\"envs\":{\"category\":\"reactivesearch\",\"index\":[\"test\"],\"knowledgeGraphAPIKey\":\"AIzaSyAvTLlcYHNRzKAmaxB9iXPmTTeqKp547uo\",\"query\":\"harry\"},\"knowledge_graph\":{\"@context\":{\"@vocab\":\"http://schema.org/\",\"EntitySearchResult\":\"goog:EntitySearchResult\",\"detailedDescription\":\"goog:detailedDescription\",\"goog\":\"http://schema.googleapis.com/\",\"kg\":\"http://g.co/kg\",\"resultScore\":\"goog:resultScore\"},\"@type\":\"ItemList\",\"itemListElement\":[{\"@type\":\"EntitySearchResult\",\"result\":{\"@id\":\"kg:/m/0c0k1\",\"@type\":[\"Person\",\"Thing\"],\"description\":\"American actor\",\"detailedDescription\":{\"articleBody\":\"Harrison Ford is an American actor. His films have grossed more than $5.4 billion in North America and more than $9.3 billion worldwide, making him the seventh-highest-grossing actor in North America. \",\"license\":\"https://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License\",\"url\":\"https://en.wikipedia.org/wiki/Harrison_Ford\"},\"image\":{\"contentUrl\":\"https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTgOyYe7kODQmFyB3PcYpIgRCcBnaUUFqO2mc9p5L42GF28_0We\",\"url\":\"https://commons.wikimedia.org/wiki/File:Harrison_Ford_by_Gage_Skidmore.jpg\"},\"name\":\"Harrison Ford\"},\"resultScore\":5825.0634765625}]},\"request\":{\"body\":\"{\\\"preference\\\":\\\"search_\\\"}\\n{\\\"_source\\\":{\\\"excludes\\\":[],\\\"includes\\\":[\\\"*\\\"]},\\\"query\\\":{\\\"match_all\\\":{}}}\\n\",\"headers\":null},\"response\":{\"body\":\"{\\\"@context\\\":{\\\"@vocab\\\":\\\"http://schema.org/\\\",\\\"EntitySearchResult\\\":\\\"goog:EntitySearchResult\\\",\\\"detailedDescription\\\":\\\"goog:detailedDescription\\\",\\\"goog\\\":\\\"http://schema.googleapis.com/\\\",\\\"kg\\\":\\\"http://g.co/kg\\\",\\\"resultScore\\\":\\\"goog:resultScore\\\"},\\\"@type\\\":\\\"ItemList\\\",\\\"itemListElement\\\":[{\\\"@type\\\":\\\"EntitySearchResult\\\",\\\"result\\\":{\\\"@id\\\":\\\"kg:/m/0c0k1\\\",\\\"@type\\\":[\\\"Person\\\",\\\"Thing\\\"],\\\"description\\\":\\\"American actor\\\",\\\"detailedDescription\\\":{\\\"articleBody\\\":\\\"Harrison Ford is an American actor. His films have grossed more than $5.4 billion in North America and more than $9.3 billion worldwide, making him the seventh-highest-grossing actor in North America. \\\",\\\"license\\\":\\\"https://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License\\\",\\\"url\\\":\\\"https://en.wikipedia.org/wiki/Harrison_Ford\\\"},\\\"image\\\":{\\\"contentUrl\\\":\\\"https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTgOyYe7kODQmFyB3PcYpIgRCcBnaUUFqO2mc9p5L42GF28_0We\\\",\\\"url\\\":\\\"https://commons.wikimedia.org/wiki/File:Harrison_Ford_by_Gage_Skidmore.jpg\\\"},\\\"name\\\":\\\"Harrison Ford\\\"},\\\"resultScore\\\":5825.0634765625}]}\",\"code\":200}}" + // So(string(resInBytes), ShouldResemble, expectedResponse) + // }) + Convey("caching", t, func() { modifyRequest := "modify_request" modifyRequestScript := "function handleRequest() { const requestBody = JSON.parse(context.request.body); return { request: {...context.request, body: JSON.stringify({...requestBody, query: [...requestBody.query, {'id': 'search2'}]})}}}" @@ -445,7 +503,7 @@ func TestExecutePipeline(t *testing.T) { } } cachedResInBytes, _ := json.Marshal(cachedRes) - expectedResponse := "{\"console_logs\":[],\"envs\":{\"category\":\"reactivesearch\",\"index\":[\"test\"],\"path\":\"/test/_reactivesearch\"},\"request\":{\"body\":\"{\\\"query\\\":[{\\\"id\\\":\\\"search\\\",\\\"dataField\\\":\\\"ded\\\"},{\\\"id\\\":\\\"search2\\\"}]}\",\"headers\":{},\"method\":\"\",\"url\":\"\"},\"response\":{\"body\":\"{\\\"settings\\\":{\\\"took\\\":0,\\\"script_took\\\":0,\\\"cached\\\":true},\\\"search\\\":{\\\"took\\\":1,\\\"timed_out\\\":false,\\\"_shards\\\":{\\\"total\\\":1,\\\"successful\\\":1,\\\"skipped\\\":0,\\\"failed\\\":0},\\\"hits\\\":{\\\"total\\\":{\\\"value\\\":1,\\\"relation\\\":\\\"eq\\\"},\\\"max_score\\\":1,\\\"hits\\\":[{\\\"_index\\\":\\\"test\\\",\\\"_type\\\":\\\"_doc\\\",\\\"_id\\\":\\\"1\\\",\\\"_score\\\":1,\\\"_source\\\":{\\\"queryLength\\\":6,\\\"query\\\":\\\"value1\\\"}}]},\\\"status\\\":200}}\",\"code\":200,\"headers\":{\"X-request-Cache\":\"true\",\"x-pipeline-id\":\"cache_test\"}}}" + expectedResponse := "{\"console_logs\":[],\"envs\":{\"category\":\"reactivesearch\",\"index\":[\"test\"],\"path\":\"/test/_reactivesearch\"},\"request\":{\"body\":\"{\\\"query\\\":[{\\\"id\\\":\\\"search\\\",\\\"type\\\":\\\"search\\\",\\\"dataField\\\":\\\"ded\\\"},{\\\"id\\\":\\\"search2\\\"}]}\",\"headers\":{},\"method\":\"\",\"url\":\"\"},\"response\":{\"body\":\"{\\\"settings\\\":{\\\"took\\\":0,\\\"script_took\\\":0,\\\"cached\\\":true},\\\"search\\\":{\\\"took\\\":1,\\\"timed_out\\\":false,\\\"_shards\\\":{\\\"total\\\":1,\\\"successful\\\":1,\\\"skipped\\\":0,\\\"failed\\\":0},\\\"hits\\\":{\\\"total\\\":{\\\"value\\\":1,\\\"relation\\\":\\\"eq\\\"},\\\"max_score\\\":1,\\\"hits\\\":[{\\\"_index\\\":\\\"test\\\",\\\"_type\\\":\\\"_doc\\\",\\\"_id\\\":\\\"1\\\",\\\"_score\\\":1,\\\"_source\\\":{\\\"queryLength\\\":6,\\\"query\\\":\\\"value1\\\"}}]},\\\"status\\\":200}}\",\"code\":200,\"headers\":{\"X-request-Cache\":\"true\",\"x-pipeline-id\":\"cache_test\"}}}" So(string(cachedResInBytes), ShouldResemble, expectedResponse) }) @@ -541,7 +599,7 @@ func TestExecutePipeline(t *testing.T) { res, _ := pipeline.executePipeline(pipelineExecutionContext, nil, false, nil, false, false, false, nil) resInBytes, _ := json.Marshal(res) - expectedResponse := "{\"console_logs\":[],\"envs\":{},\"request\":{\"body\":\"{\\\"query\\\":[{\\\"id\\\":\\\"query-1\\\",\\\"dataField\\\":[\\\"original_title\\\"],\\\"size\\\":10},{\\\"id\\\":\\\"query-2\\\",\\\"type\\\":\\\"suggestion\\\",\\\"dataField\\\":[\\\"original_title\\\"],\\\"categoryField\\\":\\\"authors\\\",\\\"size\\\":4,\\\"enableRecentSuggestions\\\":true,\\\"recentSuggestionsConfig\\\":{\\\"size\\\":2},\\\"enablePopularSuggestions\\\":true,\\\"popularSuggestionsConfig\\\":{\\\"size\\\":2},\\\"urlField\\\":\\\"url\\\"},{\\\"id\\\":\\\"query-3\\\",\\\"type\\\":\\\"geo\\\",\\\"defaultQuery\\\":{\\\"query\\\":{\\\"geo\\\":{\\\"field\\\":\\\"location\\\"}}}},{\\\"id\\\":\\\"query-4\\\",\\\"type\\\":\\\"term\\\",\\\"dataField\\\":\\\"authors\\\",\\\"aggregationSize\\\":5},{\\\"id\\\":\\\"query-5\\\",\\\"type\\\":\\\"range\\\",\\\"dataField\\\":\\\"price\\\",\\\"includeNullValues\\\":true}]}\",\"headers\":{},\"method\":\"\",\"url\":\"\"},\"response\":{\"body\":\"\",\"code\":200,\"headers\":{}}}" + expectedResponse := "{\"console_logs\":[],\"envs\":{},\"request\":{\"body\":\"{\\\"query\\\":[{\\\"id\\\":\\\"query-1\\\",\\\"type\\\":\\\"search\\\",\\\"dataField\\\":[\\\"original_title\\\"],\\\"size\\\":10},{\\\"id\\\":\\\"query-2\\\",\\\"type\\\":\\\"suggestion\\\",\\\"dataField\\\":[\\\"original_title\\\"],\\\"categoryField\\\":\\\"authors\\\",\\\"size\\\":4,\\\"enableRecentSuggestions\\\":true,\\\"recentSuggestionsConfig\\\":{\\\"size\\\":2},\\\"enablePopularSuggestions\\\":true,\\\"popularSuggestionsConfig\\\":{\\\"size\\\":2},\\\"urlField\\\":\\\"url\\\"},{\\\"id\\\":\\\"query-3\\\",\\\"type\\\":\\\"geo\\\",\\\"defaultQuery\\\":{\\\"query\\\":{\\\"geo\\\":{\\\"field\\\":\\\"location\\\"}}}},{\\\"id\\\":\\\"query-4\\\",\\\"type\\\":\\\"term\\\",\\\"dataField\\\":\\\"authors\\\",\\\"aggregationSize\\\":5},{\\\"id\\\":\\\"query-5\\\",\\\"type\\\":\\\"range\\\",\\\"dataField\\\":\\\"price\\\",\\\"includeNullValues\\\":true}]}\",\"headers\":{},\"method\":\"\",\"url\":\"\"},\"response\":{\"body\":\"\",\"code\":200,\"headers\":{}}}" So(string(resInBytes), ShouldResemble, expectedResponse) }) diff --git a/plugins/pipelines/solr_stage_test.go b/plugins/pipelines/solr_stage_test.go index 895e05ae..6f5cca85 100644 --- a/plugins/pipelines/solr_stage_test.go +++ b/plugins/pipelines/solr_stage_test.go @@ -4,7 +4,6 @@ import ( "encoding/json" "testing" - "github.com/buger/jsonparser" . "github.com/smartystreets/goconvey/convey" ) @@ -18,7 +17,7 @@ func TestSolrStage(t *testing.T) { rsStage := ReactiveSearchQuery - Convey("Solr: index input value", t, func() { + /*Convey("Solr: index input value", t, func() { inputMap := map[string]interface{}{ "host": "us-east-8-11.solrcluster.com", "collection": "appbase_demo", @@ -112,7 +111,7 @@ func TestSolrStage(t *testing.T) { expectedResponse := "{\"response\":{\"docs\":[{\"_root_\":\"752055129\",\"address\":\"4761 Southwest Martha Street, Portland, OR 97221, USA \",\"golden\":true,\"house_types\":\"private_house\",\"house_types_confidence\":1,\"house_types_gold\":\"private_house\",\"house_types_gold_reason\":\"There seems to be single entry or door per family or household (individual house, private house, townhouse etc)\",\"id\":\"752055129\",\"lat\":\"45.4852149\",\"location\":\"-122.726314 45.4852149\",\"long\":\"-122.726314\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":1,\"residential_yes_gold\":\"yes\",\"residential_yes_gold_reason\":\"You can mostly see houses where people live\",\"sidewalk_ok\":\"no\",\"sidewalk_ok_confidence\":0.961,\"sidewalk_ok_gold\":\"no\",\"sidewalk_ok_gold_reason\":\"The sidewalk/pedestrian path is not safe for wheelchairs ��� it is not continuous or not wide enough or there seems to be other issues with the sidewalk\",\"trusted_judgments\":26,\"unit_state\":\"golden\",\"url\":\"http://maps.google.com/maps?cbll=45.4852149,-122.726314\\u0026layer=c\"},{\"_root_\":\"752055130\",\"address\":\"1545 Southwest Nancy Drive, Gresham, OR 97080, USA \",\"golden\":true,\"house_types\":\"private_house\",\"house_types_confidence\":0.9642,\"house_types_gold\":\"private_house\",\"house_types_gold_reason\":\"There seems to be single entry or door per family or household (individual house, private house, townhouse etc)\",\"id\":\"752055130\",\"lat\":\"45.484122\",\"location\":\"-122.472306 45.484122\",\"long\":\"-122.472306\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":0.9642,\"residential_yes_gold\":\"yes\",\"residential_yes_gold_reason\":\"You can mostly see houses where people live\",\"sidewalk_ok\":\"yes\",\"sidewalk_ok_confidence\":0.9642,\"sidewalk_ok_gold\":\"yes\",\"sidewalk_ok_gold_reason\":\"There is a sidewalk available, it does look safe and wide enough\",\"trusted_judgments\":25,\"unit_state\":\"golden\",\"url\":\"http://maps.google.com/maps?cbll=45.484122,-122.472306\\u0026layer=c\"},{\"_root_\":\"752055132\",\"address\":\"2089 Southwest Nancy Drive, Gresham, OR 97080, USA \",\"golden\":true,\"house_types\":\"private_house\",\"house_types_confidence\":0.9174,\"house_types_gold\":\"private_house\",\"house_types_gold_reason\":\"There seems to be single entry or door per family or household (individual house, private house, townhouse etc)\",\"id\":\"752055132\",\"lat\":\"45.4822119\",\"location\":\"-122.476723 45.4822119\",\"long\":\"-122.476723\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":0.9174,\"residential_yes_gold\":\"yes\",\"residential_yes_gold_reason\":\"You can mostly see houses where people live\",\"sidewalk_ok\":\"yes\",\"sidewalk_ok_confidence\":0.8304,\"trusted_judgments\":22,\"unit_state\":\"golden\",\"url\":\"http://maps.google.com/maps?cbll=45.4822119,-122.476723\\u0026layer=c\"},{\"_root_\":\"752055140\",\"address\":\"3255 Southwest Willamette Avenue, Corvallis, OR 97333, USA \",\"golden\":true,\"house_types\":\"private_house\",\"house_types_confidence\":1,\"house_types_gold\":\"private_house\",\"house_types_gold_reason\":\"There seems to be single entry or door per family or household (individual house, private house, townhouse etc)\",\"id\":\"752055140\",\"lat\":\"44.5468192\",\"location\":\"-123.2855851 44.5468192\",\"long\":\"-123.2855851\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":1,\"residential_yes_gold\":\"yes\",\"residential_yes_gold_reason\":\"You can mostly see houses where people live\",\"sidewalk_ok\":\"yes\",\"sidewalk_ok_confidence\":0.9581,\"sidewalk_ok_gold_reason\":\"There is a sidewalk available, it does look safe and wide enough\",\"trusted_judgments\":26,\"unit_state\":\"golden\",\"url\":\"http://maps.google.com/maps?cbll=44.5468192,-123.2855851\\u0026layer=c\"},{\"_root_\":\"752055162\",\"address\":\"2345 Southwest Roxbury Avenue, Portland, OR 97225, USA \",\"golden\":true,\"house_types\":\"private_house\",\"house_types_confidence\":1,\"house_types_gold\":\"private_house\",\"house_types_gold_reason\":\"There seems to be single entry or door per family or household (individual house, private house, townhouse etc)\",\"id\":\"752055162\",\"lat\":\"45.503084\",\"location\":\"-122.788185 45.503084\",\"long\":\"-122.788185\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":1,\"residential_yes_gold\":\"yes\",\"residential_yes_gold_reason\":\"You can mostly see houses where people live\",\"sidewalk_ok\":\"yes\",\"sidewalk_ok_confidence\":1,\"sidewalk_ok_gold\":\"yes\",\"sidewalk_ok_gold_reason\":\"There is a sidewalk available, it does look safe and wide enough\",\"trusted_judgments\":24,\"unit_state\":\"golden\",\"url\":\"http://maps.google.com/maps?cbll=45.503084,-122.788185\\u0026layer=c\"},{\"_root_\":\"752055163\",\"address\":\"11650 Southwest Riverwood Road, Portland, OR 97219, USA \",\"golden\":true,\"id\":\"752055163\",\"lat\":\"45.440947\",\"location\":\"-122.648567 45.440947\",\"long\":\"-122.648567\",\"residential_yes\":\"not_avail\",\"residential_yes_confidence\":1,\"residential_yes_gold\":\"not_avail\",\"residential_yes_gold_reason\":\"No street view\",\"trusted_judgments\":38,\"unit_state\":\"golden\",\"url\":\"http://maps.google.com/maps?cbll=45.440947,-122.648567\\u0026layer=c\"},{\"_root_\":\"752055164\",\"address\":\"10505 Southwest Clydesdale Place, Tigard, OR 97223, USA \",\"golden\":true,\"house_types\":\"private_house\",\"house_types_confidence\":1,\"house_types_gold\":\"private_house\",\"house_types_gold_reason\":\"There seems to be single entry or door per family or household (individual house, private house, townhouse etc)\",\"id\":\"752055164\",\"lat\":\"45.432026\",\"location\":\"-122.784792 45.432026\",\"long\":\"-122.784792\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":1,\"residential_yes_gold\":\"yes\",\"residential_yes_gold_reason\":\"You can mostly see houses where people live\",\"sidewalk_ok\":\"yes\",\"sidewalk_ok_confidence\":0.9224,\"sidewalk_ok_gold\":\"yes\",\"sidewalk_ok_gold_reason\":\"There is a sidewalk available, it does look safe and wide enough\",\"trusted_judgments\":31,\"unit_state\":\"golden\",\"url\":\"http://maps.google.com/maps?cbll=45.432026,-122.784792\\u0026layer=c\"},{\"_root_\":\"752055167\",\"address\":\"7715 Southwest Nyberg Street, Tualatin, OR 97062, USA \",\"golden\":true,\"id\":\"752055167\",\"lat\":\"45.3830787\",\"location\":\"-122.7568875 45.3830787\",\"long\":\"-122.7568875\",\"residential_yes\":\"no\",\"residential_yes_confidence\":0.9629,\"residential_yes_gold\":\"no\\r\\nnot_avail\",\"trusted_judgments\":31,\"unit_state\":\"golden\",\"url\":\"http://maps.google.com/maps?cbll=45.3830787,-122.7568875\\u0026layer=c\"},{\"_root_\":\"752055171\",\"address\":\"1620 Southwest Walters Drive, Gresham, OR 97080, USA \",\"golden\":true,\"id\":\"752055171\",\"lat\":\"45.484963\",\"location\":\"-122.440431 45.484963\",\"long\":\"-122.440431\",\"residential_yes\":\"not_avail\",\"residential_yes_confidence\":0.9622,\"residential_yes_gold\":\"not_avail\",\"residential_yes_gold_reason\":\"No street view\",\"trusted_judgments\":24,\"unit_state\":\"golden\",\"url\":\"http://maps.google.com/maps?cbll=45.484963,-122.440431\\u0026layer=c\"},{\"_root_\":\"752055173\",\"address\":\"10735 Southwest Wakefield Street, Portland, OR 97225, USA \",\"golden\":true,\"house_types\":\"private_house\",\"house_types_confidence\":1,\"house_types_gold\":\"private_house\",\"house_types_gold_reason\":\"There seems to be single entry or door per family or household (individual house, private house, townhouse etc)\",\"id\":\"752055173\",\"lat\":\"45.505646\",\"location\":\"-122.787249 45.505646\",\"long\":\"-122.787249\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":1,\"residential_yes_gold\":\"yes\",\"residential_yes_gold_reason\":\"You can mostly see houses where people live\",\"sidewalk_ok\":\"yes\",\"sidewalk_ok_confidence\":0.927,\"sidewalk_ok_gold\":\"yes\",\"sidewalk_ok_gold_reason\":\"There is a sidewalk available, it does look safe and wide enough\",\"trusted_judgments\":34,\"unit_state\":\"golden\",\"url\":\"http://maps.google.com/maps?cbll=45.505646,-122.787249\\u0026layer=c\"},{\"_root_\":\"752055192\",\"address\":\"590 Southwest Brookwood Avenue, Hillsboro, OR 97123, USA\",\"golden\":true,\"id\":\"752055192\",\"lat\":\"45.515796\",\"location\":\"-122.934329 45.515796\",\"long\":\"-122.934329\",\"residential_yes\":\"not_avail\",\"residential_yes_confidence\":1,\"residential_yes_gold\":\"not_avail\",\"trusted_judgments\":30,\"unit_state\":\"golden\",\"url\":\"http://maps.google.com/maps?cbll=45.515796,-122.934329\\u0026layer=c\"},{\"_root_\":\"752055196\",\"address\":\"8790 Southwest Reiling Street, Tigard, OR 97224, USA\",\"golden\":true,\"house_types\":\"private_house\",\"house_types_confidence\":1,\"house_types_gold\":\"private_house\",\"house_types_gold_reason\":\"There seems to be single entry or door per family or household (individual house, private house, townhouse etc)\",\"id\":\"752055196\",\"lat\":\"45.411288\",\"location\":\"-122.76592 45.411288\",\"long\":\"-122.76592\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":1,\"residential_yes_gold\":\"yes\",\"residential_yes_gold_reason\":\"No street view\",\"sidewalk_ok\":\"yes\",\"sidewalk_ok_confidence\":0.9637,\"sidewalk_ok_gold\":\"yes\",\"sidewalk_ok_gold_reason\":\"There is a sidewalk available, it does look safe and wide enough\",\"trusted_judgments\":32,\"unit_state\":\"golden\",\"url\":\"http://maps.google.com/maps?cbll=45.411288,-122.765920\\u0026layer=c\"},{\"_root_\":\"752055559\",\"address\":\"11001 Hackamore Avenue Southwest, Albuquerque, NM 87121, USA\",\"golden\":false,\"house_types\":\"private_house\",\"house_types_confidence\":1,\"id\":\"752055559\",\"last_judgment_at\":\"2015-07-09T06:41:00Z\",\"lat\":\"35.06045951\",\"location\":\"-106.7538155 35.06045951\",\"long\":\"-106.7538155\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":1,\"sidewalk_ok\":\"yes\",\"sidewalk_ok_confidence\":1,\"trusted_judgments\":1,\"unit_state\":\"finalized\",\"url\":\"http://maps.google.com/maps?cbll=35.060460,-106.753816\\u0026layer=c\"},{\"_root_\":\"752056470\",\"address\":\"5680 Southwest Glenbrook Road, Beaverton, OR 97007, USA\",\"golden\":false,\"house_types\":\"private_house\",\"house_types_confidence\":1,\"id\":\"752056470\",\"last_judgment_at\":\"2015-07-09T06:39:00Z\",\"lat\":\"45.47865193\",\"location\":\"-122.8340754 45.47865193\",\"long\":\"-122.8340754\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":1,\"sidewalk_ok\":\"yes\",\"sidewalk_ok_confidence\":1,\"trusted_judgments\":1,\"unit_state\":\"finalized\",\"url\":\"http://maps.google.com/maps?cbll=45.478652,-122.834075\\u0026layer=c\"},{\"_root_\":\"752056578\",\"address\":\"Southwest 65th Terrace, Miami, FL 33183, USA\",\"golden\":false,\"id\":\"752056578\",\"last_judgment_at\":\"2015-07-09T06:42:00Z\",\"lat\":\"25.70679975\",\"location\":\"-80.41635363 25.70679975\",\"long\":\"-80.41635363\",\"residential_yes\":\"not_avail\",\"residential_yes_confidence\":1,\"trusted_judgments\":1,\"unit_state\":\"finalized\",\"url\":\"http://maps.google.com/maps?cbll=25.706800,-80.416354\\u0026layer=c\"},{\"_root_\":\"752055128\",\"address\":\"4210 Southwest 167th Avenue, Beaverton, OR 97007, USA \",\"golden\":true,\"house_types\":\"private_house\",\"house_types_confidence\":1,\"house_types_gold\":\"private_house\",\"house_types_gold_reason\":\"There seems to be single entry or door per family or household (individual house, private house, townhouse etc)\",\"id\":\"752055128\",\"lat\":\"45.489486\",\"location\":\"-122.848955 45.489486\",\"long\":\"-122.848955\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":1,\"residential_yes_gold\":\"yes\",\"residential_yes_gold_reason\":\"You can mostly see houses where people live\",\"sidewalk_ok\":\"yes\",\"sidewalk_ok_confidence\":0.9225,\"sidewalk_ok_gold\":\"yes\",\"sidewalk_ok_gold_reason\":\"There is a sidewalk available, it does look safe and wide enough\",\"trusted_judgments\":25,\"unit_state\":\"golden\",\"url\":\"http://maps.google.com/maps?cbll=45.489486,-122.848955\\u0026layer=c\"},{\"_root_\":\"752055131\",\"address\":\"4990 Southwest 188th Place, Aloha, OR 97007, USA \",\"golden\":true,\"house_types\":\"private_house\",\"house_types_confidence\":1,\"house_types_gold\":\"private_house\",\"house_types_gold_reason\":\"There seems to be single entry or door per family or household (individual house, private house, townhouse etc)\",\"id\":\"752055131\",\"lat\":\"45.483409\",\"location\":\"-122.870494 45.483409\",\"long\":\"-122.870494\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":1,\"residential_yes_gold\":\"yes\",\"residential_yes_gold_reason\":\"You can mostly see houses where people live\",\"sidewalk_ok\":\"yes\",\"sidewalk_ok_confidence\":0.9611,\"sidewalk_ok_gold_reason\":\"There is a sidewalk available, it does look safe and wide enough\",\"trusted_judgments\":23,\"unit_state\":\"golden\",\"url\":\"http://maps.google.com/maps?cbll=45.483409,-122.870494\\u0026layer=c\"},{\"_root_\":\"752055183\",\"address\":\"5900 Southwest Prosperity Park Road, Tualatin, OR 97062, USA \",\"golden\":true,\"id\":\"752055183\",\"lat\":\"45.367782\",\"location\":\"-122.736988 45.367782\",\"long\":\"-122.736988\",\"residential_yes\":\"not_avail\",\"residential_yes_confidence\":1,\"residential_yes_gold\":\"not_avail\",\"trusted_judgments\":23,\"unit_state\":\"golden\",\"url\":\"http://maps.google.com/maps?cbll=45.367782,-122.736988\\u0026layer=c\"},{\"_root_\":\"752055188\",\"address\":\"13201 Southwest 17th Court, Miramar, FL 33027, USA\",\"golden\":true,\"house_types\":\"private_house\",\"house_types_confidence\":1,\"house_types_gold\":\"private_house\",\"house_types_gold_reason\":\"There seems to be single entry or door per family or household (individual house, private house, townhouse etc)\",\"id\":\"752055188\",\"lat\":\"25.992766\",\"location\":\"-80.322621 25.992766\",\"long\":\"-80.322621\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":1,\"residential_yes_gold\":\"yes\",\"residential_yes_gold_reason\":\"You can mostly see houses where people live\",\"sidewalk_ok\":\"yes\",\"sidewalk_ok_confidence\":1,\"sidewalk_ok_gold\":\"yes\",\"sidewalk_ok_gold_reason\":\"There is a sidewalk available, it does look safe and wide enough\",\"trusted_judgments\":33,\"unit_state\":\"golden\",\"url\":\"http://maps.google.com/maps?cbll=25.992766,-80.322621\\u0026layer=c\"},{\"_root_\":\"752055304\",\"address\":\"10441 Southwest 46th Street, Miami, FL 33165, USA\",\"golden\":false,\"house_types\":\"private_house\",\"house_types_confidence\":1,\"id\":\"752055304\",\"last_judgment_at\":\"2015-07-09T06:45:00Z\",\"lat\":\"25.7251367\",\"location\":\"-80.36462556 25.7251367\",\"long\":\"-80.36462556\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":1,\"sidewalk_ok\":\"yes\",\"sidewalk_ok_confidence\":1,\"trusted_judgments\":1,\"unit_state\":\"finalized\",\"url\":\"http://maps.google.com/maps?cbll=25.725137,-80.364626\\u0026layer=c\"},{\"_root_\":\"752055305\",\"address\":\"4301 Southwest 107th Avenue, Miami, FL 33165, USA\",\"golden\":false,\"house_types\":\"private_house\",\"house_types_confidence\":1,\"id\":\"752055305\",\"last_judgment_at\":\"2015-07-09T06:39:00Z\",\"lat\":\"25.72730827\",\"location\":\"-80.36669022 25.72730827\",\"long\":\"-80.36669022\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":1,\"sidewalk_ok\":\"yes\",\"sidewalk_ok_confidence\":1,\"trusted_judgments\":1,\"unit_state\":\"finalized\",\"url\":\"http://maps.google.com/maps?cbll=25.727308,-80.366690\\u0026layer=c\"},{\"_root_\":\"752055558\",\"address\":\"1612 Silver Sky Drive Southwest, Albuquerque, NM 87121, USA\",\"golden\":false,\"house_types\":\"private_house\",\"house_types_confidence\":1,\"id\":\"752055558\",\"last_judgment_at\":\"2015-07-09T06:50:00Z\",\"lat\":\"35.0484229\",\"location\":\"-106.7364489 35.0484229\",\"long\":\"-106.7364489\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":1,\"sidewalk_ok\":\"yes\",\"sidewalk_ok_confidence\":1,\"trusted_judgments\":1,\"unit_state\":\"finalized\",\"url\":\"http://maps.google.com/maps?cbll=35.048423,-106.736449\\u0026layer=c\"},{\"_root_\":\"752056471\",\"address\":\"6360 Southwest 154th Place, Beaverton, OR 97007, USA\",\"golden\":false,\"house_types\":\"private_house\",\"house_types_confidence\":1,\"id\":\"752056471\",\"last_judgment_at\":\"2015-07-09T06:30:00Z\",\"lat\":\"45.47374371\",\"location\":\"-122.8361185 45.47374371\",\"long\":\"-122.8361185\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":1,\"sidewalk_ok\":\"yes\",\"sidewalk_ok_confidence\":1,\"trusted_judgments\":1,\"unit_state\":\"finalized\",\"url\":\"http://maps.google.com/maps?cbll=45.473744,-122.836118\\u0026layer=c\"},{\"_root_\":\"752056576\",\"address\":\"5015 Southwest 114th Avenue, Miami, FL 33165, USA\",\"golden\":false,\"house_types\":\"private_house\",\"house_types_confidence\":1,\"id\":\"752056576\",\"last_judgment_at\":\"2015-07-09T06:58:00Z\",\"lat\":\"25.72032098\",\"location\":\"-80.37921526 25.72032098\",\"long\":\"-80.37921526\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":1,\"sidewalk_ok\":\"yes\",\"sidewalk_ok_confidence\":1,\"trusted_judgments\":1,\"unit_state\":\"finalized\",\"url\":\"http://maps.google.com/maps?cbll=25.720321,-80.379215\\u0026layer=c\"},{\"_root_\":\"752056577\",\"address\":\"11171 Southwest 57th Terrace, Miami, FL 33173, USA\",\"golden\":false,\"house_types\":\"private_house\",\"house_types_confidence\":1,\"id\":\"752056577\",\"last_judgment_at\":\"2015-07-09T07:01:00Z\",\"lat\":\"25.71392911\",\"location\":\"-80.37413524 25.71392911\",\"long\":\"-80.37413524\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":1,\"sidewalk_ok\":\"yes\",\"sidewalk_ok_confidence\":1,\"trusted_judgments\":1,\"unit_state\":\"finalized\",\"url\":\"http://maps.google.com/maps?cbll=25.713929,-80.374135\\u0026layer=c\"},{\"_root_\":\"752056579\",\"address\":\"11893 Southwest 56th Street, Miami, FL 33175, USA\",\"golden\":false,\"id\":\"752056579\",\"last_judgment_at\":\"2015-07-09T06:32:00Z\",\"lat\":\"25.71584582\",\"location\":\"-80.38476238 25.71584582\",\"long\":\"-80.38476238\",\"residential_yes\":\"no\",\"residential_yes_confidence\":1,\"trusted_judgments\":1,\"unit_state\":\"finalized\",\"url\":\"http://maps.google.com/maps?cbll=25.715846,-80.384762\\u0026layer=c\"},{\"_root_\":\"752056580\",\"address\":\"6025 Southwest 123rd Avenue, Miami, FL 33183, USA\",\"golden\":false,\"id\":\"752056580\",\"last_judgment_at\":\"2015-07-09T07:00:00Z\",\"lat\":\"25.71107741\",\"location\":\"-80.39184188 25.71107741\",\"long\":\"-80.39184188\",\"residential_yes\":\"not_avail\",\"residential_yes_confidence\":1,\"trusted_judgments\":1,\"unit_state\":\"finalized\",\"url\":\"http://maps.google.com/maps?cbll=25.711077,-80.391842\\u0026layer=c\"},{\"_root_\":\"752056581\",\"address\":\"5798 Southwest 123rd Avenue, Miami, FL 33183, USA\",\"golden\":false,\"id\":\"752056581\",\"last_judgment_at\":\"2015-07-09T07:01:00Z\",\"lat\":\"25.71304518\",\"location\":\"-80.39403149 25.71304518\",\"long\":\"-80.39403149\",\"residential_yes\":\"not_avail\",\"residential_yes_confidence\":1,\"trusted_judgments\":1,\"unit_state\":\"finalized\",\"url\":\"http://maps.google.com/maps?cbll=25.713045,-80.394031\\u0026layer=c\"},{\"_root_\":\"752056795\",\"address\":\"8865 Southwest 16th Street, Miami, FL 33165, USA\",\"golden\":false,\"id\":\"752056795\",\"last_judgment_at\":\"2015-07-09T07:06:00Z\",\"lat\":\"25.75562219\",\"location\":\"-80.34046094 25.75562219\",\"long\":\"-80.34046094\",\"residential_yes\":\"not_avail\",\"residential_yes_confidence\":1,\"trusted_judgments\":1,\"unit_state\":\"finalized\",\"url\":\"http://maps.google.com/maps?cbll=25.755622,-80.340461\\u0026layer=c\"},{\"_root_\":\"752056796\",\"address\":\"3199 Southwest 109th Court, Miami, FL 33165, USA\",\"golden\":false,\"house_types\":\"private_house\",\"house_types_confidence\":1,\"id\":\"752056796\",\"last_judgment_at\":\"2015-07-09T06:57:00Z\",\"lat\":\"25.73970622\",\"location\":\"-80.37254295 25.73970622\",\"long\":\"-80.37254295\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":1,\"sidewalk_ok\":\"no\",\"sidewalk_ok_confidence\":1,\"trusted_judgments\":1,\"unit_state\":\"finalized\",\"url\":\"http://maps.google.com/maps?cbll=25.739706,-80.372543\\u0026layer=c\"},{\"_root_\":\"752056797\",\"address\":\"10210 Southwest 19th Street, Miami, FL 33165, USA\",\"golden\":false,\"house_types\":\"private_house\",\"house_types_confidence\":1,\"id\":\"752056797\",\"last_judgment_at\":\"2015-07-09T06:50:00Z\",\"lat\":\"25.75154644\",\"location\":\"-80.36041317 25.75154644\",\"long\":\"-80.36041317\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":1,\"sidewalk_ok\":\"yes\",\"sidewalk_ok_confidence\":1,\"trusted_judgments\":1,\"unit_state\":\"finalized\",\"url\":\"http://maps.google.com/maps?cbll=25.751546,-80.360413\\u0026layer=c\"},{\"_root_\":\"752056798\",\"address\":\"3350 Southwest 129th Avenue, Miami, FL 33175, USA\",\"golden\":false,\"id\":\"752056798\",\"last_judgment_at\":\"2015-07-09T06:37:00Z\",\"lat\":\"25.73721927\",\"location\":\"-80.40445499 25.73721927\",\"long\":\"-80.40445499\",\"residential_yes\":\"not_avail\",\"residential_yes_confidence\":1,\"trusted_judgments\":1,\"unit_state\":\"finalized\",\"url\":\"http://maps.google.com/maps?cbll=25.737219,-80.404455\\u0026layer=c\"},{\"_root_\":\"752056799\",\"address\":\"3715 Southwest 121st Avenue, Miami, FL 33175, USA\",\"golden\":false,\"house_types\":\"private_house\",\"house_types_confidence\":1,\"id\":\"752056799\",\"last_judgment_at\":\"2015-07-09T06:59:00Z\",\"lat\":\"25.73423253\",\"location\":\"-80.39071936 25.73423253\",\"long\":\"-80.39071936\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":1,\"sidewalk_ok\":\"yes\",\"sidewalk_ok_confidence\":1,\"trusted_judgments\":1,\"unit_state\":\"finalized\",\"url\":\"http://maps.google.com/maps?cbll=25.734233,-80.390719\\u0026layer=c\"},{\"_root_\":\"752055898\",\"address\":\"6181 Southwest 153rd Court Road, Miami, FL 33193, USA\",\"golden\":false,\"house_types\":\"private_house\",\"house_types_confidence\":1,\"id\":\"752055898\",\"last_judgment_at\":\"2015-07-09T06:32:00Z\",\"lat\":\"25.70988693\",\"location\":\"-80.44280531 25.70988693\",\"long\":\"-80.44280531\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":1,\"sidewalk_ok\":\"yes\",\"sidewalk_ok_confidence\":1,\"trusted_judgments\":1,\"unit_state\":\"finalized\",\"url\":\"http://maps.google.com/maps?cbll=25.709887,-80.442805\\u0026layer=c\"},{\"_root_\":\"752055993\",\"address\":\"66-68 Southwest 47th Street, Miami, FL 33155, USA\",\"golden\":false,\"house_types\":\"private_house\",\"house_types_confidence\":1,\"id\":\"752055993\",\"last_judgment_at\":\"2015-07-09T07:17:00Z\",\"lat\":\"25.7726238\",\"location\":\"-80.27199793 25.7726238\",\"long\":\"-80.27199793\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":1,\"sidewalk_ok\":\"yes\",\"sidewalk_ok_confidence\":1,\"trusted_judgments\":1,\"unit_state\":\"finalized\",\"url\":\"http://maps.google.com/maps?cbll=25.772624,-80.271998\\u0026layer=c\"},{\"_root_\":\"752056794\",\"address\":\"2685-2715 Southwest 109th Avenue, Miami, FL 33165, USA\",\"golden\":false,\"house_types\":\"private_house\",\"house_types_confidence\":1,\"id\":\"752056794\",\"last_judgment_at\":\"2015-07-09T07:00:00Z\",\"lat\":\"25.74418782\",\"location\":\"-80.37179383 25.74418782\",\"long\":\"-80.37179383\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":1,\"sidewalk_ok\":\"Not sure, mixed\",\"sidewalk_ok_confidence\":1,\"trusted_judgments\":1,\"unit_state\":\"finalized\",\"url\":\"http://maps.google.com/maps?cbll=25.744188,-80.371794\\u0026layer=c\"},{\"_root_\":\"752056995\",\"address\":\"7350 Southwest 34th Street Road, Miami, FL 33155, USA\",\"golden\":false,\"house_types\":\"private_house\",\"house_types_confidence\":1,\"id\":\"752056995\",\"last_judgment_at\":\"2015-07-09T07:02:00Z\",\"lat\":\"25.7415286\",\"location\":\"-80.31475828 25.7415286\",\"long\":\"-80.31475828\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":1,\"sidewalk_ok\":\"yes\",\"sidewalk_ok_confidence\":1,\"trusted_judgments\":1,\"unit_state\":\"finalized\",\"url\":\"http://maps.google.com/maps?cbll=25.741529,-80.314758\\u0026layer=c\"},{\"_root_\":\"752056996\",\"address\":\"7580-7598 Southwest 28th Street Road, Miami, FL 33155, USA\",\"golden\":false,\"house_types\":\"private_house\",\"house_types_confidence\":1,\"id\":\"752056996\",\"last_judgment_at\":\"2015-07-09T06:42:00Z\",\"lat\":\"25.74575446\",\"location\":\"-80.31899785 25.74575446\",\"long\":\"-80.31899785\",\"residential_yes\":\"yes\",\"residential_yes_confidence\":1,\"sidewalk_ok\":\"yes\",\"sidewalk_ok_confidence\":1,\"trusted_judgments\":1,\"unit_state\":\"finalized\",\"url\":\"http://maps.google.com/maps?cbll=25.745754,-80.318998\\u0026layer=c\"}],\"numFound\":38,\"numFoundExact\":true,\"start\":0},\"responseHeader\":{\"status\":0}}" So(string(updatedResBody), ShouldResemble, expectedResponse) - }) + })*/ Convey("Solr: RS to Solr conversion", t, func() { False := false @@ -156,7 +155,7 @@ func TestSolrStage(t *testing.T) { resBody := resMap["response"].(map[string]interface{})["body"].(string) - expectedResponse := "{\"test\":{\"original\":{\"id\":\"test\",\"react\":{\"or\":[\"test-before\",\"test-after\"]},\"queryFormat\":\"AND\",\"dataField\":[{\"field\":\"summary_t\",\"weight\":3},{\"field\":\"location_t\",\"weight\":2}],\"from\":24,\"size\":12,\"sortBy\":\"asc\",\"value\":\"Las Vegas Nevada\",\"includeFields\":[\"summary_t\",\"location_t\"],\"highlight\":true,\"highlightConfig\":{\"fields\":{\"summary_t\":{}}},\"execute\":true},\"built\":\"?=&_index=&defType=edismax&fl=summary_t%2Clocation_t%2Cscore%2Cid&fq=(((location_t%3A%22Vegas*%22))%20OR%20((location_t%3A%22Las%20Vegas*%22)))&hl=true&hl.fl=summary_t&q=Las%20AND%20Vegas%20AND%20Nevada*&qf=summary_tsummary_t%5E3.000000%20location_tlocation_t%5E2.000000&rows=12&sort=summary_t%20asc%2C%20id%20asc&start=24\"}}" + expectedResponse := "{\"test\":{\"original\":{\"id\":\"test\",\"type\":\"search\",\"react\":{\"or\":[\"test-before\",\"test-after\"]},\"queryFormat\":\"AND\",\"dataField\":[{\"field\":\"summary_t\",\"weight\":3},{\"field\":\"location_t\",\"weight\":2}],\"from\":24,\"size\":12,\"sortBy\":\"asc\",\"value\":\"Las Vegas Nevada\",\"includeFields\":[\"summary_t\",\"location_t\"],\"highlight\":true,\"highlightConfig\":{\"fields\":{\"summary_t\":{}}},\"execute\":true},\"built\":\"?=&_index=&defType=edismax&fl=summary_t%2Clocation_t%2Cscore%2Cid&fq=(((location_t%3A%22Vegas*%22))%20OR%20((location_t%3A%22Las%20Vegas*%22)))&hl=true&hl.fl=summary_t&q=Las%20AND%20Vegas%20AND%20Nevada*&qf=summary_tsummary_t%5E3.000000%20location_tlocation_t%5E2.000000&rows=12&sort=summary_t%20asc%2C%20id%20asc&start=24\"}}" So(string(resBody), ShouldResemble, expectedResponse) }) diff --git a/plugins/pipelines/solr_translation_test.go b/plugins/pipelines/solr_translation_test.go index 7165230e..3e003e37 100644 --- a/plugins/pipelines/solr_translation_test.go +++ b/plugins/pipelines/solr_translation_test.go @@ -87,7 +87,7 @@ func TestSolrTermQuery(t *testing.T) { So(err, ShouldBeNil) - expectedContext := "{\"request\":{\"body\":\"{\\\"second\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"second\\\\\\\",\\\\\\\"react\\\\\\\":{\\\\\\\"and\\\\\\\":\\\\\\\"test\\\\\\\"}}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"fq\\\":\\\"(summary_t:\\\\\\\"quark AND something\\\\\\\")\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"metadata\\\":{\\\"app\\\":\\\"appbase\\\",\\\"profile\\\":\\\"appbase\\\",\\\"search_profile\\\":\\\"appbase\\\"},\\\"query\\\":[{\\\"dataField\\\":\\\"summary_t\\\",\\\"execute\\\":false,\\\"id\\\":\\\"test\\\",\\\"queryFormat\\\":\\\"and\\\",\\\"type\\\":\\\"term\\\",\\\"value\\\":[\\\"quark\\\",\\\"something\\\"]},{\\\"id\\\":\\\"second\\\",\\\"react\\\":{\\\"and\\\":\\\"test\\\"}}]}\",\"RS_BACKEND\":\"solr\"}}" + expectedContext := "{\"request\":{\"body\":\"{\\\"second\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"second\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"search\\\\\\\",\\\\\\\"react\\\\\\\":{\\\\\\\"and\\\\\\\":\\\\\\\"test\\\\\\\"}}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"fq\\\":\\\"(summary_t:\\\\\\\"quark AND something\\\\\\\")\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"metadata\\\":{\\\"app\\\":\\\"appbase\\\",\\\"profile\\\":\\\"appbase\\\",\\\"search_profile\\\":\\\"appbase\\\"},\\\"query\\\":[{\\\"dataField\\\":\\\"summary_t\\\",\\\"execute\\\":false,\\\"id\\\":\\\"test\\\",\\\"queryFormat\\\":\\\"and\\\",\\\"type\\\":\\\"term\\\",\\\"value\\\":[\\\"quark\\\",\\\"something\\\"]},{\\\"id\\\":\\\"second\\\",\\\"react\\\":{\\\"and\\\":\\\"test\\\"}}]}\",\"RS_BACKEND\":\"solr\"}}" So(string(updatedContextInBytes), ShouldResemble, expectedContext) }) @@ -117,7 +117,7 @@ func TestSolrTermQuery(t *testing.T) { So(err, ShouldBeNil) - expectedContext := "{\"request\":{\"body\":\"{\\\"second\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"second\\\\\\\",\\\\\\\"react\\\\\\\":{\\\\\\\"and\\\\\\\":\\\\\\\"test\\\\\\\"}}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"fq\\\":\\\"(summary_t:\\\\\\\"quark OR something\\\\\\\")\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"metadata\\\":{\\\"app\\\":\\\"appbase\\\",\\\"profile\\\":\\\"appbase\\\",\\\"search_profile\\\":\\\"appbase\\\"},\\\"query\\\":[{\\\"dataField\\\":\\\"summary_t\\\",\\\"execute\\\":false,\\\"id\\\":\\\"test\\\",\\\"queryFormat\\\":\\\"or\\\",\\\"type\\\":\\\"term\\\",\\\"value\\\":[\\\"quark\\\",\\\"something\\\"]},{\\\"id\\\":\\\"second\\\",\\\"react\\\":{\\\"and\\\":\\\"test\\\"}}]}\",\"RS_BACKEND\":\"solr\"}}" + expectedContext := "{\"request\":{\"body\":\"{\\\"second\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"second\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"search\\\\\\\",\\\\\\\"react\\\\\\\":{\\\\\\\"and\\\\\\\":\\\\\\\"test\\\\\\\"}}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"fq\\\":\\\"(summary_t:\\\\\\\"quark OR something\\\\\\\")\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"metadata\\\":{\\\"app\\\":\\\"appbase\\\",\\\"profile\\\":\\\"appbase\\\",\\\"search_profile\\\":\\\"appbase\\\"},\\\"query\\\":[{\\\"dataField\\\":\\\"summary_t\\\",\\\"execute\\\":false,\\\"id\\\":\\\"test\\\",\\\"queryFormat\\\":\\\"or\\\",\\\"type\\\":\\\"term\\\",\\\"value\\\":[\\\"quark\\\",\\\"something\\\"]},{\\\"id\\\":\\\"second\\\",\\\"react\\\":{\\\"and\\\":\\\"test\\\"}}]}\",\"RS_BACKEND\":\"solr\"}}" So(string(updatedContextInBytes), ShouldResemble, expectedContext) }) @@ -147,7 +147,7 @@ func TestSolrTermQuery(t *testing.T) { So(err, ShouldBeNil) - expectedContext := "{\"request\":{\"body\":\"{\\\"second\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"second\\\\\\\",\\\\\\\"react\\\\\\\":{\\\\\\\"and\\\\\\\":\\\\\\\"test\\\\\\\"}}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"fq\\\":\\\"((summary_t:\\\\\\\"quark\\\\\\\") AND (description_t:\\\\\\\"something\\\\\\\")) OR ((summary_t:\\\\\\\"test\\\\\\\") AND (description_t:\\\\\\\"something\\\\\\\"))\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"metadata\\\":{\\\"app\\\":\\\"appbase\\\",\\\"profile\\\":\\\"appbase\\\",\\\"search_profile\\\":\\\"appbase\\\"},\\\"query\\\":[{\\\"dataField\\\":[\\\"summary_t\\\",\\\"description_t\\\"],\\\"execute\\\":false,\\\"id\\\":\\\"test\\\",\\\"queryFormat\\\":\\\"or\\\",\\\"type\\\":\\\"term\\\",\\\"value\\\":[\\\"quark \\\\u003e something\\\",\\\"test \\\\u003e something\\\"]},{\\\"id\\\":\\\"second\\\",\\\"react\\\":{\\\"and\\\":\\\"test\\\"}}]}\",\"RS_BACKEND\":\"solr\"}}" + expectedContext := "{\"request\":{\"body\":\"{\\\"second\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"second\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"search\\\\\\\",\\\\\\\"react\\\\\\\":{\\\\\\\"and\\\\\\\":\\\\\\\"test\\\\\\\"}}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"fq\\\":\\\"((summary_t:\\\\\\\"quark\\\\\\\") AND (description_t:\\\\\\\"something\\\\\\\")) OR ((summary_t:\\\\\\\"test\\\\\\\") AND (description_t:\\\\\\\"something\\\\\\\"))\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"metadata\\\":{\\\"app\\\":\\\"appbase\\\",\\\"profile\\\":\\\"appbase\\\",\\\"search_profile\\\":\\\"appbase\\\"},\\\"query\\\":[{\\\"dataField\\\":[\\\"summary_t\\\",\\\"description_t\\\"],\\\"execute\\\":false,\\\"id\\\":\\\"test\\\",\\\"queryFormat\\\":\\\"or\\\",\\\"type\\\":\\\"term\\\",\\\"value\\\":[\\\"quark \\\\u003e something\\\",\\\"test \\\\u003e something\\\"]},{\\\"id\\\":\\\"second\\\",\\\"react\\\":{\\\"and\\\":\\\"test\\\"}}]}\",\"RS_BACKEND\":\"solr\"}}" So(string(updatedContextInBytes), ShouldResemble, expectedContext) }) @@ -177,7 +177,7 @@ func TestSolrTermQuery(t *testing.T) { So(err, ShouldBeNil) - expectedContext := "{\"request\":{\"body\":\"{\\\"second\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"second\\\\\\\",\\\\\\\"react\\\\\\\":{\\\\\\\"and\\\\\\\":\\\\\\\"test\\\\\\\"}}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"fq\\\":\\\"((summary_t:\\\\\\\"quark\\\\\\\") AND (description_t:\\\\\\\"something\\\\\\\")) AND ((summary_t:\\\\\\\"test\\\\\\\") AND (description_t:\\\\\\\"something\\\\\\\")) AND ((summary_t:\\\\\\\"three\\\\\\\") AND (description_t:\\\\\\\"word\\\\\\\"))\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"metadata\\\":{\\\"app\\\":\\\"appbase\\\",\\\"profile\\\":\\\"appbase\\\",\\\"search_profile\\\":\\\"appbase\\\"},\\\"query\\\":[{\\\"dataField\\\":[\\\"summary_t\\\",\\\"description_t\\\"],\\\"execute\\\":false,\\\"id\\\":\\\"test\\\",\\\"queryFormat\\\":\\\"and\\\",\\\"type\\\":\\\"term\\\",\\\"value\\\":[\\\"quark \\\\u003e something\\\",\\\"test \\\\u003e something\\\",\\\"three \\\\u003e word \\\\u003e value\\\"]},{\\\"id\\\":\\\"second\\\",\\\"react\\\":{\\\"and\\\":\\\"test\\\"}}]}\",\"RS_BACKEND\":\"solr\"}}" + expectedContext := "{\"request\":{\"body\":\"{\\\"second\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"second\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"search\\\\\\\",\\\\\\\"react\\\\\\\":{\\\\\\\"and\\\\\\\":\\\\\\\"test\\\\\\\"}}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"fq\\\":\\\"((summary_t:\\\\\\\"quark\\\\\\\") AND (description_t:\\\\\\\"something\\\\\\\")) AND ((summary_t:\\\\\\\"test\\\\\\\") AND (description_t:\\\\\\\"something\\\\\\\")) AND ((summary_t:\\\\\\\"three\\\\\\\") AND (description_t:\\\\\\\"word\\\\\\\"))\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"metadata\\\":{\\\"app\\\":\\\"appbase\\\",\\\"profile\\\":\\\"appbase\\\",\\\"search_profile\\\":\\\"appbase\\\"},\\\"query\\\":[{\\\"dataField\\\":[\\\"summary_t\\\",\\\"description_t\\\"],\\\"execute\\\":false,\\\"id\\\":\\\"test\\\",\\\"queryFormat\\\":\\\"and\\\",\\\"type\\\":\\\"term\\\",\\\"value\\\":[\\\"quark \\\\u003e something\\\",\\\"test \\\\u003e something\\\",\\\"three \\\\u003e word \\\\u003e value\\\"]},{\\\"id\\\":\\\"second\\\",\\\"react\\\":{\\\"and\\\":\\\"test\\\"}}]}\",\"RS_BACKEND\":\"solr\"}}" So(string(updatedContextInBytes), ShouldResemble, expectedContext) }) @@ -207,7 +207,7 @@ func TestSolrTermQuery(t *testing.T) { So(err, ShouldBeNil) - expectedContext := "{\"request\":{\"body\":\"{\\\"second\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"second\\\\\\\",\\\\\\\"react\\\\\\\":{\\\\\\\"and\\\\\\\":\\\\\\\"test\\\\\\\"}}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"fq\\\":\\\"(summary_t:\\\\\\\"quark\\\\\\\")\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"},\\\"test\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"test\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"term\\\\\\\",\\\\\\\"queryFormat\\\\\\\":\\\\\\\"and\\\\\\\",\\\\\\\"dataField\\\\\\\":\\\\\\\"summary_t\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"quark\\\\\\\",\\\\\\\"execute\\\\\\\":true}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"facet\\\":\\\"true\\\",\\\"facet.field\\\":\\\"summary_t\\\",\\\"facet.sort\\\":\\\"count\\\",\\\"fl\\\":\\\"score,*\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"quark\\\",\\\"rows\\\":\\\"0\\\",\\\"sort\\\":\\\"id asc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"metadata\\\":{\\\"app\\\":\\\"appbase\\\",\\\"profile\\\":\\\"appbase\\\",\\\"search_profile\\\":\\\"appbase\\\"},\\\"query\\\":[{\\\"dataField\\\":\\\"summary_t\\\",\\\"execute\\\":true,\\\"id\\\":\\\"test\\\",\\\"queryFormat\\\":\\\"and\\\",\\\"type\\\":\\\"term\\\",\\\"value\\\":\\\"quark\\\"},{\\\"id\\\":\\\"second\\\",\\\"react\\\":{\\\"and\\\":\\\"test\\\"}}]}\",\"RS_BACKEND\":\"solr\"}}" + expectedContext := "{\"request\":{\"body\":\"{\\\"second\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"second\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"search\\\\\\\",\\\\\\\"react\\\\\\\":{\\\\\\\"and\\\\\\\":\\\\\\\"test\\\\\\\"}}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"fq\\\":\\\"(summary_t:\\\\\\\"quark\\\\\\\")\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"},\\\"test\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"test\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"term\\\\\\\",\\\\\\\"queryFormat\\\\\\\":\\\\\\\"and\\\\\\\",\\\\\\\"dataField\\\\\\\":\\\\\\\"summary_t\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"quark\\\\\\\",\\\\\\\"execute\\\\\\\":true}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"facet\\\":\\\"true\\\",\\\"facet.field\\\":\\\"summary_t\\\",\\\"facet.sort\\\":\\\"count\\\",\\\"fl\\\":\\\"score,*\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"quark\\\",\\\"rows\\\":\\\"0\\\",\\\"sort\\\":\\\"id asc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"metadata\\\":{\\\"app\\\":\\\"appbase\\\",\\\"profile\\\":\\\"appbase\\\",\\\"search_profile\\\":\\\"appbase\\\"},\\\"query\\\":[{\\\"dataField\\\":\\\"summary_t\\\",\\\"execute\\\":true,\\\"id\\\":\\\"test\\\",\\\"queryFormat\\\":\\\"and\\\",\\\"type\\\":\\\"term\\\",\\\"value\\\":\\\"quark\\\"},{\\\"id\\\":\\\"second\\\",\\\"react\\\":{\\\"and\\\":\\\"test\\\"}}]}\",\"RS_BACKEND\":\"solr\"}}" So(string(updatedContextInBytes), ShouldResemble, expectedContext) }) @@ -261,7 +261,7 @@ func TestSolrTermQuery(t *testing.T) { So(err, ShouldBeNil) - expectedContext := "{\"request\":{\"body\":\"{\\\"second\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"second\\\\\\\",\\\\\\\"react\\\\\\\":{\\\\\\\"or\\\\\\\":\\\\\\\"test\\\\\\\"}}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"fq\\\":\\\"((summary_t:quark))\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"},\\\"test\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"test\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"term\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"quark\\\\\\\",\\\\\\\"customQuery\\\\\\\":{\\\\\\\"query\\\\\\\":\\\\\\\"?facet=true\\\\\\\\u0026facet.field=summary_t\\\\\\\\u0026fq=((summary_t%3Aquark))\\\\\\\\u0026fl=score%2C*\\\\\\\\u0026hl=false\\\\\\\\u0026hl.fl=*\\\\\\\\u0026q=quark\\\\\\\\u0026qf=summary_t\\\\\\\\u0026rows=0\\\\\\\\u0026sort=score%20desc\\\\\\\\u0026start=0\\\\\\\"}}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"facet\\\":\\\"true\\\",\\\"facet.field\\\":\\\"\\\",\\\"facet.sort\\\":\\\"count\\\",\\\"fl\\\":\\\"score,*\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"quark\\\",\\\"rows\\\":\\\"0\\\",\\\"sort\\\":\\\"id asc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"metadata\\\":{\\\"app\\\":\\\"appbase\\\",\\\"profile\\\":\\\"appbase\\\",\\\"search_profile\\\":\\\"appbase\\\"},\\\"query\\\":[{\\\"customQuery\\\":{\\\"query\\\":\\\"?facet=true\\\\u0026facet.field=summary_t\\\\u0026fq=((summary_t%3Aquark))\\\\u0026fl=score%2C*\\\\u0026hl=false\\\\u0026hl.fl=*\\\\u0026q=quark\\\\u0026qf=summary_t\\\\u0026rows=0\\\\u0026sort=score%20desc\\\\u0026start=0\\\"},\\\"id\\\":\\\"test\\\",\\\"type\\\":\\\"term\\\",\\\"value\\\":\\\"quark\\\"},{\\\"id\\\":\\\"second\\\",\\\"react\\\":{\\\"or\\\":\\\"test\\\"}}]}\",\"RS_BACKEND\":\"solr\"}}" + expectedContext := "{\"request\":{\"body\":\"{\\\"second\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"second\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"search\\\\\\\",\\\\\\\"react\\\\\\\":{\\\\\\\"or\\\\\\\":\\\\\\\"test\\\\\\\"}}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"fq\\\":\\\"((summary_t:quark))\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"},\\\"test\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"test\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"term\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"quark\\\\\\\",\\\\\\\"customQuery\\\\\\\":{\\\\\\\"query\\\\\\\":\\\\\\\"?facet=true\\\\\\\\u0026facet.field=summary_t\\\\\\\\u0026fq=((summary_t%3Aquark))\\\\\\\\u0026fl=score%2C*\\\\\\\\u0026hl=false\\\\\\\\u0026hl.fl=*\\\\\\\\u0026q=quark\\\\\\\\u0026qf=summary_t\\\\\\\\u0026rows=0\\\\\\\\u0026sort=score%20desc\\\\\\\\u0026start=0\\\\\\\"}}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"facet\\\":\\\"true\\\",\\\"facet.field\\\":\\\"\\\",\\\"facet.sort\\\":\\\"count\\\",\\\"fl\\\":\\\"score,*\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"quark\\\",\\\"rows\\\":\\\"0\\\",\\\"sort\\\":\\\"id asc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"metadata\\\":{\\\"app\\\":\\\"appbase\\\",\\\"profile\\\":\\\"appbase\\\",\\\"search_profile\\\":\\\"appbase\\\"},\\\"query\\\":[{\\\"customQuery\\\":{\\\"query\\\":\\\"?facet=true\\\\u0026facet.field=summary_t\\\\u0026fq=((summary_t%3Aquark))\\\\u0026fl=score%2C*\\\\u0026hl=false\\\\u0026hl.fl=*\\\\u0026q=quark\\\\u0026qf=summary_t\\\\u0026rows=0\\\\u0026sort=score%20desc\\\\u0026start=0\\\"},\\\"id\\\":\\\"test\\\",\\\"type\\\":\\\"term\\\",\\\"value\\\":\\\"quark\\\"},{\\\"id\\\":\\\"second\\\",\\\"react\\\":{\\\"or\\\":\\\"test\\\"}}]}\",\"RS_BACKEND\":\"solr\"}}" So(string(updatedContextInBytes), ShouldResemble, expectedContext) }) @@ -307,7 +307,7 @@ func TestSolrSearchQuery(t *testing.T) { So(err, ShouldBeNil) - expectedContext := "{\"request\":{\"body\":\"{\\\"test\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"test\\\\\\\",\\\\\\\"dataField\\\\\\\":\\\\\\\"summary_t\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"quark\\\\\\\"}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"quark*\\\",\\\"qf\\\":\\\"summary_t\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"query\\\":[{\\\"dataField\\\":\\\"summary_t\\\",\\\"id\\\":\\\"test\\\",\\\"type\\\":\\\"search\\\",\\\"value\\\":\\\"quark\\\"}]}\",\"RS_BACKEND\":\"solr\"}}" + expectedContext := "{\"request\":{\"body\":\"{\\\"test\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"test\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"search\\\\\\\",\\\\\\\"dataField\\\\\\\":\\\\\\\"summary_t\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"quark\\\\\\\"}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"quark*\\\",\\\"qf\\\":\\\"summary_t\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"query\\\":[{\\\"dataField\\\":\\\"summary_t\\\",\\\"id\\\":\\\"test\\\",\\\"type\\\":\\\"search\\\",\\\"value\\\":\\\"quark\\\"}]}\",\"RS_BACKEND\":\"solr\"}}" So(string(updatedContextInBytes), ShouldResemble, expectedContext) }) @@ -326,7 +326,7 @@ func TestSolrSearchQuery(t *testing.T) { So(err, ShouldBeNil) - expectedContext := "{\"request\":{\"body\":\"{\\\"test\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"test\\\\\\\",\\\\\\\"dataField\\\\\\\":\\\\\\\"summary_t\\\\\\\"}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"query\\\":[{\\\"dataField\\\":\\\"summary_t\\\",\\\"id\\\":\\\"test\\\"}]}\",\"RS_BACKEND\":\"solr\"}}" + expectedContext := "{\"request\":{\"body\":\"{\\\"test\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"test\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"search\\\\\\\",\\\\\\\"dataField\\\\\\\":\\\\\\\"summary_t\\\\\\\"}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"query\\\":[{\\\"dataField\\\":\\\"summary_t\\\",\\\"id\\\":\\\"test\\\"}]}\",\"RS_BACKEND\":\"solr\"}}" So(string(updatedContextInBytes), ShouldResemble, expectedContext) }) @@ -346,7 +346,7 @@ func TestSolrSearchQuery(t *testing.T) { So(err, ShouldBeNil) - expectedContext := "{\"request\":{\"body\":\"{\\\"test\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"test\\\\\\\",\\\\\\\"dataField\\\\\\\":\\\\\\\"summary_t\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"quark\\\\\\\"}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"quark*\\\",\\\"qf\\\":\\\"summary_t\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"query\\\":[{\\\"dataField\\\":\\\"summary_t\\\",\\\"id\\\":\\\"test\\\",\\\"value\\\":\\\"quark\\\"}]}\",\"RS_BACKEND\":\"solr\"}}" + expectedContext := "{\"request\":{\"body\":\"{\\\"test\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"test\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"search\\\\\\\",\\\\\\\"dataField\\\\\\\":\\\\\\\"summary_t\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"quark\\\\\\\"}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"quark*\\\",\\\"qf\\\":\\\"summary_t\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"query\\\":[{\\\"dataField\\\":\\\"summary_t\\\",\\\"id\\\":\\\"test\\\",\\\"value\\\":\\\"quark\\\"}]}\",\"RS_BACKEND\":\"solr\"}}" So(string(updatedContextInBytes), ShouldResemble, expectedContext) }) @@ -364,7 +364,7 @@ func TestSolrSearchQuery(t *testing.T) { So(err, ShouldBeNil) - expectedContext := "{\"request\":{\"body\":\"{\\\"test\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"test\\\\\\\"}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"query\\\":[{\\\"id\\\":\\\"test\\\"}]}\",\"RS_BACKEND\":\"solr\"}}" + expectedContext := "{\"request\":{\"body\":\"{\\\"test\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"test\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"search\\\\\\\"}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"query\\\":[{\\\"id\\\":\\\"test\\\"}]}\",\"RS_BACKEND\":\"solr\"}}" So(string(updatedContextInBytes), ShouldResemble, expectedContext) }) @@ -390,7 +390,7 @@ func TestSolrSearchQuery(t *testing.T) { So(err, ShouldBeNil) - expectedContext := "{\"request\":{\"body\":\"{\\\"second\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"second\\\\\\\",\\\\\\\"dataField\\\\\\\":\\\\\\\"summary_t\\\\\\\"}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"},\\\"test\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"test\\\\\\\",\\\\\\\"react\\\\\\\":{\\\\\\\"and\\\\\\\":\\\\\\\"second\\\\\\\"},\\\\\\\"value\\\\\\\":\\\\\\\"quark\\\\\\\"}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"fq\\\":\\\"(summary_t:*)\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"quark*\\\",\\\"qf\\\":\\\"\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"query\\\":[{\\\"id\\\":\\\"test\\\",\\\"react\\\":{\\\"and\\\":\\\"second\\\"},\\\"value\\\":\\\"quark\\\"},{\\\"dataField\\\":\\\"summary_t\\\",\\\"id\\\":\\\"second\\\"}]}\",\"RS_BACKEND\":\"solr\"}}" + expectedContext := "{\"request\":{\"body\":\"{\\\"second\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"second\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"search\\\\\\\",\\\\\\\"dataField\\\\\\\":\\\\\\\"summary_t\\\\\\\"}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"},\\\"test\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"test\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"search\\\\\\\",\\\\\\\"react\\\\\\\":{\\\\\\\"and\\\\\\\":\\\\\\\"second\\\\\\\"},\\\\\\\"value\\\\\\\":\\\\\\\"quark\\\\\\\"}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"fq\\\":\\\"(summary_t:*)\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"quark*\\\",\\\"qf\\\":\\\"\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"query\\\":[{\\\"id\\\":\\\"test\\\",\\\"react\\\":{\\\"and\\\":\\\"second\\\"},\\\"value\\\":\\\"quark\\\"},{\\\"dataField\\\":\\\"summary_t\\\",\\\"id\\\":\\\"second\\\"}]}\",\"RS_BACKEND\":\"solr\"}}" So(string(updatedContextInBytes), ShouldResemble, expectedContext) }) @@ -410,7 +410,7 @@ func TestSolrSearchQuery(t *testing.T) { So(err, ShouldBeNil) - expectedContext := "{\"request\":{\"body\":\"{\\\"test\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"test\\\\\\\",\\\\\\\"sortBy\\\\\\\":\\\\\\\"desc\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"quark\\\\\\\"}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"quark*\\\",\\\"qf\\\":\\\"\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"query\\\":[{\\\"id\\\":\\\"test\\\",\\\"sortBy\\\":\\\"desc\\\",\\\"value\\\":\\\"quark\\\"}]}\",\"RS_BACKEND\":\"solr\"}}" + expectedContext := "{\"request\":{\"body\":\"{\\\"test\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"test\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"search\\\\\\\",\\\\\\\"sortBy\\\\\\\":\\\\\\\"desc\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"quark\\\\\\\"}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"quark*\\\",\\\"qf\\\":\\\"\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"query\\\":[{\\\"id\\\":\\\"test\\\",\\\"sortBy\\\":\\\"desc\\\",\\\"value\\\":\\\"quark\\\"}]}\",\"RS_BACKEND\":\"solr\"}}" So(string(updatedContextInBytes), ShouldResemble, expectedContext) }) @@ -430,7 +430,7 @@ func TestSolrSearchQuery(t *testing.T) { So(err, ShouldBeNil) - expectedContext := "{\"request\":{\"body\":\"{\\\"test\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"test\\\\\\\",\\\\\\\"sortBy\\\\\\\":\\\\\\\"asc\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"quark\\\\\\\"}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"quark*\\\",\\\"qf\\\":\\\"\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score asc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"query\\\":[{\\\"id\\\":\\\"test\\\",\\\"sortBy\\\":\\\"asc\\\",\\\"value\\\":\\\"quark\\\"}]}\",\"RS_BACKEND\":\"solr\"}}" + expectedContext := "{\"request\":{\"body\":\"{\\\"test\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"test\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"search\\\\\\\",\\\\\\\"sortBy\\\\\\\":\\\\\\\"asc\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"quark\\\\\\\"}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"quark*\\\",\\\"qf\\\":\\\"\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score asc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"query\\\":[{\\\"id\\\":\\\"test\\\",\\\"sortBy\\\":\\\"asc\\\",\\\"value\\\":\\\"quark\\\"}]}\",\"RS_BACKEND\":\"solr\"}}" So(string(updatedContextInBytes), ShouldResemble, expectedContext) }) @@ -478,7 +478,7 @@ func TestSolrSearchQuery(t *testing.T) { So(err, ShouldBeNil) - expectedContext := "{\"request\":{\"body\":\"{\\\"result\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"result\\\\\\\",\\\\\\\"react\\\\\\\":{\\\\\\\"and\\\\\\\":[\\\\\\\"filter_by_product\\\\\\\",\\\\\\\"search\\\\\\\",\\\\\\\"Authors_0\\\\\\\",\\\\\\\"Categories_1\\\\\\\",\\\\\\\"Published_date_2\\\\\\\",\\\\\\\"ToggleResults\\\\\\\",\\\\\\\"result__internal\\\\\\\"]},\\\\\\\"dataField\\\\\\\":[\\\\\\\"published_dt\\\\\\\"],\\\\\\\"size\\\\\\\":9,\\\\\\\"sortBy\\\\\\\":\\\\\\\"desc\\\\\\\",\\\\\\\"includeFields\\\\\\\":[\\\\\\\"title_t\\\\\\\",\\\\\\\"published_dt\\\\\\\"],\\\\\\\"highlight\\\\\\\":true,\\\\\\\"execute\\\\\\\":true}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"title_t,published_dt,score,id\\\",\\\"hl\\\":\\\"true\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"photon OR production*\\\",\\\"rows\\\":\\\"9\\\",\\\"sort\\\":\\\"published_dt desc, id asc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"query\\\":[{\\\"dataField\\\":[\\\"published_dt\\\"],\\\"execute\\\":true,\\\"highlight\\\":true,\\\"id\\\":\\\"result\\\",\\\"includeFields\\\":[\\\"title_t\\\",\\\"published_dt\\\"],\\\"react\\\":{\\\"and\\\":[\\\"filter_by_product\\\",\\\"search\\\",\\\"Authors_0\\\",\\\"Categories_1\\\",\\\"Published_date_2\\\",\\\"ToggleResults\\\",\\\"result__internal\\\"]},\\\"size\\\":9,\\\"sortBy\\\":\\\"desc\\\",\\\"type\\\":\\\"search\\\"},{\\\"execute\\\":false,\\\"highlight\\\":false,\\\"id\\\":\\\"search\\\",\\\"react\\\":{\\\"and\\\":\\\"search__internal\\\"},\\\"size\\\":6,\\\"type\\\":\\\"search\\\",\\\"value\\\":\\\"photon production\\\"}]}\",\"RS_BACKEND\":\"solr\"}}" + expectedContext := "{\"request\":{\"body\":\"{\\\"result\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"result\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"search\\\\\\\",\\\\\\\"react\\\\\\\":{\\\\\\\"and\\\\\\\":[\\\\\\\"filter_by_product\\\\\\\",\\\\\\\"search\\\\\\\",\\\\\\\"Authors_0\\\\\\\",\\\\\\\"Categories_1\\\\\\\",\\\\\\\"Published_date_2\\\\\\\",\\\\\\\"ToggleResults\\\\\\\",\\\\\\\"result__internal\\\\\\\"]},\\\\\\\"dataField\\\\\\\":[\\\\\\\"published_dt\\\\\\\"],\\\\\\\"size\\\\\\\":9,\\\\\\\"sortBy\\\\\\\":\\\\\\\"desc\\\\\\\",\\\\\\\"includeFields\\\\\\\":[\\\\\\\"title_t\\\\\\\",\\\\\\\"published_dt\\\\\\\"],\\\\\\\"highlight\\\\\\\":true,\\\\\\\"execute\\\\\\\":true}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"title_t,published_dt,score,id\\\",\\\"hl\\\":\\\"true\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"photon OR production*\\\",\\\"rows\\\":\\\"9\\\",\\\"sort\\\":\\\"published_dt desc, id asc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"query\\\":[{\\\"dataField\\\":[\\\"published_dt\\\"],\\\"execute\\\":true,\\\"highlight\\\":true,\\\"id\\\":\\\"result\\\",\\\"includeFields\\\":[\\\"title_t\\\",\\\"published_dt\\\"],\\\"react\\\":{\\\"and\\\":[\\\"filter_by_product\\\",\\\"search\\\",\\\"Authors_0\\\",\\\"Categories_1\\\",\\\"Published_date_2\\\",\\\"ToggleResults\\\",\\\"result__internal\\\"]},\\\"size\\\":9,\\\"sortBy\\\":\\\"desc\\\",\\\"type\\\":\\\"search\\\"},{\\\"execute\\\":false,\\\"highlight\\\":false,\\\"id\\\":\\\"search\\\",\\\"react\\\":{\\\"and\\\":\\\"search__internal\\\"},\\\"size\\\":6,\\\"type\\\":\\\"search\\\",\\\"value\\\":\\\"photon production\\\"}]}\",\"RS_BACKEND\":\"solr\"}}" So(string(updatedContextInBytes), ShouldResemble, expectedContext) }) @@ -525,7 +525,7 @@ func TestSolrSearchQuery(t *testing.T) { So(err, ShouldBeNil) - expectedContext := "{\"request\":{\"body\":\"{\\\"Authors_0\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"Authors_0\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"term\\\\\\\",\\\\\\\"dataField\\\\\\\":[\\\\\\\"authors_ss\\\\\\\"],\\\\\\\"size\\\\\\\":5,\\\\\\\"sortBy\\\\\\\":\\\\\\\"count\\\\\\\",\\\\\\\"value\\\\\\\":[\\\\\\\"D. Zeppenfeld\\\\\\\"],\\\\\\\"showMissing\\\\\\\":false,\\\\\\\"execute\\\\\\\":true}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"facet\\\":\\\"true\\\",\\\"facet.field\\\":\\\"authors_ss\\\",\\\"facet.sort\\\":\\\"count\\\",\\\"fl\\\":\\\"score,*\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"D. Zeppenfeld\\\",\\\"rows\\\":\\\"5\\\",\\\"sort\\\":\\\"id asc\\\",\\\"start\\\":\\\"0\\\"},\\\"result\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"result\\\\\\\",\\\\\\\"react\\\\\\\":{\\\\\\\"and\\\\\\\":[\\\\\\\"Authors_0\\\\\\\"]},\\\\\\\"dataField\\\\\\\":[\\\\\\\"_score\\\\\\\"],\\\\\\\"size\\\\\\\":9,\\\\\\\"sortBy\\\\\\\":\\\\\\\"desc\\\\\\\",\\\\\\\"highlight\\\\\\\":true,\\\\\\\"defaultQuery\\\\\\\":{\\\\\\\"track_total_hits\\\\\\\":true},\\\\\\\"execute\\\\\\\":true}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"fq\\\":\\\"((((authors_ss:\\\\\\\"D. Zeppenfeld\\\\\\\"))))\\\",\\\"hl\\\":\\\"true\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"9\\\",\\\"sort\\\":\\\"score desc, id asc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"query\\\":[{\\\"dataField\\\":[\\\"authors_ss\\\"],\\\"execute\\\":true,\\\"id\\\":\\\"Authors_0\\\",\\\"selectAllLabel\\\":null,\\\"showMissing\\\":false,\\\"size\\\":5,\\\"sortBy\\\":\\\"count\\\",\\\"type\\\":\\\"term\\\",\\\"value\\\":[\\\"D. Zeppenfeld\\\"]},{\\\"dataField\\\":[\\\"_score\\\"],\\\"defaultQuery\\\":{\\\"track_total_hits\\\":true},\\\"execute\\\":true,\\\"highlight\\\":true,\\\"id\\\":\\\"result\\\",\\\"react\\\":{\\\"and\\\":[\\\"Authors_0\\\"]},\\\"size\\\":9,\\\"sortBy\\\":\\\"desc\\\",\\\"type\\\":\\\"search\\\"}]}\",\"RS_BACKEND\":\"solr\"}}" + expectedContext := "{\"request\":{\"body\":\"{\\\"Authors_0\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"Authors_0\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"term\\\\\\\",\\\\\\\"dataField\\\\\\\":[\\\\\\\"authors_ss\\\\\\\"],\\\\\\\"size\\\\\\\":5,\\\\\\\"sortBy\\\\\\\":\\\\\\\"count\\\\\\\",\\\\\\\"value\\\\\\\":[\\\\\\\"D. Zeppenfeld\\\\\\\"],\\\\\\\"showMissing\\\\\\\":false,\\\\\\\"execute\\\\\\\":true}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"facet\\\":\\\"true\\\",\\\"facet.field\\\":\\\"authors_ss\\\",\\\"facet.sort\\\":\\\"count\\\",\\\"fl\\\":\\\"score,*\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"D. Zeppenfeld\\\",\\\"rows\\\":\\\"5\\\",\\\"sort\\\":\\\"id asc\\\",\\\"start\\\":\\\"0\\\"},\\\"result\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"result\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"search\\\\\\\",\\\\\\\"react\\\\\\\":{\\\\\\\"and\\\\\\\":[\\\\\\\"Authors_0\\\\\\\"]},\\\\\\\"dataField\\\\\\\":[\\\\\\\"_score\\\\\\\"],\\\\\\\"size\\\\\\\":9,\\\\\\\"sortBy\\\\\\\":\\\\\\\"desc\\\\\\\",\\\\\\\"highlight\\\\\\\":true,\\\\\\\"defaultQuery\\\\\\\":{\\\\\\\"track_total_hits\\\\\\\":true},\\\\\\\"execute\\\\\\\":true}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"fq\\\":\\\"((((authors_ss:\\\\\\\"D. Zeppenfeld\\\\\\\"))))\\\",\\\"hl\\\":\\\"true\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"9\\\",\\\"sort\\\":\\\"score desc, id asc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"query\\\":[{\\\"dataField\\\":[\\\"authors_ss\\\"],\\\"execute\\\":true,\\\"id\\\":\\\"Authors_0\\\",\\\"selectAllLabel\\\":null,\\\"showMissing\\\":false,\\\"size\\\":5,\\\"sortBy\\\":\\\"count\\\",\\\"type\\\":\\\"term\\\",\\\"value\\\":[\\\"D. Zeppenfeld\\\"]},{\\\"dataField\\\":[\\\"_score\\\"],\\\"defaultQuery\\\":{\\\"track_total_hits\\\":true},\\\"execute\\\":true,\\\"highlight\\\":true,\\\"id\\\":\\\"result\\\",\\\"react\\\":{\\\"and\\\":[\\\"Authors_0\\\"]},\\\"size\\\":9,\\\"sortBy\\\":\\\"desc\\\",\\\"type\\\":\\\"search\\\"}]}\",\"RS_BACKEND\":\"solr\"}}" So(string(updatedContextInBytes), ShouldResemble, expectedContext) }) @@ -605,7 +605,7 @@ func TestSolrSearchQuery(t *testing.T) { So(err, ShouldBeNil) - expectedContext := "{\"request\":{\"body\":\"{\\\"result\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"result\\\\\\\",\\\\\\\"react\\\\\\\":{\\\\\\\"and\\\\\\\":[\\\\\\\"search\\\\\\\"]},\\\\\\\"dataField\\\\\\\":[\\\\\\\"title_t\\\\\\\"],\\\\\\\"size\\\\\\\":9,\\\\\\\"execute\\\\\\\":true}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"fq\\\":\\\"(((title_t:*)))\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"9\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"},\\\"search\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"search\\\\\\\",\\\\\\\"react\\\\\\\":{\\\\\\\"and\\\\\\\":\\\\\\\"search__internal\\\\\\\"},\\\\\\\"dataField\\\\\\\":[\\\\\\\"title_t\\\\\\\"],\\\\\\\"value\\\\\\\":\\\\\\\"\\\\\\\",\\\\\\\"execute\\\\\\\":true}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"fq\\\":\\\"\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"query\\\":[{\\\"dataField\\\":[\\\"title_t\\\"],\\\"execute\\\":true,\\\"id\\\":\\\"result\\\",\\\"react\\\":{\\\"and\\\":[\\\"search\\\"]},\\\"size\\\":9,\\\"type\\\":\\\"search\\\"},{\\\"dataField\\\":[\\\"title_t\\\"],\\\"execute\\\":true,\\\"id\\\":\\\"search\\\",\\\"react\\\":{\\\"and\\\":\\\"search__internal\\\"},\\\"type\\\":\\\"search\\\",\\\"value\\\":\\\"\\\"}]}\",\"RS_BACKEND\":\"solr\"}}" + expectedContext := "{\"request\":{\"body\":\"{\\\"result\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"result\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"search\\\\\\\",\\\\\\\"react\\\\\\\":{\\\\\\\"and\\\\\\\":[\\\\\\\"search\\\\\\\"]},\\\\\\\"dataField\\\\\\\":[\\\\\\\"title_t\\\\\\\"],\\\\\\\"size\\\\\\\":9,\\\\\\\"execute\\\\\\\":true}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"fq\\\":\\\"(((title_t:*)))\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"9\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"},\\\"search\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"search\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"search\\\\\\\",\\\\\\\"react\\\\\\\":{\\\\\\\"and\\\\\\\":\\\\\\\"search__internal\\\\\\\"},\\\\\\\"dataField\\\\\\\":[\\\\\\\"title_t\\\\\\\"],\\\\\\\"value\\\\\\\":\\\\\\\"\\\\\\\",\\\\\\\"execute\\\\\\\":true}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"fq\\\":\\\"\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"query\\\":[{\\\"dataField\\\":[\\\"title_t\\\"],\\\"execute\\\":true,\\\"id\\\":\\\"result\\\",\\\"react\\\":{\\\"and\\\":[\\\"search\\\"]},\\\"size\\\":9,\\\"type\\\":\\\"search\\\"},{\\\"dataField\\\":[\\\"title_t\\\"],\\\"execute\\\":true,\\\"id\\\":\\\"search\\\",\\\"react\\\":{\\\"and\\\":\\\"search__internal\\\"},\\\"type\\\":\\\"search\\\",\\\"value\\\":\\\"\\\"}]}\",\"RS_BACKEND\":\"solr\"}}" So(string(updatedContextInBytes), ShouldResemble, expectedContext) }) @@ -627,7 +627,7 @@ func TestSolrSearchQuery(t *testing.T) { So(err, ShouldBeNil) - expectedContext := "{\"request\":{\"body\":\"{\\\"test\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"test\\\\\\\",\\\\\\\"dataField\\\\\\\":[\\\\\\\"_score\\\\\\\"],\\\\\\\"sortBy\\\\\\\":\\\\\\\"desc\\\\\\\"}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc, id asc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"query\\\":[{\\\"dataField\\\":[\\\"_score\\\"],\\\"id\\\":\\\"test\\\",\\\"sortBy\\\":\\\"desc\\\"}]}\",\"RS_BACKEND\":\"solr\"}}" + expectedContext := "{\"request\":{\"body\":\"{\\\"test\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"test\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"search\\\\\\\",\\\\\\\"dataField\\\\\\\":[\\\\\\\"_score\\\\\\\"],\\\\\\\"sortBy\\\\\\\":\\\\\\\"desc\\\\\\\"}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc, id asc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"query\\\":[{\\\"dataField\\\":[\\\"_score\\\"],\\\"id\\\":\\\"test\\\",\\\"sortBy\\\":\\\"desc\\\"}]}\",\"RS_BACKEND\":\"solr\"}}" So(string(updatedContextInBytes), ShouldResemble, expectedContext) }) @@ -814,7 +814,7 @@ func TestSolrGeoQuery(t *testing.T) { So(err, ShouldBeNil) - expectedContext := "{\"request\":{\"body\":\"{\\\"second\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"second\\\\\\\",\\\\\\\"react\\\\\\\":{\\\\\\\"and\\\\\\\":\\\\\\\"test\\\\\\\"}}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"fq\\\":\\\"(location_t:\\\\\\\"[33.790687,-96.797901 TO 32.790686,-95.797901]\\\\\\\")\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"query\\\":[{\\\"dataField\\\":\\\"location_t\\\",\\\"execute\\\":false,\\\"id\\\":\\\"test\\\",\\\"type\\\":\\\"geo\\\",\\\"value\\\":{\\\"geoBoundingBox\\\":{\\\"bottomRight\\\":\\\"33.7906866,-95.7979006\\\",\\\"topLeft\\\":\\\"32.7906865,-96.7979007\\\"}}},{\\\"id\\\":\\\"second\\\",\\\"react\\\":{\\\"and\\\":\\\"test\\\"}}]}\",\"RS_BACKEND\":\"solr\"}}" + expectedContext := "{\"request\":{\"body\":\"{\\\"second\\\":{\\\"\\\":\\\"\\\",\\\"_index\\\":\\\"\\\",\\\"_original\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"second\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"search\\\\\\\",\\\\\\\"react\\\\\\\":{\\\\\\\"and\\\\\\\":\\\\\\\"test\\\\\\\"}}\\\",\\\"defType\\\":\\\"edismax\\\",\\\"fl\\\":\\\"score,*\\\",\\\"fq\\\":\\\"(location_t:\\\\\\\"[33.790687,-96.797901 TO 32.790686,-95.797901]\\\\\\\")\\\",\\\"hl\\\":\\\"false\\\",\\\"hl.fl\\\":\\\"*\\\",\\\"q\\\":\\\"*\\\",\\\"rows\\\":\\\"10\\\",\\\"sort\\\":\\\"score desc\\\",\\\"start\\\":\\\"0\\\"}}\",\"headers\":null,\"url\":\"\",\"method\":\"\"},\"response\":{\"code\":200,\"body\":\"\",\"headers\":{}},\"envs\":{\"INDEPENDENT_REQUESTS\":\"[]\",\"ML_QS_PARAMS\":\"\",\"ORIGINAL_RS_BODY\":\"{\\\"query\\\":[{\\\"dataField\\\":\\\"location_t\\\",\\\"execute\\\":false,\\\"id\\\":\\\"test\\\",\\\"type\\\":\\\"geo\\\",\\\"value\\\":{\\\"geoBoundingBox\\\":{\\\"bottomRight\\\":\\\"33.7906866,-95.7979006\\\",\\\"topLeft\\\":\\\"32.7906865,-96.7979007\\\"}}},{\\\"id\\\":\\\"second\\\",\\\"react\\\":{\\\"and\\\":\\\"test\\\"}}]}\",\"RS_BACKEND\":\"solr\"}}" So(string(updatedContextInBytes), ShouldResemble, expectedContext) }) diff --git a/plugins/querytranslate/handlers.go b/plugins/querytranslate/handlers.go index 80c26270..d0d5d192 100644 --- a/plugins/querytranslate/handlers.go +++ b/plugins/querytranslate/handlers.go @@ -504,6 +504,10 @@ func UnOptimizeResponse(response []byte, queryIdToMSearchDetails []MSearchDetail return response, nil } + if len(queryIdToMSearchDetails) == 0 { + return response, nil + } + for _, mSearchDetails := range queryIdToMSearchDetails { queryReferenced, queryValueType, _, getErr := jsonparser.Get(response, "responses", fmt.Sprintf("[%d]", mSearchDetails.index)) if getErr != nil { @@ -553,7 +557,12 @@ func UnOptimizeResponse(response []byte, queryIdToMSearchDetails []MSearchDetail // Reset the older response to an array with size of the un-optimized // responses array. - emptyArrStr := []byte("[" + strings.Repeat("{},", len(unOptimizedResponses)-1) + "{}" + "]") + repetitions := "" + if len(unOptimizedResponses) > 0 { + repetitions = strings.Repeat("{},", len(unOptimizedResponses)-1) + } + + emptyArrStr := []byte("[" + repetitions + "{}" + "]") olderResponsesReset, resetErr := jsonparser.Set(response, emptyArrStr, "responses") if resetErr != nil { return nil, fmt.Errorf("error while setting responses key as empty array: %s", resetErr.Error()) diff --git a/plugins/querytranslate/util.go b/plugins/querytranslate/util.go index 746e07a7..6547fc5b 100644 --- a/plugins/querytranslate/util.go +++ b/plugins/querytranslate/util.go @@ -523,7 +523,7 @@ type AIConfig struct { // Query represents the query object type Query struct { ID *string `json:"id,omitempty" jsonschema:"title=id,description=ID of the query,required" jsonschema_extras:"engine=elasticsearch,engine=mongodb,engine=solr,engine=opensearch"` // component id - Type QueryType `json:"type,omitempty" jsonschema:"title=type,description=type of query" jsonschema_extras:"engine=elasticsearch,engine=mongodb,engine=solr,engine=opensearch"` + Type QueryType `json:"type" jsonschema:"title=type,description=type of query" jsonschema_extras:"engine=elasticsearch,engine=mongodb,engine=solr,engine=opensearch"` React *map[string]interface{} `json:"react,omitempty" jsonschema:"title=react,description=which queries to react the current query with" jsonschema_extras:"engine=elasticsearch,engine=mongodb,engine=solr,engine=opensearch"` QueryFormat *string `json:"queryFormat,omitempty" jsonschema:"title=queryFormat,description=the operator to join multiple values in the query.value field" jsonschema_extras:"engine=elasticsearch,engine=mongodb,engine=solr,engine=opensearch"` DataField interface{} `json:"dataField,omitempty" jsonschema:"title=dataField,description=fields to run the query term on" jsonschema_extras:"engine=elasticsearch,engine=mongodb,engine=solr,engine=opensearch"` From 1bd5d57c80a8e3aa616aae5bb5a9897a67f8f717 Mon Sep 17 00:00:00 2001 From: Siddharth Kothari Date: Thu, 27 Jun 2024 19:44:25 +0700 Subject: [PATCH 02/13] chore: add binary publish flow --- .github/workflows/binary-publish.yml | 140 +++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 .github/workflows/binary-publish.yml diff --git a/.github/workflows/binary-publish.yml b/.github/workflows/binary-publish.yml new file mode 100644 index 00000000..037dedd7 --- /dev/null +++ b/.github/workflows/binary-publish.yml @@ -0,0 +1,140 @@ +name: build binary +on: + release: + types: [published] + +jobs: + determine_whether_to_run: + runs-on: ubuntu-latest + outputs: + build_arc: ${{ steps.check-build-arc.outputs.run_jobs }} + build_sls: ${{ steps.check-build-sls.outputs.run_jobs }} + version: ${{ steps.get-version.outputs.version }} + + steps: + - name: Check if Arc binary should be built + id: check-build-arc + run: | + TAG_NAME="${{ github.event.release.tag_name }}" + echo "Checking tag $TAG_NAME for ARC build" + (echo "$TAG_NAME" | grep -Eq '^8\.[0-9]+\.[0-9]+$') && echo "run_jobs=true" >> $GITHUB_OUTPUT || echo "run_jobs=false" >> $GITHUB_OUTPUT + + - name: Check if SLS binary should be built + id: check-build-sls + run: | + TAG_NAME="${{ github.event.release.tag_name }}" + echo "Checking tag $TAG_NAME for SLS build" + (echo "$TAG_NAME" | grep -Eq '^1\.[0-9]+\.[0-9]+$') && echo "run_jobs=true" >> $GITHUB_OUTPUT || echo "run_jobs=false" >> $GITHUB_OUTPUT + + - name: Get the version from the tag + id: get-version + run: echo "version=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT + + build-arc: + name: Build ARC binary + needs: determine_whether_to_run + if: needs.determine_whether_to_run.outputs.build_arc == 'true' + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: building binaries for ami + uses: appleboy/ssh-action@v0.1.7 + env: + VERSION: ${{ github.event.release.tag_name }} + with: + host: ${{ secrets.AWS_BUILD_HOST }} + username: ${{ secrets.AWS_BUILD_USERNAME }} + key: ${{ secrets.AWS_BUILD_KEY }} + port: 22 + envs: VERSION + script: | + export PATH=$PATH:/usr/local/go/bin && sh build.sh ${VERSION} + - name: Build AMI + uses: hashicorp/packer-github-actions@master + with: + command: build + target: "./ami.json" + env: + PACKER_LOG: 1 + AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }} + AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }} + VERSION: ${{ github.event.release.tag_name }} + - name: building binaries for eaas deployments + uses: appleboy/ssh-action@v0.1.7 + env: + VERSION: ${{ github.event.release.tag_name }} + with: + host: ${{ secrets.GCLOUD_BUILD_HOST }} + username: ${{ secrets.GCLOUD_BUILD_USERNAME }} + key: ${{ secrets.GCLOUD_BUILD_KEY }} + port: 22 + timeout: 3600s + command_timeout: 3600s + envs: VERSION + script: | + source ~/.bashrc + export PATH=$PATH:/usr/local/go/bin:/usr/bin + export GOPATH=/home/centos/go + ./build.sh ${VERSION} + + build-sls: + name: Build SLS binary + needs: determine_whether_to_run + if: needs.determine_whether_to_run.outputs.build_sls == 'true' + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: building binaries for eaas deployments + uses: appleboy/ssh-action@v0.1.7 + env: + VERSION: ${{ github.event.release.tag_name }} + with: + host: ${{ secrets.GCLOUD_BUILD_HOST }} + username: ${{ secrets.GCLOUD_BUILD_USERNAME }} + key: ${{ secrets.GCLOUD_BUILD_KEY }} + port: 22 + timeout: 3600s + command_timeout: 3600s + envs: VERSION + script: | + source ~/.bashrc + export PATH=$PATH:/usr/local/go/bin:/usr/bin + export GOPATH=/home/centos/go + ./sls-build.sh ${VERSION} feat/true-sls + + send-packer-event-arc: + name: Send Packer Event + needs: build-arc + uses: ./.github/workflows/build_images.yml + with: + ref: ${{ github.ref }} + event_name: new_release + secrets: + token: ${{ secrets.REPO_ACCESS_TOKEN }} + + send-packer-event-sls: + name: Send Packer Event + needs: build-sls + uses: ./.github/workflows/build_images.yml + with: + ref: ${{ github.ref }} + event_name: new_sls_release + secrets: + token: ${{ secrets.REPO_ACCESS_TOKEN }} + + send-docker-event-arc: + name: Send Docker Event + needs: [build-arc, determine_whether_to_run] + runs-on: ubuntu-latest + steps: + - name: Send repo dispatch + uses: peter-evans/repository-dispatch@v2 + with: + token: ${{ secrets.REPO_ACCESS_TOKEN }} + repository: appbaseio-confidential/rs-api-server + event-type: publish_docker + client-payload: '{"version": "${{ needs.determine_whether_to_run.outputs.version }}" }' \ No newline at end of file From 6921b4fe6305f2d728a7ee14dec040d8f9ed9026 Mon Sep 17 00:00:00 2001 From: Siddharth Kothari Date: Thu, 27 Jun 2024 19:54:43 +0700 Subject: [PATCH 03/13] chore: add build_images workflow --- .github/workflows/build_images.yml | 38 ++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/build_images.yml diff --git a/.github/workflows/build_images.yml b/.github/workflows/build_images.yml new file mode 100644 index 00000000..d7cd323d --- /dev/null +++ b/.github/workflows/build_images.yml @@ -0,0 +1,38 @@ +name: Send Build Image Event + +on: + workflow_call: + inputs: + ref: + required: true + type: string + event_name: + required: true + type: string + secrets: + token: + required: true + +jobs: + determine_whether_to_run: + runs-on: ubuntu-latest + outputs: + send_event: ${{ steps.check-send-event.outputs.run_jobs }} + + steps: + - name: Check if event should be sent + id: check-send-event + run: (echo "${{ inputs.ref }}" | grep -Eq '^refs\/tags\/[0-9]+\.[0-9]+\.[0-9]+$') && echo "::set-output name=run_jobs::true" || echo "::set-output name=run_jobs::false" + + send_event: + needs: determine_whether_to_run + runs-on: ubuntu-latest + if: needs.determine_whether_to_run.outputs.send_event == 'true' + + steps: + - name: Send Repo Dispatch Event + uses: peter-evans/repository-dispatch@v2 + with: + token: ${{ secrets.token }} + repository: appbaseio-confidential/elasticsearch-packer-build + event-type: ${{ inputs.event_name }} \ No newline at end of file From 58de34193345e211379d95ca3f50bb2e0b674d55 Mon Sep 17 00:00:00 2001 From: Siddharth Kothari Date: Thu, 27 Jun 2024 19:55:13 +0700 Subject: [PATCH 04/13] fix (schema): update create-schema to handle update-schema as well --- .github/workflows/create-schema.yml | 35 +++++++++++------------------ 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/.github/workflows/create-schema.yml b/.github/workflows/create-schema.yml index c2de2e23..b452de50 100644 --- a/.github/workflows/create-schema.yml +++ b/.github/workflows/create-schema.yml @@ -1,42 +1,34 @@ name: Create Schema for latest release on: - repository_dispatch: - types: [create_schema] - workflow_dispatch: + release: + types: [published] jobs: + determine_whether_to_run: + runs-on: ubuntu-latest + outputs: + update_schema: ${{ steps.check-update-schema.outputs.run_jobs }} + + steps: + - name: Check if event should be sent + id: check-update-schema + run: (echo "${{ github.ref }}" | grep -Eq '^refs\/tags\/[0-9]+\.[0-9]+\.[0-9]+$') && echo "::set-output name=run_jobs::true" || echo "::set-output name=run_jobs::false" create_schema: runs-on: ubuntu-latest + needs: determine_whether_to_run + if: needs.determine_whether_to_run.outputs.update_schema == 'true' name: Create Schema steps: - name: Checkout noss Repo uses: actions/checkout@v3 - with: - path: noss - - - name: Checkout oss repo - uses: actions/checkout@v3 - with: - repository: appbaseio/reactivesearch-api - path: oss - token: ${{ secrets.REPO_ACCESS_TOKEN }} - name: Make clean and build run: make clean && make - working-directory: ./noss - name: Generate the latest schema run: ./build/reactivesearch --create-schema - working-directory: ./noss - - - name: Remove older schema - run: rm schema -rf - working-directory: ./oss - - - name: Copy the built schema to oss - run: cp -r noss/schema oss/ - name: Add and Commit changes uses: EndBug/add-and-commit@v9 @@ -45,4 +37,3 @@ jobs: default_author: github_actions message: Update schema for latest release push: true - cwd: ./oss From bf6ccfc03ed09d7541f1b3feff27e2491f21a4bd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 27 Jun 2024 19:56:44 +0700 Subject: [PATCH 05/13] chore(deps): bump golang.org/x/net from 0.10.0 to 0.23.0 (#383) Bumps [golang.org/x/net](https://github.com/golang/net) from 0.10.0 to 0.23.0. - [Commits](https://github.com/golang/net/compare/v0.10.0...v0.23.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 8 ++++---- go.sum | 21 +++++++++++++-------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 171aa8b8..c9d5d315 100644 --- a/go.mod +++ b/go.mod @@ -43,10 +43,10 @@ require ( github.com/ulule/limiter v2.2.2+incompatible go.kuoruan.net/v8go-polyfills v0.5.0 go.mongodb.org/mongo-driver v1.12.0 - golang.org/x/crypto v0.9.0 - golang.org/x/net v0.10.0 - golang.org/x/sys v0.8.0 - golang.org/x/text v0.10.0 + golang.org/x/crypto v0.21.0 + golang.org/x/net v0.23.0 + golang.org/x/sys v0.18.0 + golang.org/x/text v0.14.0 gopkg.in/DataDog/dd-trace-go.v1 v1.52.0 gopkg.in/natefinch/lumberjack.v2 v2.0.0 gopkg.in/olivere/elastic.v6 v6.2.26 diff --git a/go.sum b/go.sum index 4dea7a7e..6ca2bc40 100644 --- a/go.sum +++ b/go.sum @@ -2178,8 +2178,10 @@ golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80 golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= -golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -2324,8 +2326,10 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -2529,8 +2533,10 @@ golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -2545,6 +2551,8 @@ golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -2561,8 +2569,8 @@ golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58= -golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -3119,12 +3127,9 @@ modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= modernc.org/z v1.5.1/go.mod h1:eWFB510QWW5Th9YGZT81s+LwvaAs3Q2yr4sP0rmLkv8= moul.io/http2curl v1.0.0 h1:6XwpyZOYsgZJrU8exnG87ncVkU1FVCcTRpwzOkTDUi8= moul.io/http2curl v1.0.0/go.mod h1:f6cULg+e4Md/oW1cYmwW4IWQOVl2lGbmCNGOHvzX2kE= -rogchap.com/v8go v0.7.0 h1:kgjbiO4zE5itA962ze6Hqmbs4HgZbGzmueCXsZtremg= rogchap.com/v8go v0.7.0/go.mod h1:MxgP3pL2MW4dpme/72QRs8sgNMmM0pRc8DPhcuLWPAs= rogchap.com/v8go v0.8.0 h1:/crDEiga68kOtbIqw3K9Rt9OztYz0LhAPHm2e3wK7Q4= rogchap.com/v8go v0.8.0/go.mod h1:MxgP3pL2MW4dpme/72QRs8sgNMmM0pRc8DPhcuLWPAs= -rogchap.com/v8go v0.9.0 h1:wYbUCO4h6fjTamziHrzyrPnpFNuzPpjZY+nfmZjNaew= -rogchap.com/v8go v0.9.0/go.mod h1:MxgP3pL2MW4dpme/72QRs8sgNMmM0pRc8DPhcuLWPAs= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= From fd3ac0c2c5ba15968f62a400e4f47d3fbec7f43b Mon Sep 17 00:00:00 2001 From: Siddharth Kothari Date: Thu, 27 Jun 2024 20:08:57 +0700 Subject: [PATCH 06/13] fix (build): fetch next branch so pushing is possible, trigger by workflow_dispatch --- .github/workflows/create-schema.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-schema.yml b/.github/workflows/create-schema.yml index b452de50..d92935ea 100644 --- a/.github/workflows/create-schema.yml +++ b/.github/workflows/create-schema.yml @@ -3,6 +3,7 @@ name: Create Schema for latest release on: release: types: [published] + workflow_dispatch: jobs: determine_whether_to_run: @@ -14,6 +15,7 @@ jobs: - name: Check if event should be sent id: check-update-schema run: (echo "${{ github.ref }}" | grep -Eq '^refs\/tags\/[0-9]+\.[0-9]+\.[0-9]+$') && echo "::set-output name=run_jobs::true" || echo "::set-output name=run_jobs::false" + create_schema: runs-on: ubuntu-latest needs: determine_whether_to_run @@ -21,8 +23,10 @@ jobs: name: Create Schema steps: - - name: Checkout noss Repo + - name: Checkout oss Repo uses: actions/checkout@v3 + with: + ref: next - name: Make clean and build run: make clean && make @@ -36,4 +40,4 @@ jobs: add: schema default_author: github_actions message: Update schema for latest release - push: true + push: true \ No newline at end of file From ba3457b611f85e8020d47bbaddcaa149ebce8b6c Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 27 Jun 2024 13:13:50 +0000 Subject: [PATCH 07/13] Update schema for latest release --- schema/latest/schema.json | 145 +++++++++++++++++++++++++++++++++++--- 1 file changed, 136 insertions(+), 9 deletions(-) diff --git a/schema/latest/schema.json b/schema/latest/schema.json index 0bc9853d..1f45c26d 100644 --- a/schema/latest/schema.json +++ b/schema/latest/schema.json @@ -63,6 +63,8 @@ "recentSuggestionsConfig", "enablePopularSuggestions", "popularSuggestionsConfig", + "enableFAQSuggestions", + "FAQSuggestionsConfig", "showDistinctSuggestions", "enablePredictiveSuggestions", "maxPredictedWords", @@ -86,9 +88,67 @@ "includeValues", "excludeValues", "searchboxId", - "range" + "faqSearchboxId", + "range", + "enableAI", + "AIConfig", + "compoundClause", + "enableDocumentSuggestions", + "documentSuggestionsConfig" ], "properties": { + "AIConfig": { + "additionalProperties": false, + "description": "Configuration for the AnswerAI part of the query. This will only be considered if 'enableAI' is set to 'true'", + "engine": "opensearch", + "markdownDescription": "This field adds support for passing various details for the AIAnswer functionality. There are multiple fields accepted in this object. Following is an example body:\n\n```json\n{\n 'docTemplate': '${source.title} is ${source.overview} with url ${source.backdrop_path}',\n 'queryTemplate': 'Can you tell me about ${value}'\n}\n```\n\nThe fields supported by the AIConfig object are: \n\n- **docTemplate**: Template to use for building the message sent to ChatGPT for every hit of the response. The `docTemplate` string supports dynamic values using the special syntax `${}`. These values are resolved while the ChatGPT request body is built. It supports keys that are present in the `_source` field in the response hits. As an example, `source.title` will resolve to `_source.title`. If values are not found, defaults to an empty string. \n- **queryTemplate**: Template to use for building the message that is sent to ChatGPT as the final question. Defaults to `Can you tell me about ${value}` where `value` is the `query.value`. The querytemplate string supports a dynamic value of `value` which is the query.value of the query. \n- **topDocsForContext**: Number of docs to use to build the context. Defaults to 3. This has an upper limit as the total number of hits returned. \n- **systemPrompt**: The system prompt to send as the first message to ChatGPT. Defaults to `You are a helpful assistant`.\n- **maxTokens**: The maximum tokens that can be used for the output. Defaults to 300. Accepts a value between [1, 2048]. \n- **minTokens**: Minimum number of tokens to generate in the response. Whenever possible, max tokens is respected, however when the input context + max tokens combined exceed the model limit, the min tokens value is used to calibrate for an optimum output token. Defaults to 100. \n- **temperature**: A control for randomness, a lower value implies a more deterministic output. Defaults to 1, valid values are between [0, 2].", + "properties": { + "docTemplate": { + "type": "string" + }, + "maxTokens": { + "type": "integer" + }, + "minTokens": { + "type": "integer" + }, + "queryTemplate": { + "type": "string" + }, + "strictSelection": { + "type": "boolean" + }, + "systemPrompt": { + "type": "string" + }, + "temperature": { + "type": "number" + }, + "topDocsForContext": { + "type": "integer" + } + }, + "title": "AI Config", + "type": "object" + }, + "FAQSuggestionsConfig": { + "additionalProperties": false, + "description": "additional options for getting FAQ suggestions", + "engine": [ + "elasticsearch", + "opensearch" + ], + "properties": { + "sectionLabel": { + "type": "string" + }, + "size": { + "type": "integer" + } + }, + "title": "FAQSuggestionsConfig", + "type": "object" + }, "after": { "description": "pagination for aggregations", "engine": [ @@ -219,6 +279,15 @@ }, "title": "categoryValue" }, + "compoundClause": { + "description": "Configure whether the DSL query is generated with the compound clause of 'must' (default for 'search' and 'geo') or 'filter' (default for 'range' and 'term'). Setting the compound clause to filter allows search engine to cache and allows for higher throughput in cases where scoring isn't relevant (e.g. term", + "engine": [ + "opensearch", + "elasticsearch" + ], + "title": "Compound Clause", + "type": "integer" + }, "customHighlight": { "description": "(deprecated) same as highlightConfig", "engine": [ @@ -351,6 +420,46 @@ "title": "distinctFieldConfig", "type": "object" }, + "documentSuggestionsConfig": { + "additionalProperties": false, + "description": "additional options to specify for document suggestions", + "engine": [ + "elasticsearch", + "opensearch" + ], + "properties": { + "from": { + "type": "integer" + }, + "maxChars": { + "type": "integer" + }, + "sectionLabel": { + "type": "string" + }, + "size": { + "type": "integer" + } + }, + "title": "documentSuggestionsConfig", + "type": "object" + }, + "enableAI": { + "description": "Whether or not to enable Answer AI to inject AI based answer in the response", + "engine": "opensearch", + "markdownDescription": "This field indicates whether the query should use AIAnswer functionality to inject an answer response to the value", + "title": "enableAI", + "type": "boolean" + }, + "enableDocumentSuggestions": { + "description": "whether or not to enable document suggestions", + "engine": [ + "elasticsearch", + "opensearch" + ], + "title": "enableDocumentSuggestions", + "type": "boolean" + }, "enableEndpointSuggestions": { "description": "whether or not to enable endpoint suggestions", "engine": [ @@ -361,6 +470,15 @@ "title": "enableEndpointSuggestions", "type": "boolean" }, + "enableFAQSuggestions": { + "description": "whether or not to enable FAQ suggestions", + "engine": [ + "elasticsearch", + "opensearch" + ], + "title": "enableFAQSuggestions", + "type": "boolean" + }, "enableFeaturedSuggestions": { "description": "whether or not to enable featured suggestions", "engine": [ @@ -514,6 +632,15 @@ "title": "execute", "type": "boolean" }, + "faqSearchboxId": { + "description": "searchbox id for a faq suggestion query", + "engine": [ + "elasticsearch", + "opensearch" + ], + "title": "faqSearchboxId", + "type": "string" + }, "featuredSuggestionsConfig": { "additionalProperties": false, "description": "additional options to specify for featured suggestions", @@ -522,7 +649,7 @@ "solr", "opensearch" ], - "markdownDescription": "To define options to apply featured suggestions. It can accept the following keys:\n\n- **featuredSuggestionsGroupId**: `string` The featured suggestions group id is required to apply the featured suggestions. A featured suggestion group is a collection of featured suggestions.\nEndpoint to create a featured suggestions group: https://api.reactivesearch.io/#bdf8961b-322f-48f9-9562-c3e507fd0508\n\n- **maxSuggestionsPerSection**: `int` To restrict the number of featured suggestions per section.\n\n- **sectionsOrder**: `Array\u003cstring\u003e` To define the order of sections to be displayed in UI. For e.g, `[\\'document\\', \\'pages\\', \\'help\\']`.\n\n\n| \u003cp style=\"margin: 0px;\" class=\"table-header-text\"\u003eType\u003c/p\u003e | \u003cp style=\"margin: 0px;\" class=\"table-header-text\"\u003eApplicable on query of type\u003c/p\u003e | \u003cp style=\"margin: 0px;\" class=\"table-header-text\"\u003eRequired\u003c/p\u003e |\n| ------ | --------------------------- | -------- |\n| `Object` | `suggestion` | false |", + "markdownDescription": "To define options to apply featured suggestions. It can accept the following keys:\n\n- **maxSuggestionsPerSection**: `int` To restrict the number of featured suggestions per section.\n\n- **sectionsOrder**: `Array\u003cstring\u003e` To define the order of sections to be displayed in UI. For e.g, `[\\'document\\', \\'pages\\', \\'help\\']`.\n\n\n| \u003cp style=\"margin: 0px;\" class=\"table-header-text\"\u003eType\u003c/p\u003e | \u003cp style=\"margin: 0px;\" class=\"table-header-text\"\u003eApplicable on query of type\u003c/p\u003e | \u003cp style=\"margin: 0px;\" class=\"table-header-text\"\u003eRequired\u003c/p\u003e |\n| ------ | --------------------------- | -------- |\n| `Object` | `suggestion` | false |", "properties": { "maxSuggestionsPerSection": { "type": "integer" @@ -549,7 +676,7 @@ "items": { "type": "number" }, - "markdownDescription": "To set the search weight for the database fields, useful when you are using more than one [dataField](/docs/search/reactivesearch-api/reference/#datafield). This prop accepts an array of `floats`. A higher number implies a higher relevance weight for the corresponding field in the search results.\n\nFor example, the below query has two data fields defined and each field has a different field weight.\n\n```js\n{\n query: [{\n id: \"book-search\",\n dataField: [\"original_title\", \"description\"],\n fieldWeights: [3, 1],\n value: \"harry\"\n }]\n}\n```\n\n| \u003cp style=\"margin: 0px;\" class=\"table-header-text\"\u003eType\u003c/p\u003e | \u003cp style=\"margin: 0px;\" class=\"table-header-text\"\u003eApplicable on query of type\u003c/p\u003e | \u003cp style=\"margin: 0px;\" class=\"table-header-text\"\u003eRequired\u003c/p\u003e |\n| ------------ | --------------------------- | -------- |\n| `Array\u003cint\u003e` | `search`,`suggestion` | false |\n\n\u003e Note: The `fieldWeights` property has been marked as deprecated in \u003cb\u003ev7.47.0\u003c/b\u003e and would be removed in the next major version of appbase.io. We recommend you to use the [dataField](/docs/search/reactivesearch-api/reference/#datafield) property to define the weights.", + "markdownDescription": "To set the search weight for the database fields, useful when you are using more than one [dataField](/docs/search/reactivesearch-api/reference/#datafield). This prop accepts an array of `floats`. A higher number implies a higher relevance weight for the corresponding field in the search results.\n\nFor example, the below query has two data fields defined and each field has a different field weight.\n\n```js\n{\n query: [{\n id: \"book-search\",\n dataField: [\"original_title\", \"description\"],\n fieldWeights: [3, 1],\n value: \"harry\"\n }]\n}\n```\n\n| \u003cp style=\"margin: 0px;\" class=\"table-header-text\"\u003eType\u003c/p\u003e | \u003cp style=\"margin: 0px;\" class=\"table-header-text\"\u003eApplicable on query of type\u003c/p\u003e | \u003cp style=\"margin: 0px;\" class=\"table-header-text\"\u003eRequired\u003c/p\u003e |\n| ------------ | --------------------------- | -------- |\n| `Array\u003cint\u003e` | `search`,`suggestion` | false |\n\n\u003e Note: The `fieldWeights` property has been marked as deprecated in \u003cb\u003ev7.47.0\u003c/b\u003e and would be removed in the next major version of reactivesearch.io. We recommend you to use the [dataField](/docs/search/reactivesearch-api/reference/#datafield) property to define the weights.", "title": "fieldWeights", "type": "array" }, @@ -578,7 +705,7 @@ "mongodb", "opensearch" ], - "markdownDescription": "Useful for showing the correct results for an incorrect search parameter by taking the fuzziness into account. For example, with a substitution of one character, `fox` can become `box`. Read more about it in the elastic search https://www.elastic.co/guide/en/elasticsearch/guide/current/fuzziness.html.\n\n| \u003cp style=\"margin: 0px;\" class=\"table-header-text\"\u003eType\u003c/p\u003e | \u003cp style=\"margin: 0px;\" class=\"table-header-text\"\u003eApplicable on query of type\u003c/p\u003e | \u003cp style=\"margin: 0px;\" class=\"table-header-text\"\u003eRequired\u003c/p\u003e |\n| -------------- | --------------------------- | -------- |\n| `int | string` | `search`, `suggestion` | false |\n\n\u003e Note:\n\u003e\n\u003e This property doesn\\'t work when the value of [queryFormat](/docs/search/reactivesearch-api/reference/#queryformat) property is set to `and`.\"", + "markdownDescription": "Useful for showing the correct results for an incorrect search parameter by taking the fuzziness into account. For example, with a substitution of one character, `fox` can become `box`. Read more about it in the elastic search https://www.elastic.co/guide/en/elasticsearch/guide/current/fuzziness.html.\n\n| \u003cp style=\"margin: 0px;\" class=\"table-header-text\"\u003eType\u003c/p\u003e | \u003cp style=\"margin: 0px;\" class=\"table-header-text\"\u003eApplicable on query of type\u003c/p\u003e | \u003cp style=\"margin: 0px;\" class=\"table-header-text\"\u003eRequired\u003c/p\u003e |\n| -------------- | --------------------------- | -------- |\n| `int, string` | `search`, `suggestion` | false |\n\n\u003e Note:\n\u003e\n\u003e This property doesn\\'t work when the value of [queryFormat](/docs/search/reactivesearch-api/reference/#queryformat) property is set to `and`.\"", "playgroundURL": { "elasticsearch": "https://play.reactivesearch.io/embed/FfBZDt4981lxD2At3KuK", "mongodb": "https://play.reactivesearch.io/embed/CGaSSGlTPUOPmL4wv6Xb", @@ -1082,6 +1209,7 @@ "elasticsearch", "opensearch" ], + "markdownDescription": "When featured suggestions are enabled, set the value of the `searchboxId` to use for fetching them. This is configurable via ReactiveSearch dashboard and the following [API endpoint](https://api.reactivesearch.io/#bdf8961b-322f-48f9-9562-c3e507fd0508).\n\n| \u003cp style=\"margin: 0px;\" class=\"table-header-text\"\u003eType\u003c/p\u003e | \u003cp style=\"margin: 0px;\" class=\"table-header-text\"\u003eApplicable on query of type\u003c/p\u003e | \u003cp style=\"margin: 0px;\" class=\"table-header-text\"\u003eRequired\u003c/p\u003e |\n| ------ | --------------------------- | -------- |\n| `string` | `suggestion` | true* |", "title": "searchboxId", "type": "string" }, @@ -1272,8 +1400,7 @@ "opensearch", "mongodb", "solr", - "zinc", - "marklogic" + "zinc" ], "markdownDescription": "This field indicates the backend of ReactiveSearch. Backend implies the search service being used to store the data.\n\nAs of now, the `backend` field supports the following values:\n\n1. `elasticsearch`: ElasticSearch\n2. `opensearch`: OpenSearch\n\nwhere `elasticsearch` is the default value.\n\n\u003e This field is necessary if backend is OpenSearch and the kNN reordering of scripts are to be used.\n\nFollowing example indicates how to use this field to use kNN reordering with OpenSearch as backend:\n\n```json\n{\n \"query\": [\n {\n \"value\": \"sudoku\",\n \"vectorDataField\": \"name_vector\",\n \"queryVector\": [1.0, -0.2],\n }\n ],\n \"settings\": {\n \"backend\": \"opensearch\"\n }\n}\n```", "title": "backend", @@ -1285,7 +1412,7 @@ "elasticsearch", "opensearch" ], - "markdownDescription": "`Object` It allows you to set the custom events which can be used to build your own analytics on top of the Appbase.io analytics. Further, these events can be used to filter the analytics stats from the Appbase.io dashboard. In the below example, we\\'re setting up two custom events that will be recorded with each search request.\n\n```js\n{\n query: [...],\n settings: {\n customEvents: {\n platform: \"android\",\n user_segment: \"paid\"\n }\n }\n}\n```", + "markdownDescription": "`Object` It allows you to set the custom events which can be used to build your own analytics on top of the ReactiveSearch.io analytics. Further, these events can be used to filter the analytics stats from the ReactiveSearch.io dashboard. In the below example, we\\'re setting up two custom events that will be recorded with each search request.\n\n```js\n{\n query: [...],\n settings: {\n customEvents: {\n platform: \"android\",\n user_segment: \"paid\"\n }\n }\n}\n```", "title": "customEvents", "type": "object" }, @@ -1324,7 +1451,7 @@ "solr", "opensearch" ], - "markdownDescription": "`bool` defaults to `false`. If `true` then it'll enable the recording of Appbase.io analytics.", + "markdownDescription": "`bool` defaults to `false`. If `true` then it'll enable the recording of ReactiveSearch.io analytics.", "title": "recordAnalytics", "type": "boolean" }, @@ -1350,7 +1477,7 @@ "elasticsearch", "opensearch" ], - "markdownDescription": "`String` It allows you to define the user id which will be used to record the Appbase.io analytics.", + "markdownDescription": "`String` It allows you to define the user id which will be used to record the ReactiveSearch.io analytics.", "title": "userId", "type": "string" } From f3ecaa2f308e39b6b8cb10e966c0eabdb08b2507 Mon Sep 17 00:00:00 2001 From: Siddharth Kothari Date: Mon, 8 Sep 2025 19:56:27 +0530 Subject: [PATCH 08/13] chore(build): updates build image workflow to utilize AWS_HOST - for building both AMI and cluster binary. --- .github/workflows/binary-publish.yml | 190 +++++++++++++++++++-------- README.md | 2 +- 2 files changed, 134 insertions(+), 58 deletions(-) diff --git a/.github/workflows/binary-publish.yml b/.github/workflows/binary-publish.yml index 037dedd7..3fb8be3f 100644 --- a/.github/workflows/binary-publish.yml +++ b/.github/workflows/binary-publish.yml @@ -8,7 +8,6 @@ jobs: runs-on: ubuntu-latest outputs: build_arc: ${{ steps.check-build-arc.outputs.run_jobs }} - build_sls: ${{ steps.check-build-sls.outputs.run_jobs }} version: ${{ steps.get-version.outputs.version }} steps: @@ -18,13 +17,6 @@ jobs: TAG_NAME="${{ github.event.release.tag_name }}" echo "Checking tag $TAG_NAME for ARC build" (echo "$TAG_NAME" | grep -Eq '^8\.[0-9]+\.[0-9]+$') && echo "run_jobs=true" >> $GITHUB_OUTPUT || echo "run_jobs=false" >> $GITHUB_OUTPUT - - - name: Check if SLS binary should be built - id: check-build-sls - run: | - TAG_NAME="${{ github.event.release.tag_name }}" - echo "Checking tag $TAG_NAME for SLS build" - (echo "$TAG_NAME" | grep -Eq '^1\.[0-9]+\.[0-9]+$') && echo "run_jobs=true" >> $GITHUB_OUTPUT || echo "run_jobs=false" >> $GITHUB_OUTPUT - name: Get the version from the tag id: get-version @@ -39,18 +31,135 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v2 + + # Build AMI zip on AWS host and upload to this release by tag - name: building binaries for ami uses: appleboy/ssh-action@v0.1.7 env: VERSION: ${{ github.event.release.tag_name }} + PAT_ACCESS_TOKEN: ${{ secrets.PAT_ACCESS_TOKEN }} with: host: ${{ secrets.AWS_BUILD_HOST }} username: ${{ secrets.AWS_BUILD_USERNAME }} key: ${{ secrets.AWS_BUILD_KEY }} port: 22 - envs: VERSION + envs: VERSION,PAT_ACCESS_TOKEN script: | - export PATH=$PATH:/usr/local/go/bin && sh build.sh ${VERSION} + set -euo pipefail + export PATH=$PATH:/usr/local/go/bin:/usr/bin + export GOPATH=$HOME/go + + # Write build helper script on the remote host + cat > "$HOME/rs_build.sh" <<'EOS' + #!/usr/bin/env bash + # Usage: rs_build.sh [branch_or_tag] + # mode: ami | cluster + set -euo pipefail + + version="${1:?version required}" + mode="${2:-ami}" + branch="${3:-$version}" + + # ----- Token resolution ----- + # Use env PAT_ACCESS_TOKEN or ~/.rs_pat if present. + PAT_ACCESS_TOKEN="${PAT_ACCESS_TOKEN:-}" + if [[ -z "${PAT_ACCESS_TOKEN}" && -f "${HOME}/.rs_pat" ]]; then + PAT_ACCESS_TOKEN="$(cat "${HOME}/.rs_pat")" + fi + : "${PAT_ACCESS_TOKEN:?PAT_ACCESS_TOKEN missing (export it or place it in ~/.rs_pat)}" + + if [[ "${mode}" != "ami" && "${mode}" != "cluster" ]]; then + echo "mode must be 'ami' or 'cluster'"; exit 1 + fi + + # ----- Prereqs ----- + command -v go >/dev/null || { echo "go not found on builder"; exit 1; } + command -v zip >/dev/null || { echo "zip not found on builder"; exit 1; } + command -v curl >/dev/null || { echo "curl not found on builder"; exit 1; } + command -v git >/dev/null || { echo "git not found on builder"; exit 1; } + + export GO111MODULE=on + export CGO_ENABLED=1 + export PATH="$PATH:/usr/local/go/bin:/usr/bin" + + # ----- Clone & build ----- + rm -rf arc-noss build out || true + echo "Cloning appbaseio-confidential/rs-api-server @ ${branch}" + git clone --depth=1 -b "${branch}" "https://${PAT_ACCESS_TOKEN}@github.com/appbaseio-confidential/rs-api-server" arc-noss + + pushd arc-noss >/dev/null + make clean + if [[ "${mode}" == "ami" ]]; then + BILLING=true CLUSTER_BILLING= VERSION="${version}" make + else + BILLING= CLUSTER_BILLING=true VERSION="${version}" make + fi + popd >/dev/null + + mkdir -p out + zip -r "out/rs-linux-${mode}.zip" arc-noss/build arc-noss/go >/dev/null + echo "Packaged out/rs-linux-${mode}.zip" + + # ----- Upload to GitHub release (by tag) ----- + owner="appbaseio" + repo="reactivesearch-api" + tag="${version}" + + release_json="$(curl -fsSL -H "Authorization: token ${PAT_ACCESS_TOKEN}" \ + "https://api.github.com/repos/${owner}/${repo}/releases/tags/${tag}")" || { + echo "Failed to fetch release for tag ${tag}"; exit 1; } + + # First id field is the release id + release_id="$(printf '%s' "${release_json}" | awk -F: '/"id":/{gsub(/[ ,]/,"",$2); print $2; exit}')" || true + if [[ -z "${release_id}" ]]; then + echo "Could not parse release id for tag ${tag}"; exit 1 + fi + + asset_path="out/rs-linux-${mode}.zip" + asset_name="$(basename "${asset_path}")" + upload_url="https://uploads.github.com/repos/${owner}/${repo}/releases/${release_id}/assets?name=${asset_name}" + + echo "Uploading ${asset_name} to ${owner}/${repo} (release ${tag})..." + http_code="$(curl -sS -w '%{http_code}' -o /tmp/upload_resp.json \ + -X POST -H "Authorization: token ${PAT_ACCESS_TOKEN}" \ + -H "Content-Type: application/octet-stream" \ + --data-binary @"${asset_path}" \ + "${upload_url}")" + + if [[ "${http_code}" == "201" ]]; then + echo "Upload successful: ${asset_name}" + elif [[ "${http_code}" == "422" ]]; then + echo "Asset exists; attempting replace…" + if command -v jq >/dev/null 2>&1; then + assets_url="$(printf '%s' "${release_json}" | jq -r '.assets_url')" + assets_json="$(curl -fsSL -H "Authorization: token ${PAT_ACCESS_TOKEN}" "${assets_url}")" + existing_id="$(printf '%s' "${assets_json}" | jq -r ".[] | select(.name==\"${asset_name}\") | .id")" || true + if [[ -n "${existing_id}" && "${existing_id}" != "null" ]]; then + curl -fsSL -X DELETE -H "Authorization: token ${PAT_ACCESS_TOKEN}" \ + "https://api.github.com/repos/${owner}/${repo}/releases/assets/${existing_id}" || true + http_code2="$(curl -sS -w '%{http_code}' -o /tmp/upload_resp2.json \ + -X POST -H "Authorization: token ${PAT_ACCESS_TOKEN}" \ + -H "Content-Type: application/octet-stream" \ + --data-binary @"${asset_path}" \ + "${upload_url}")" + [[ "${http_code2}" == "201" ]] && echo "Re-upload successful" || { echo "Re-upload failed (${http_code2})"; cat /tmp/upload_resp2.json; exit 1; } + else + echo "Could not find existing asset id to delete."; cat /tmp/upload_resp.json; exit 1 + fi + else + echo "jq not available; cannot replace existing asset automatically."; cat /tmp/upload_resp.json; exit 1 + fi + else + echo "Upload failed (${http_code})."; cat /tmp/upload_resp.json; exit 1 + fi + + echo "Done." + EOS + chmod +x "$HOME/rs_build.sh" + + # Build AMI artifact first so Packer can fetch it + "$HOME/rs_build.sh" "${VERSION}" ami "${VERSION}" + - name: Build AMI uses: hashicorp/packer-github-actions@master with: @@ -61,50 +170,27 @@ jobs: AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }} AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }} VERSION: ${{ github.event.release.tag_name }} - - name: building binaries for eaas deployments - uses: appleboy/ssh-action@v0.1.7 - env: - VERSION: ${{ github.event.release.tag_name }} - with: - host: ${{ secrets.GCLOUD_BUILD_HOST }} - username: ${{ secrets.GCLOUD_BUILD_USERNAME }} - key: ${{ secrets.GCLOUD_BUILD_KEY }} - port: 22 - timeout: 3600s - command_timeout: 3600s - envs: VERSION - script: | - source ~/.bashrc - export PATH=$PATH:/usr/local/go/bin:/usr/bin - export GOPATH=/home/centos/go - ./build.sh ${VERSION} - build-sls: - name: Build SLS binary - needs: determine_whether_to_run - if: needs.determine_whether_to_run.outputs.build_sls == 'true' - runs-on: ubuntu-latest - timeout-minutes: 60 - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - name: building binaries for eaas deployments + # Reuse the same AWS host to build the cluster zip and upload it + - name: building binaries for cluster (linux/amd64) uses: appleboy/ssh-action@v0.1.7 env: VERSION: ${{ github.event.release.tag_name }} + PAT_ACCESS_TOKEN: ${{ secrets.PAT_ACCESS_TOKEN }} with: - host: ${{ secrets.GCLOUD_BUILD_HOST }} - username: ${{ secrets.GCLOUD_BUILD_USERNAME }} - key: ${{ secrets.GCLOUD_BUILD_KEY }} + host: ${{ secrets.AWS_BUILD_HOST }} + username: ${{ secrets.AWS_BUILD_USERNAME }} + key: ${{ secrets.AWS_BUILD_KEY }} port: 22 - timeout: 3600s - command_timeout: 3600s - envs: VERSION + envs: VERSION,PAT_ACCESS_TOKEN script: | - source ~/.bashrc + set -euo pipefail export PATH=$PATH:/usr/local/go/bin:/usr/bin - export GOPATH=/home/centos/go - ./sls-build.sh ${VERSION} feat/true-sls + export GOPATH=$HOME/go + if [[ ! -x "$HOME/rs_build.sh" ]]; then + echo "Missing build helper; abort."; exit 1 + fi + "$HOME/rs_build.sh" "${VERSION}" cluster "${VERSION}" send-packer-event-arc: name: Send Packer Event @@ -116,16 +202,6 @@ jobs: secrets: token: ${{ secrets.REPO_ACCESS_TOKEN }} - send-packer-event-sls: - name: Send Packer Event - needs: build-sls - uses: ./.github/workflows/build_images.yml - with: - ref: ${{ github.ref }} - event_name: new_sls_release - secrets: - token: ${{ secrets.REPO_ACCESS_TOKEN }} - send-docker-event-arc: name: Send Docker Event needs: [build-arc, determine_whether_to_run] @@ -137,4 +213,4 @@ jobs: token: ${{ secrets.REPO_ACCESS_TOKEN }} repository: appbaseio-confidential/rs-api-server event-type: publish_docker - client-payload: '{"version": "${{ needs.determine_whether_to_run.outputs.version }}" }' \ No newline at end of file + client-payload: '{"version": "${{ needs.determine_whether_to_run.outputs.version }}" }' diff --git a/README.md b/README.md index c05ef1ad..8a3cd488 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ReactiveSearch API -[![Tests](https://github.com/appbaseio/reactivesearch-api/actions/workflows/tests.yml/badge.svg)](https://github.com/appbaseio/reactivesearch-api/actions/workflows/tests.yml) [![Docker](https://github.com/appbaseio/reactivesearch-api/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/appbaseio/reactivesearch-api/actions/workflows/docker-publish.yml) +[![Tests](https://github.com/appbaseio/reactivesearch-api/actions/workflows/tests.yml/badge.svg)](https://github.com/appbaseio/reactivesearch-api/actions/workflows/tests.yml) [![Docker](https://github.com/appbaseio/reactivesearch-api/actions/workflows/docker-image.yml/badge.svg)](https://github.com/appbaseio/reactivesearch-api/actions/workflows/docker-image.yml) ReactiveSearch API is a declarative, open-source API for querying Elasticsearch, OpenSearch, Solr, MongoDB Atlas Search and OpenAI. It also acts as a reverse proxy and API gateway for Elasticsearch and OpenSearch. ReactiveSearch API is best suited for site search, app search and e-commerce search use-cases. From bc2eca1b8bdbef745abd31a21a079f60486e6ab4 Mon Sep 17 00:00:00 2001 From: Siddharth Kothari Date: Tue, 9 Sep 2025 15:59:07 +0530 Subject: [PATCH 09/13] fix(build): support major versions >= 8 for Arc release build steps --- .github/workflows/binary-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/binary-publish.yml b/.github/workflows/binary-publish.yml index 3fb8be3f..70576b6b 100644 --- a/.github/workflows/binary-publish.yml +++ b/.github/workflows/binary-publish.yml @@ -16,7 +16,7 @@ jobs: run: | TAG_NAME="${{ github.event.release.tag_name }}" echo "Checking tag $TAG_NAME for ARC build" - (echo "$TAG_NAME" | grep -Eq '^8\.[0-9]+\.[0-9]+$') && echo "run_jobs=true" >> $GITHUB_OUTPUT || echo "run_jobs=false" >> $GITHUB_OUTPUT + (echo "$TAG_NAME" | grep -Eq '^([8-9]|[1-9][0-9]+)\.[0-9]+\.[0-9]+$') && echo "run_jobs=true" >> $GITHUB_OUTPUT || echo "run_jobs=false" >> $GITHUB_OUTPUT - name: Get the version from the tag id: get-version From a4f456e0e4adf6871e492cfbf3f252c4fd32af2b Mon Sep 17 00:00:00 2001 From: Siddharth Kothari Date: Tue, 9 Sep 2025 16:18:05 +0530 Subject: [PATCH 10/13] fix(build): update to valid source ami --- ami.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ami.json b/ami.json index 3b279639..1a1688c5 100644 --- a/ami.json +++ b/ami.json @@ -12,7 +12,7 @@ "region": "us-east-1", "instance_type": "t2.micro", "ssh_username": "ec2-user", - "source_ami": "ami-086ec7d10754b79ca", + "source_ami": "ami-0eaf8bcec9ab4bde5", "ami_name": "reactivesearch-api-{{user `VERSION` | clean_resource_name}}", "ssh_timeout": "10m", "ami_regions": ["us-east-1"], From fee62afdfc532e311da07ff3197738ffbc7d66cd Mon Sep 17 00:00:00 2001 From: Siddharth Kothari Date: Tue, 9 Sep 2025 16:43:28 +0530 Subject: [PATCH 11/13] fix(build): zip path --- .github/workflows/binary-publish.yml | 37 ++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/.github/workflows/binary-publish.yml b/.github/workflows/binary-publish.yml index 70576b6b..664f0dcb 100644 --- a/.github/workflows/binary-publish.yml +++ b/.github/workflows/binary-publish.yml @@ -2,6 +2,12 @@ name: build binary on: release: types: [published] + workflow_dispatch: + inputs: + version: + description: "Version tag to build (e.g., 9.0.0)" + required: true + type: string jobs: determine_whether_to_run: @@ -13,14 +19,26 @@ jobs: steps: - name: Check if Arc binary should be built id: check-build-arc + env: + INPUT_VERSION: ${{ inputs.version }} + RELEASE_TAG: ${{ github.event.release.tag_name }} run: | - TAG_NAME="${{ github.event.release.tag_name }}" + TAG_NAME="${INPUT_VERSION:-${RELEASE_TAG}}" echo "Checking tag $TAG_NAME for ARC build" - (echo "$TAG_NAME" | grep -Eq '^([8-9]|[1-9][0-9]+)\.[0-9]+\.[0-9]+$') && echo "run_jobs=true" >> $GITHUB_OUTPUT || echo "run_jobs=false" >> $GITHUB_OUTPUT + if echo "$TAG_NAME" | grep -Eq '^([8-9]|[1-9][0-9]+)\.[0-9]+\.[0-9]+$'; then + echo "run_jobs=true" >> "$GITHUB_OUTPUT" + else + echo "run_jobs=false" >> "$GITHUB_OUTPUT" + fi - name: Get the version from the tag id: get-version - run: echo "version=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT + env: + INPUT_VERSION: ${{ inputs.version }} + RELEASE_TAG: ${{ github.event.release.tag_name }} + run: | + VERSION="${INPUT_VERSION:-${RELEASE_TAG}}" + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" build-arc: name: Build ARC binary @@ -36,7 +54,7 @@ jobs: - name: building binaries for ami uses: appleboy/ssh-action@v0.1.7 env: - VERSION: ${{ github.event.release.tag_name }} + VERSION: ${{ needs.determine_whether_to_run.outputs.version }} PAT_ACCESS_TOKEN: ${{ secrets.PAT_ACCESS_TOKEN }} with: host: ${{ secrets.AWS_BUILD_HOST }} @@ -97,8 +115,11 @@ jobs: popd >/dev/null mkdir -p out - zip -r "out/rs-linux-${mode}.zip" arc-noss/build arc-noss/go >/dev/null - echo "Packaged out/rs-linux-${mode}.zip" + # Zip without the leading arc-noss/ so the archive has build/ and go/ at root + pushd arc-noss >/dev/null + zip -r "../out/rs-linux-${mode}.zip" build go >/dev/null + popd >/dev/null + echo "Packaged out/rs-linux-${mode}.zip (root: build/, go/)" # ----- Upload to GitHub release (by tag) ----- owner="appbaseio" @@ -169,13 +190,13 @@ jobs: PACKER_LOG: 1 AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }} AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }} - VERSION: ${{ github.event.release.tag_name }} + VERSION: ${{ needs.determine_whether_to_run.outputs.version }} # Reuse the same AWS host to build the cluster zip and upload it - name: building binaries for cluster (linux/amd64) uses: appleboy/ssh-action@v0.1.7 env: - VERSION: ${{ github.event.release.tag_name }} + VERSION: ${{ needs.determine_whether_to_run.outputs.version }} PAT_ACCESS_TOKEN: ${{ secrets.PAT_ACCESS_TOKEN }} with: host: ${{ secrets.AWS_BUILD_HOST }} From 5a1b1a5231d653f02a48922e06519ad7097f2f6b Mon Sep 17 00:00:00 2001 From: Siddharth Kothari Date: Tue, 9 Sep 2025 17:21:24 +0530 Subject: [PATCH 12/13] fix(workflow): output file names and packer event trigger condition --- .github/workflows/binary-publish.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/binary-publish.yml b/.github/workflows/binary-publish.yml index 664f0dcb..f9e10703 100644 --- a/.github/workflows/binary-publish.yml +++ b/.github/workflows/binary-publish.yml @@ -117,9 +117,9 @@ jobs: mkdir -p out # Zip without the leading arc-noss/ so the archive has build/ and go/ at root pushd arc-noss >/dev/null - zip -r "../out/rs-linux-${mode}.zip" build go >/dev/null + zip -r "../out/arc-linux-${mode}.zip" build go >/dev/null popd >/dev/null - echo "Packaged out/rs-linux-${mode}.zip (root: build/, go/)" + echo "Packaged out/arc-linux-${mode}.zip (root: build/, go/)" # ----- Upload to GitHub release (by tag) ----- owner="appbaseio" @@ -136,7 +136,7 @@ jobs: echo "Could not parse release id for tag ${tag}"; exit 1 fi - asset_path="out/rs-linux-${mode}.zip" + asset_path="out/arc-linux-${mode}.zip" asset_name="$(basename "${asset_path}")" upload_url="https://uploads.github.com/repos/${owner}/${repo}/releases/${release_id}/assets?name=${asset_name}" @@ -218,7 +218,8 @@ jobs: needs: build-arc uses: ./.github/workflows/build_images.yml with: - ref: ${{ github.ref }} + # Pass a tag-style ref so the called workflow's regex gate passes on manual runs + ref: "refs/tags/${{ needs.determine_whether_to_run.outputs.version }}" event_name: new_release secrets: token: ${{ secrets.REPO_ACCESS_TOKEN }} From 6abea98ab56def762f279662779a8ea6799fea04 Mon Sep 17 00:00:00 2001 From: Siddharth Kothari Date: Thu, 4 Dec 2025 05:29:46 +0530 Subject: [PATCH 13/13] chore (build): uses sudo for previous build related cleanup --- .github/workflows/binary-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/binary-publish.yml b/.github/workflows/binary-publish.yml index f9e10703..6fc51c34 100644 --- a/.github/workflows/binary-publish.yml +++ b/.github/workflows/binary-publish.yml @@ -101,7 +101,7 @@ jobs: export PATH="$PATH:/usr/local/go/bin:/usr/bin" # ----- Clone & build ----- - rm -rf arc-noss build out || true + sudo rm -rf arc-noss build out 2>/dev/null || true echo "Cloning appbaseio-confidential/rs-api-server @ ${branch}" git clone --depth=1 -b "${branch}" "https://${PAT_ACCESS_TOKEN}@github.com/appbaseio-confidential/rs-api-server" arc-noss